From 07c4203f7248a8cbbd4f2405dda2bc3f82319cb2 Mon Sep 17 00:00:00 2001 From: Digital Data - Marlon Schreiber Date: Thu, 16 Aug 2018 10:18:43 +0200 Subject: [PATCH] MS TestGui und Logger Daily --- Modules.Logging/Logger.vb | 2 +- Modules.Windream/Windream.vb | 127 ++++++++++-------- TestGUI/App.config | 18 +++ TestGUI/Form1.Designer.vb | 164 +++++++++++++++++++++++- TestGUI/Form1.vb | 50 +++++++- TestGUI/My Project/AssemblyInfo.vb | 2 +- TestGUI/My Project/Settings.Designer.vb | 108 ++++++++++------ TestGUI/My Project/Settings.settings | 20 ++- TestGUI/My Project/licenses.licx | 1 + TestGUI/TestGUI.vbproj | 27 ++++ TestGUI/packages.config | 4 + 11 files changed, 420 insertions(+), 103 deletions(-) create mode 100644 TestGUI/My Project/licenses.licx create mode 100644 TestGUI/packages.config diff --git a/Modules.Logging/Logger.vb b/Modules.Logging/Logger.vb index f0b2a496..bf3a37ad 100644 --- a/Modules.Logging/Logger.vb +++ b/Modules.Logging/Logger.vb @@ -29,7 +29,7 @@ Public Class Logger Private Const KEEP_FILES_OPEN As Boolean = False Private Const MAX_ARCHIVE_FILES_DEFAULT As Integer = 30 Private Const MAX_ARCHIVE_FILES_DEBUG_DETAIL As Integer = 1 - Private Const ARCHIVE_EVERY As FileArchivePeriod = FileArchivePeriod.Minute + Private Const ARCHIVE_EVERY As FileArchivePeriod = FileArchivePeriod.Day Private Const FILE_NAME_FORMAT_DEFAULT As String = "${shortdate}-${var:product}.log" Private Const FILE_NAME_FORMAT_DETAIL As String = "${shortdate}-${var:product}-Detail.log" diff --git a/Modules.Windream/Windream.vb b/Modules.Windream/Windream.vb index 458a4f4d..2ac8853a 100644 --- a/Modules.Windream/Windream.vb +++ b/Modules.Windream/Windream.vb @@ -10,15 +10,14 @@ Public Class Windream Inherits Constants #Region "+++++ Variables +++++" Private Shared Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger - - Public Shared CurrentSession As WMObject = Nothing - Public Shared CurrentSessionIsLoggedIn As Boolean = False - Private Shared CurrentObjecttypes As WINDREAMLib.WMObjects - Private Shared CurrentController As WMOSearchController + Public CurrentSession = Nothing + Public CurrentSessionIsLoggedIn As Boolean = False + Private CurrentObjecttypes As WINDREAMLib.WMObjects + Private CurrentController As WMOSearchController Private Shared CurrentWMConnect ' der Typ darf nicht festgelegt werden (warum auch immer... geht sonst nicht) - Public Shared CurrentWMServer As String - Private Shared WMDriveLetter As String = "W" - Private Shared _Session_Reconnect As Boolean = False + Public CurrentWMServer As String + Private WMDriveLetter As String = "W" + Private _Session_Reconnect As Boolean = False #End Region #Region "+++++ Init +++++" ''' @@ -38,7 +37,7 @@ Public Class Windream ''' ''' Returns true when created, false if not ''' - Public Shared Function NewSession() + Public Function NewSession() Try Dim wmbrwsr wmbrwsr = CreateObject("WMOBrws.ServerBrowser") @@ -50,6 +49,7 @@ Public Class Windream Dim Connect Try Connect = CreateObject("Windream.WMConnect") + Logger.Info("...connected to windream!") Catch ex As Exception CurrentSession = Nothing CurrentSessionIsLoggedIn = False @@ -74,8 +74,11 @@ Public Class Windream Try Connect.LoginSession(CurrentSession) If CurrentSession.aLoggedin Then + CurrentWMConnect = Connect CurrentSessionIsLoggedIn = True + Logger.Info("UserSession has been created!") Try + 'Standardmässig hinterlegen dass abgelegte Dateien keine Indexmaske öffnet CurrentSession.SwitchEvents(WMCOMEventWMSessionNeedIndex, False) ' der Parameter WMEntityDocument definiert, dass nur Dokumenttypen und keine ' Ordnertypen ausgelesen werden @@ -116,7 +119,7 @@ Public Class Windream End Function #End Region #Region "+++++ New +++++" - Public Shared Function NewFile() + Public Function NewFile() End Function ''' @@ -125,7 +128,7 @@ Public Class Windream ''' full path of new folder ''' Returns true when folder was created, false if not ''' - Public Shared Function NewFolder(ByVal folderpath As String) + Public Function NewFolder(ByVal folderpath As String) Try If folderpath.StartsWith("\") = False And folderpath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then folderpath = folderpath.Substring(2) @@ -159,19 +162,14 @@ Public Class Windream ''' values as array ''' Returns true when folder was created, false if not ''' - Private Shared Function NewIndexFile(WMFile As String, ByVal indexname As String, ByVal aValues() As String) - - If Not WMFile.StartsWith("\") And WMFile.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then - WMFile = WMFile.Substring(2) + Public Function NewIndexFile(WMFile As String, ByVal indexname As String, ByVal aValues() As String) As Boolean + If TestSession() = False Then + Return False End If - Dim oWMFile As WINDREAMLib.WMObject - Try - oWMFile = CurrentSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WMFile) 'WINDREAMLib.WMEntity.WMEntityDocument - Catch ex As Exception - Logger.Error(ex) - 'clsLogger.Add(">> Could not create oWMFile-Indexing file '" & WD_File & ": " & ex.Message, True) + Dim oWMFile As WMObject = GetWMObjectForFile(WMFile) + If IsNothing(oWMFile) Then Return False - End Try + End If Dim vektInsState As Integer = 1 Try If Not oWMFile.aLocked Then @@ -287,7 +285,7 @@ Public Class Windream Try If oWMValueConverted.ToString Is Nothing = False Then Logger.Info("Now: oWMFile.SetVariableValue(" & indexname & ", " & oWMValueConverted & ")") - oWMFile.SetVariableValue(indexname, CInt(oWMValueConverted)) + oWMFile.SetVariableValue(indexname, oWMValueConverted) 'Die Datei speichern oWMFile.Save() Logger.Info("Index has been written!") @@ -339,7 +337,7 @@ Public Class Windream Return False End Try End Function - Private Shared Function NewLockWMFile(oWMFile As WMObject) As Boolean + Private Function NewLockWMFile(oWMFile As WMObject) As Boolean Try oWMFile.lock() Return True @@ -355,7 +353,7 @@ Public Class Windream ''' Obcjectype Name ''' Returns true when Otype was set, false if not ''' - Public Shared Function NewObjecttypeForFolder(folderpath As String, folderObjecttype As String) + Public Function NewObjecttypeForFolder(folderpath As String, folderObjecttype As String) Try Dim result As Boolean = False Dim WMFolder As WINDREAMLib.WMObject @@ -415,7 +413,7 @@ Public Class Windream ''' Comment ''' Returns true when version was created, false if not ''' - Public Shared Function NewVersion(ByVal WMPath As String, ByVal Comment As String) + Public Function NewVersion(ByVal WMPath As String, ByVal Comment As String) Try If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then WMPath = WMPath.Substring(2) @@ -442,28 +440,29 @@ Public Class Windream ''' ''' choicelists as String-Array ''' - Public Shared Function GetChoiceLists() As List(Of String) + Public Function GetChoiceLists() As DataTable + Dim dtresult As New DataTable + dtresult.Columns.Add("RESULT", GetType(String)) Try Dim oChoiceLists As WMObjects Dim oChoiceList As IWMObject2 ' den Objekttyp laden oChoiceLists = CurrentSession.GetAllObjects(WMEntityChoiceList) 'Array für Indizes vorbereiten - Dim choiceLists As New List(Of String) + For j As Integer = 0 To oChoiceLists.Count() - 1 ' aktuellee Liste ausleseb auslesen oChoiceList = oChoiceLists.Item(j) - - choiceLists.Add(oChoiceList.aName) + dtresult.Rows.Add(oChoiceList.aName) Next - - Return choiceLists + dtresult.AcceptChanges() + Return dtresult Catch ex As Exception Logger.Error(ex) - Return Nothing + Return dtresult End Try End Function ''' @@ -472,7 +471,7 @@ Public Class Windream ''' Name of objecttype ''' Name of containing indices as String-Array ''' - Public Shared Function GetIndicesByObjecttype(ByVal ObjecttypeName As String) As String() + Public Function GetIndicesByObjecttype(ByVal ObjecttypeName As String) As String() Try Dim oObjectType As WMObject Dim oIndexAttributes As WMObjectRelation @@ -519,7 +518,9 @@ Public Class Windream ''' name of choicelist ''' items as String-Array ''' - Public Function GetChoicelistItems(ByVal NameChoicelist As String) As Object + Public Function GetChoicelistItems(ByVal NameChoicelist As String) As DataTable + Dim dtresult As New DataTable + dtresult.Columns.Add("RESULT", GetType(String)) Try 'Dim oAttribute = Me.oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname) 'Dim vType = oAttribute.getVariableValue("vItems") @@ -539,14 +540,16 @@ Public Class Windream Dim zahl As Integer = 0 For Each CLItem In Values If oChoiceList.aName IsNot Nothing Then + dtresult.Rows.Add(CLItem) strListe(zahl) = CLItem zahl += 1 End If + dtresult.AcceptChanges() Next - Return strListe + Return dtresult Else Logger.Warn("WMchoicelist: " & NameChoicelist & " not found!") - Return Nothing + Return dtresult End If Catch ex As Exception @@ -559,16 +562,18 @@ Public Class Windream ''' ''' array(String) of all objecttypes ''' - Public Function GetObjecttypesAsStrings() As String() + Public Function GetObjecttypesAsStrings() As DataTable + Dim dtresult As New DataTable + dtresult.Columns.Add("RESULT", GetType(String)) Try - Dim objektTypenStr(CurrentObjecttypes.Count) As String For i As Integer = 0 To CurrentObjecttypes.Count - objektTypenStr(i) = CurrentObjecttypes.Item(i).aName + dtresult.Rows.Add(CurrentObjecttypes.Item(i).aName) Next - Return objektTypenStr + dtresult.AcceptChanges() + Return dtresult Catch ex As Exception Logger.Error(ex) - Return Nothing + Return dtresult End Try End Function ''' @@ -578,7 +583,7 @@ Public Class Windream ''' Name of the Docid Index ''' Returns datatable ''' - Public Shared Function GetSearchDocuments(ByVal wdfLocation As String, NameIndexDocID As String) + Public Function GetSearchDocuments(ByVal wdfLocation As String, NameIndexDocID As String) Dim dt As New DataTable dt.Columns.Add("DOC_ID", GetType(Integer)) dt.Columns.Add("PATH", GetType(String)) @@ -661,7 +666,7 @@ Public Class Windream ''' Name of indexfield ''' Returns integer, which describes the type ''' - Public Shared Function GetTypeOfIndexAsInt(ByVal indexname As String) As Integer + Public Function GetTypeOfIndexAsInt(ByVal indexname As String) As Integer Try Dim oAttribute = CurrentSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname) Dim vType = oAttribute.getVariableValue("dwAttrType") @@ -677,10 +682,14 @@ Public Class Windream ''' Name of the index ''' Datatable ''' - Public Shared Function GetValueforIndex(ByVal WMFile As String, ByVal NameIndex As String) As DataTable + Public Function GetValueforIndex(ByVal WMFile As String, ByVal NameIndex As String) As DataTable Dim dt As New DataTable dt.Columns.Add("RESULT", GetType(String)) + If TestSession() = False Then + Return dt + End If Try + If Not WMFile.StartsWith("\") And WMFile.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then WMFile = WMFile.Substring(2) End If @@ -714,11 +723,11 @@ Public Class Windream ''' ''' Returns the values for a vektorfield plus the new ones ''' - ''' filepath of windream-file - ''' Name of the index + ''' windream-file as Object + ''' Name of the index ''' Returns value as Datatable ''' - Public Shared Function Return_VektorArray(ByVal oDocument As WMObject, vktIndexName As String, arrIndexwerte As Object, vType As Object) + Public Function Return_VektorArray(ByVal oDocument As WMObject, vktIndexName As String, arrIndexwerte As Object, vType As Object) Try Dim missing As Boolean = False Dim valueCount As Integer = 0 @@ -791,7 +800,7 @@ Public Class Windream ''' full path to the file ''' Returns WMObject ''' - Public Shared Function GetWMObjectForFile(ByVal WMPath As String) As WMObject + Public Function GetWMObjectForFile(ByVal WMPath As String) As WMObject Try If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then WMPath = WMPath.Substring(2) @@ -817,7 +826,7 @@ Public Class Windream ''' The path of the folder ''' True if exists or false if not or error occured ''' - Public Shared Function TestFolderExists(folderpath As String) + Public Function TestFolderExists(folderpath As String) Try If folderpath.StartsWith("\") = False And folderpath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then folderpath = folderpath.Substring(2) @@ -839,7 +848,7 @@ Public Class Windream ''' full path to the file ''' Returns true when file was deleted, false if not ''' - Public Shared Function TestFileExists(ByVal WMPath As String) + Public Function TestFileExists(ByVal WMPath As String) Try If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then WMPath = WMPath.Substring(2) @@ -856,6 +865,18 @@ Public Class Windream Return False End Try End Function + Private Function TestSession() As Boolean + Try + If CurrentSession.aLoggedin Then + Return True + Else + Logger.Warn("There is no active WM-SSession!") + Return False + End If + Catch ex As Exception + Return False + End Try + End Function #End Region #Region "+++++ Remove +++++" ''' @@ -864,7 +885,7 @@ Public Class Windream ''' full path to the file ''' Returns true when file was deleted, false if not ''' - Public Shared Function RemFile(ByVal WMPath As String) + Public Function RemFile(ByVal WMPath As String) Try If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then WMPath = WMPath.Substring(2) @@ -890,7 +911,7 @@ Public Class Windream ''' Value which is to be deleted ''' Returns true when indexing was successfull, false if not ''' - Public Shared Function REMOVE_VEKTOR_LINK(ByVal WMPath As String, vktIndexName As String, deleteValue As String) + Public Function REMOVE_VEKTOR_LINK(ByVal WMPath As String, vktIndexName As String, deleteValue As String) Try Logger.Info("Removing Value '" & deleteValue & "' of Index '" & vktIndexName & "' " & WMPath) Dim oWMFile As WINDREAMLib.WMObject = GetWMObjectForFile(WMPath) diff --git a/TestGUI/App.config b/TestGUI/App.config index 5534e287..428eeb20 100644 --- a/TestGUI/App.config +++ b/TestGUI/App.config @@ -1,6 +1,24 @@  + + +
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TestGUI/Form1.Designer.vb b/TestGUI/Form1.Designer.vb index a9be7fdb..f011c98b 100644 --- a/TestGUI/Form1.Designer.vb +++ b/TestGUI/Form1.Designer.vb @@ -23,40 +23,194 @@ Partial Class Form1 _ Private Sub InitializeComponent() Me.Button1 = New System.Windows.Forms.Button() + Me.Button3 = New System.Windows.Forms.Button() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.Label3 = New System.Windows.Forms.Label() + Me.txtWMValue = New System.Windows.Forms.TextBox() + Me.IndexFile = New System.Windows.Forms.Button() + Me.GetValue = New System.Windows.Forms.Button() + Me.Label4 = New System.Windows.Forms.Label() + Me.txtwmsearch = New System.Windows.Forms.TextBox() + Me.txtWMIndex = New System.Windows.Forms.TextBox() + Me.txtWMFile = New System.Windows.Forms.TextBox() Me.Button2 = New System.Windows.Forms.Button() + Me.GridControl1 = New DevExpress.XtraGrid.GridControl() + Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView() + CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'Button1 ' - Me.Button1.Location = New System.Drawing.Point(12, 78) + Me.Button1.Location = New System.Drawing.Point(12, 12) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(267, 23) Me.Button1.TabIndex = 0 Me.Button1.Text = "windream instanzieren" Me.Button1.UseVisualStyleBackColor = True ' + 'Button3 + ' + Me.Button3.Location = New System.Drawing.Point(297, 12) + Me.Button3.Name = "Button3" + Me.Button3.Size = New System.Drawing.Size(56, 21) + Me.Button3.TabIndex = 2 + Me.Button3.Text = "LogPath" + Me.Button3.UseVisualStyleBackColor = True + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(16, 55) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(46, 13) + Me.Label1.TabIndex = 5 + Me.Label1.Text = "WMFile:" + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(16, 101) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(56, 13) + Me.Label2.TabIndex = 6 + Me.Label2.Text = "WMIndex:" + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(284, 101) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(37, 13) + Me.Label3.TabIndex = 7 + Me.Label3.Text = "Value:" + ' + 'txtWMValue + ' + Me.txtWMValue.Location = New System.Drawing.Point(287, 117) + Me.txtWMValue.Name = "txtWMValue" + Me.txtWMValue.Size = New System.Drawing.Size(263, 20) + Me.txtWMValue.TabIndex = 8 + ' + 'IndexFile + ' + Me.IndexFile.Location = New System.Drawing.Point(556, 74) + Me.IndexFile.Name = "IndexFile" + Me.IndexFile.Size = New System.Drawing.Size(75, 23) + Me.IndexFile.TabIndex = 9 + Me.IndexFile.Text = "IndexFile" + Me.IndexFile.UseVisualStyleBackColor = True + ' + 'GetValue + ' + Me.GetValue.Location = New System.Drawing.Point(287, 143) + Me.GetValue.Name = "GetValue" + Me.GetValue.Size = New System.Drawing.Size(99, 23) + Me.GetValue.TabIndex = 10 + Me.GetValue.Text = "GetValue" + Me.GetValue.UseVisualStyleBackColor = True + ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Location = New System.Drawing.Point(20, 195) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(46, 13) + Me.Label4.TabIndex = 12 + Me.Label4.Text = "WMFile:" + ' + 'txtwmsearch + ' + Me.txtwmsearch.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.TestGUI.My.MySettings.Default, "WMSearch", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)) + Me.txtwmsearch.Location = New System.Drawing.Point(19, 214) + Me.txtwmsearch.Name = "txtwmsearch" + Me.txtwmsearch.Size = New System.Drawing.Size(535, 20) + Me.txtwmsearch.TabIndex = 11 + Me.txtwmsearch.Text = Global.TestGUI.My.MySettings.Default.WMSearch + ' + 'txtWMIndex + ' + Me.txtWMIndex.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.TestGUI.My.MySettings.Default, "WMIndexName", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)) + Me.txtWMIndex.Location = New System.Drawing.Point(15, 117) + Me.txtWMIndex.Name = "txtWMIndex" + Me.txtWMIndex.Size = New System.Drawing.Size(267, 20) + Me.txtWMIndex.TabIndex = 4 + Me.txtWMIndex.Text = Global.TestGUI.My.MySettings.Default.WMIndexName + ' + 'txtWMFile + ' + Me.txtWMFile.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.TestGUI.My.MySettings.Default, "WMFilepath", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)) + Me.txtWMFile.Location = New System.Drawing.Point(15, 74) + Me.txtWMFile.Name = "txtWMFile" + Me.txtWMFile.Size = New System.Drawing.Size(535, 20) + Me.txtWMFile.TabIndex = 3 + Me.txtWMFile.Text = Global.TestGUI.My.MySettings.Default.WMFilepath + ' 'Button2 ' - Me.Button2.Location = New System.Drawing.Point(12, 12) + Me.Button2.Location = New System.Drawing.Point(561, 214) Me.Button2.Name = "Button2" - Me.Button2.Size = New System.Drawing.Size(267, 23) - Me.Button2.TabIndex = 1 - Me.Button2.Text = "Logger initialisieren" + Me.Button2.Size = New System.Drawing.Size(75, 23) + Me.Button2.TabIndex = 13 + Me.Button2.Text = "Button2" Me.Button2.UseVisualStyleBackColor = True ' + 'GridControl1 + ' + Me.GridControl1.Location = New System.Drawing.Point(19, 240) + Me.GridControl1.MainView = Me.GridView1 + Me.GridControl1.Name = "GridControl1" + Me.GridControl1.Size = New System.Drawing.Size(535, 200) + Me.GridControl1.TabIndex = 14 + Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1}) + ' + 'GridView1 + ' + Me.GridView1.GridControl = Me.GridControl1 + Me.GridView1.Name = "GridView1" + ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(800, 450) + Me.Controls.Add(Me.GridControl1) Me.Controls.Add(Me.Button2) + Me.Controls.Add(Me.Label4) + Me.Controls.Add(Me.txtwmsearch) + Me.Controls.Add(Me.GetValue) + Me.Controls.Add(Me.IndexFile) + Me.Controls.Add(Me.txtWMValue) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.Label2) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.txtWMIndex) + Me.Controls.Add(Me.txtWMFile) + Me.Controls.Add(Me.Button3) Me.Controls.Add(Me.Button1) Me.Name = "Form1" Me.Text = "Form1" + CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) + Me.PerformLayout() End Sub Friend WithEvents Button1 As Button + Friend WithEvents Button3 As Button + Friend WithEvents txtWMFile As TextBox + Friend WithEvents txtWMIndex As TextBox + Friend WithEvents Label1 As Label + Friend WithEvents Label2 As Label + Friend WithEvents Label3 As Label + Friend WithEvents txtWMValue As TextBox + Friend WithEvents IndexFile As Button + Friend WithEvents GetValue As Button + Friend WithEvents Label4 As Label + Friend WithEvents txtwmsearch As TextBox Friend WithEvents Button2 As Button + Friend WithEvents GridControl1 As DevExpress.XtraGrid.GridControl + Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView End Class diff --git a/TestGUI/Form1.vb b/TestGUI/Form1.vb index 7ad5ed6a..45def2c3 100644 --- a/TestGUI/Form1.vb +++ b/TestGUI/Form1.vb @@ -1,7 +1,55 @@ Imports Modules.Windream +Imports Modules.Logging Public Class Form1 + Dim MyLogger As Logger + Protected _windream As Windream Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + _windream = New Windream("W", True) + If _windream.CurrentSessionIsLoggedIn = True Then + MsgBox("Session created") + Else + MsgBox("No session created") + End If + End Sub + Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click + Process.Start(MyLogger.LogDirectory) + End Sub + + Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load + MyLogger = New Logger(Logger.PathType.AppData) + End Sub + + Private Sub Button2_Click(sender As Object, e As EventArgs) Handles GetValue.Click + My.Settings.Save + Dim result As DataTable = _windream.GetValueforIndex(txtWMFile.Text, txtWMIndex.Text) + If result.Rows.Count = 0 Then + MsgBox("No result") + Else + txtWMValue.Text = result.Rows(0).Item(0).ToString + End If + End Sub + + Private Sub IndexFile_Click(sender As Object, e As EventArgs) Handles IndexFile.Click + My.Settings.Save() + Dim arrValue() As String = Nothing + ReDim Preserve arrValue(0) + arrValue(0) = txtWMValue.Text + If _windream.NewIndexFile(txtWMFile.Text, txtWMIndex.Text, arrValue) = True Then + MsgBox("Success") + Else + MsgBox("no indexing") + End If + + End Sub - Dim WM As New Windream("W", True) + Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles Button2.Click + My.Settings.Save() + Dim DTResults As DataTable = _windream.GetSearchDocuments(txtwmsearch.Text, "Dokument-ID") + If DTResults.Rows.Count > 0 Then + GridControl1.DataSource = DTResults + Else + GridControl1.DataSource = Nothing + GridView1.Columns.Clear() + End If End Sub End Class diff --git a/TestGUI/My Project/AssemblyInfo.vb b/TestGUI/My Project/AssemblyInfo.vb index 1cfcf7bf..fd6066e0 100644 --- a/TestGUI/My Project/AssemblyInfo.vb +++ b/TestGUI/My Project/AssemblyInfo.vb @@ -10,7 +10,7 @@ Imports System.Runtime.InteropServices - + diff --git a/TestGUI/My Project/Settings.Designer.vb b/TestGUI/My Project/Settings.Designer.vb index ffba3fba..cc921e74 100644 --- a/TestGUI/My Project/Settings.Designer.vb +++ b/TestGUI/My Project/Settings.Designer.vb @@ -1,10 +1,10 @@ '------------------------------------------------------------------------------ ' -' This code was generated by a tool. -' Runtime Version:4.0.30319.42000 +' Dieser Code wurde von einem Tool generiert. +' Laufzeitversion:4.0.30319.42000 ' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. +' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +' der Code erneut generiert wird. ' '------------------------------------------------------------------------------ @@ -13,57 +13,93 @@ Option Explicit On Namespace My - - _ + + _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) - -#Region "My.Settings Auto-Save Functionality" + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + +#Region "Automatische My.Settings-Speicherfunktion" #If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean + Private Shared addedHandler As Boolean - Private Shared addedHandlerLockObject As New Object + Private Shared addedHandlerLockObject As New Object - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub + _ + Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub #End If #End Region - + Public Shared ReadOnly Property [Default]() As MySettings Get - + #If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If #End If Return defaultInstance End Get End Property + + _ + Public Property WMFilepath() As String + Get + Return CType(Me("WMFilepath"),String) + End Get + Set + Me("WMFilepath") = value + End Set + End Property + + _ + Public Property WMIndexName() As String + Get + Return CType(Me("WMIndexName"),String) + End Get + Set + Me("WMIndexName") = value + End Set + End Property + + _ + Public Property WMSearch() As String + Get + Return CType(Me("WMSearch"),String) + End Get + Set + Me("WMSearch") = value + End Set + End Property End Class End Namespace Namespace My - - _ + + _ Friend Module MySettingsProperty - - _ + + _ Friend ReadOnly Property Settings() As Global.TestGUI.My.MySettings Get Return Global.TestGUI.My.MySettings.Default diff --git a/TestGUI/My Project/Settings.settings b/TestGUI/My Project/Settings.settings index 85b890b3..4fe97117 100644 --- a/TestGUI/My Project/Settings.settings +++ b/TestGUI/My Project/Settings.settings @@ -1,7 +1,15 @@  - - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TestGUI/My Project/licenses.licx b/TestGUI/My Project/licenses.licx new file mode 100644 index 00000000..824a99fc --- /dev/null +++ b/TestGUI/My Project/licenses.licx @@ -0,0 +1 @@ +DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/TestGUI/TestGUI.vbproj b/TestGUI/TestGUI.vbproj index d3ffebe7..002a5f1c 100644 --- a/TestGUI/TestGUI.vbproj +++ b/TestGUI/TestGUI.vbproj @@ -47,13 +47,29 @@ On + + + + + + + + ..\Modules.Windream\bin\Debug\Modules.Windream.dll + + ..\packages\NLog.4.5.8\lib\net45\NLog.dll + + + + + + @@ -102,6 +118,7 @@ Form1.vb + VbMyResourcesResXFileCodeGenerator Resources.Designer.vb @@ -120,6 +137,16 @@ Settings.Designer.vb + + + + + + + + {903b2d7d-3b80-4be9-8713-7447b704e1b0} + Modules.Logging + \ No newline at end of file diff --git a/TestGUI/packages.config b/TestGUI/packages.config new file mode 100644 index 00000000..a3ffb2eb --- /dev/null +++ b/TestGUI/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file