MS TestGui und Logger Daily

This commit is contained in:
Digital Data - Marlon Schreiber 2018-08-16 10:18:43 +02:00
parent bb42fccdbd
commit 07c4203f72
11 changed files with 421 additions and 104 deletions

View File

@ -29,7 +29,7 @@ Public Class Logger
Private Const KEEP_FILES_OPEN As Boolean = False Private Const KEEP_FILES_OPEN As Boolean = False
Private Const MAX_ARCHIVE_FILES_DEFAULT As Integer = 30 Private Const MAX_ARCHIVE_FILES_DEFAULT As Integer = 30
Private Const MAX_ARCHIVE_FILES_DEBUG_DETAIL As Integer = 1 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_DEFAULT As String = "${shortdate}-${var:product}.log"
Private Const FILE_NAME_FORMAT_DETAIL As String = "${shortdate}-${var:product}-Detail.log" Private Const FILE_NAME_FORMAT_DETAIL As String = "${shortdate}-${var:product}-Detail.log"

View File

@ -10,15 +10,14 @@ Public Class Windream
Inherits Constants Inherits Constants
#Region "+++++ Variables +++++" #Region "+++++ Variables +++++"
Private Shared Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger Private Shared Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger
Public CurrentSession = Nothing
Public Shared CurrentSession As WMObject = Nothing Public CurrentSessionIsLoggedIn As Boolean = False
Public Shared CurrentSessionIsLoggedIn As Boolean = False Private CurrentObjecttypes As WINDREAMLib.WMObjects
Private Shared CurrentObjecttypes As WINDREAMLib.WMObjects Private CurrentController As WMOSearchController
Private Shared CurrentController As WMOSearchController
Private Shared CurrentWMConnect ' der Typ darf nicht festgelegt werden (warum auch immer... geht sonst nicht) Private Shared CurrentWMConnect ' der Typ darf nicht festgelegt werden (warum auch immer... geht sonst nicht)
Public Shared CurrentWMServer As String Public CurrentWMServer As String
Private Shared WMDriveLetter As String = "W" Private WMDriveLetter As String = "W"
Private Shared _Session_Reconnect As Boolean = False Private _Session_Reconnect As Boolean = False
#End Region #End Region
#Region "+++++ Init +++++" #Region "+++++ Init +++++"
''' <summary> ''' <summary>
@ -38,7 +37,7 @@ Public Class Windream
''' </summary> ''' </summary>
''' <returns>Returns true when created, false if not</returns> ''' <returns>Returns true when created, false if not</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Public Shared Function NewSession() Public Function NewSession()
Try Try
Dim wmbrwsr Dim wmbrwsr
wmbrwsr = CreateObject("WMOBrws.ServerBrowser") wmbrwsr = CreateObject("WMOBrws.ServerBrowser")
@ -50,6 +49,7 @@ Public Class Windream
Dim Connect Dim Connect
Try Try
Connect = CreateObject("Windream.WMConnect") Connect = CreateObject("Windream.WMConnect")
Logger.Info("...connected to windream!")
Catch ex As Exception Catch ex As Exception
CurrentSession = Nothing CurrentSession = Nothing
CurrentSessionIsLoggedIn = False CurrentSessionIsLoggedIn = False
@ -74,8 +74,11 @@ Public Class Windream
Try Try
Connect.LoginSession(CurrentSession) Connect.LoginSession(CurrentSession)
If CurrentSession.aLoggedin Then If CurrentSession.aLoggedin Then
CurrentWMConnect = Connect
CurrentSessionIsLoggedIn = True CurrentSessionIsLoggedIn = True
Logger.Info("UserSession has been created!")
Try Try
'Standardmässig hinterlegen dass abgelegte Dateien keine Indexmaske öffnet
CurrentSession.SwitchEvents(WMCOMEventWMSessionNeedIndex, False) CurrentSession.SwitchEvents(WMCOMEventWMSessionNeedIndex, False)
' der Parameter WMEntityDocument definiert, dass nur Dokumenttypen und keine ' der Parameter WMEntityDocument definiert, dass nur Dokumenttypen und keine
' Ordnertypen ausgelesen werden ' Ordnertypen ausgelesen werden
@ -116,7 +119,7 @@ Public Class Windream
End Function End Function
#End Region #End Region
#Region "+++++ New +++++" #Region "+++++ New +++++"
Public Shared Function NewFile() Public Function NewFile()
End Function End Function
''' <summary> ''' <summary>
@ -125,7 +128,7 @@ Public Class Windream
''' <param name="folderpath">full path of new folder</param> ''' <param name="folderpath">full path of new folder</param>
''' <returns>Returns true when folder was created, false if not</returns> ''' <returns>Returns true when folder was created, false if not</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Public Shared Function NewFolder(ByVal folderpath As String) Public Function NewFolder(ByVal folderpath As String)
Try Try
If folderpath.StartsWith("\") = False And folderpath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then If folderpath.StartsWith("\") = False And folderpath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
folderpath = folderpath.Substring(2) folderpath = folderpath.Substring(2)
@ -159,19 +162,14 @@ Public Class Windream
''' <param name="aValues">values as array</param> ''' <param name="aValues">values as array</param>
''' <returns>Returns true when folder was created, false if not</returns> ''' <returns>Returns true when folder was created, false if not</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Private Shared Function NewIndexFile(WMFile As String, ByVal indexname As String, ByVal aValues() As String) Public Function NewIndexFile(WMFile As String, ByVal indexname As String, ByVal aValues() As String) As Boolean
If TestSession() = False Then
If Not WMFile.StartsWith("\") And WMFile.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
WMFile = WMFile.Substring(2)
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)
Return False Return False
End Try End If
Dim oWMFile As WMObject = GetWMObjectForFile(WMFile)
If IsNothing(oWMFile) Then
Return False
End If
Dim vektInsState As Integer = 1 Dim vektInsState As Integer = 1
Try Try
If Not oWMFile.aLocked Then If Not oWMFile.aLocked Then
@ -287,7 +285,7 @@ Public Class Windream
Try Try
If oWMValueConverted.ToString Is Nothing = False Then If oWMValueConverted.ToString Is Nothing = False Then
Logger.Info("Now: oWMFile.SetVariableValue(" & indexname & ", " & oWMValueConverted & ")") Logger.Info("Now: oWMFile.SetVariableValue(" & indexname & ", " & oWMValueConverted & ")")
oWMFile.SetVariableValue(indexname, CInt(oWMValueConverted)) oWMFile.SetVariableValue(indexname, oWMValueConverted)
'Die Datei speichern 'Die Datei speichern
oWMFile.Save() oWMFile.Save()
Logger.Info("Index has been written!") Logger.Info("Index has been written!")
@ -339,7 +337,7 @@ Public Class Windream
Return False Return False
End Try End Try
End Function End Function
Private Shared Function NewLockWMFile(oWMFile As WMObject) As Boolean Private Function NewLockWMFile(oWMFile As WMObject) As Boolean
Try Try
oWMFile.lock() oWMFile.lock()
Return True Return True
@ -355,7 +353,7 @@ Public Class Windream
''' <param name="folderObjecttype">Obcjectype Name</param> ''' <param name="folderObjecttype">Obcjectype Name</param>
''' <returns>Returns true when Otype was set, false if not</returns> ''' <returns>Returns true when Otype was set, false if not</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Public Shared Function NewObjecttypeForFolder(folderpath As String, folderObjecttype As String) Public Function NewObjecttypeForFolder(folderpath As String, folderObjecttype As String)
Try Try
Dim result As Boolean = False Dim result As Boolean = False
Dim WMFolder As WINDREAMLib.WMObject Dim WMFolder As WINDREAMLib.WMObject
@ -415,7 +413,7 @@ Public Class Windream
''' <param name="Comment">Comment</param> ''' <param name="Comment">Comment</param>
''' <returns>Returns true when version was created, false if not</returns> ''' <returns>Returns true when version was created, false if not</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Public Shared Function NewVersion(ByVal WMPath As String, ByVal Comment As String) Public Function NewVersion(ByVal WMPath As String, ByVal Comment As String)
Try Try
If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
WMPath = WMPath.Substring(2) WMPath = WMPath.Substring(2)
@ -442,28 +440,29 @@ Public Class Windream
''' </summary> ''' </summary>
''' <returns>choicelists as String-Array</returns> ''' <returns>choicelists as String-Array</returns>
''' <remarks></remarks> ''' <remarks></remarks>
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 Try
Dim oChoiceLists As WMObjects Dim oChoiceLists As WMObjects
Dim oChoiceList As IWMObject2 Dim oChoiceList As IWMObject2
' den Objekttyp laden ' den Objekttyp laden
oChoiceLists = CurrentSession.GetAllObjects(WMEntityChoiceList) oChoiceLists = CurrentSession.GetAllObjects(WMEntityChoiceList)
'Array für Indizes vorbereiten 'Array für Indizes vorbereiten
Dim choiceLists As New List(Of String)
For j As Integer = 0 To oChoiceLists.Count() - 1 For j As Integer = 0 To oChoiceLists.Count() - 1
' aktuellee Liste ausleseb auslesen ' aktuellee Liste ausleseb auslesen
oChoiceList = oChoiceLists.Item(j) oChoiceList = oChoiceLists.Item(j)
dtresult.Rows.Add(oChoiceList.aName)
choiceLists.Add(oChoiceList.aName)
Next Next
dtresult.AcceptChanges()
Return choiceLists Return dtresult
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
Return Nothing Return dtresult
End Try End Try
End Function End Function
''' <summary> ''' <summary>
@ -472,7 +471,7 @@ Public Class Windream
''' <param name="ObjecttypeName">Name of objecttype</param> ''' <param name="ObjecttypeName">Name of objecttype</param>
''' <returns>Name of containing indices as String-Array</returns> ''' <returns>Name of containing indices as String-Array</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Public Shared Function GetIndicesByObjecttype(ByVal ObjecttypeName As String) As String() Public Function GetIndicesByObjecttype(ByVal ObjecttypeName As String) As String()
Try Try
Dim oObjectType As WMObject Dim oObjectType As WMObject
Dim oIndexAttributes As WMObjectRelation Dim oIndexAttributes As WMObjectRelation
@ -519,7 +518,9 @@ Public Class Windream
''' <param name="NameChoicelist">name of choicelist</param> ''' <param name="NameChoicelist">name of choicelist</param>
''' <returns>items as String-Array</returns> ''' <returns>items as String-Array</returns>
''' <remarks></remarks> ''' <remarks></remarks>
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 Try
'Dim oAttribute = Me.oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname) 'Dim oAttribute = Me.oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
'Dim vType = oAttribute.getVariableValue("vItems") 'Dim vType = oAttribute.getVariableValue("vItems")
@ -539,14 +540,16 @@ Public Class Windream
Dim zahl As Integer = 0 Dim zahl As Integer = 0
For Each CLItem In Values For Each CLItem In Values
If oChoiceList.aName IsNot Nothing Then If oChoiceList.aName IsNot Nothing Then
dtresult.Rows.Add(CLItem)
strListe(zahl) = CLItem strListe(zahl) = CLItem
zahl += 1 zahl += 1
End If End If
dtresult.AcceptChanges()
Next Next
Return strListe Return dtresult
Else Else
Logger.Warn("WMchoicelist: " & NameChoicelist & " not found!") Logger.Warn("WMchoicelist: " & NameChoicelist & " not found!")
Return Nothing Return dtresult
End If End If
Catch ex As Exception Catch ex As Exception
@ -559,16 +562,18 @@ Public Class Windream
''' </summary> ''' </summary>
''' <returns>array(String) of all objecttypes</returns> ''' <returns>array(String) of all objecttypes</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Public Function GetObjecttypesAsStrings() As String() Public Function GetObjecttypesAsStrings() As DataTable
Dim dtresult As New DataTable
dtresult.Columns.Add("RESULT", GetType(String))
Try Try
Dim objektTypenStr(CurrentObjecttypes.Count) As String
For i As Integer = 0 To CurrentObjecttypes.Count For i As Integer = 0 To CurrentObjecttypes.Count
objektTypenStr(i) = CurrentObjecttypes.Item(i).aName dtresult.Rows.Add(CurrentObjecttypes.Item(i).aName)
Next Next
Return objektTypenStr dtresult.AcceptChanges()
Return dtresult
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
Return Nothing Return dtresult
End Try End Try
End Function End Function
''' <summary> ''' <summary>
@ -578,7 +583,7 @@ Public Class Windream
''' <param name="NameIndexDocID">Name of the Docid Index </param> ''' <param name="NameIndexDocID">Name of the Docid Index </param>
''' <returns>Returns datatable</returns> ''' <returns>Returns datatable</returns>
''' <remarks></remarks> ''' <remarks></remarks>
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 Dim dt As New DataTable
dt.Columns.Add("DOC_ID", GetType(Integer)) dt.Columns.Add("DOC_ID", GetType(Integer))
dt.Columns.Add("PATH", GetType(String)) dt.Columns.Add("PATH", GetType(String))
@ -661,7 +666,7 @@ Public Class Windream
''' <param name="indexname">Name of indexfield</param> ''' <param name="indexname">Name of indexfield</param>
''' <returns>Returns integer, which describes the type</returns> ''' <returns>Returns integer, which describes the type</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Public Shared Function GetTypeOfIndexAsInt(ByVal indexname As String) As Integer Public Function GetTypeOfIndexAsInt(ByVal indexname As String) As Integer
Try Try
Dim oAttribute = CurrentSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname) Dim oAttribute = CurrentSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
Dim vType = oAttribute.getVariableValue("dwAttrType") Dim vType = oAttribute.getVariableValue("dwAttrType")
@ -677,10 +682,14 @@ Public Class Windream
''' <param name="NameIndex">Name of the index </param> ''' <param name="NameIndex">Name of the index </param>
''' <returns>Datatable</returns> ''' <returns>Datatable</returns>
''' <remarks></remarks> ''' <remarks></remarks>
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 Dim dt As New DataTable
dt.Columns.Add("RESULT", GetType(String)) dt.Columns.Add("RESULT", GetType(String))
If TestSession() = False Then
Return dt
End If
Try Try
If Not WMFile.StartsWith("\") And WMFile.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then If Not WMFile.StartsWith("\") And WMFile.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
WMFile = WMFile.Substring(2) WMFile = WMFile.Substring(2)
End If End If
@ -714,11 +723,11 @@ Public Class Windream
''' <summary> ''' <summary>
''' Returns the values for a vektorfield plus the new ones ''' Returns the values for a vektorfield plus the new ones
''' </summary> ''' </summary>
''' <param name="WMFile">filepath of windream-file</param> ''' <param name="oDocument">windream-file as Object</param>
''' <param name="NameIndex">Name of the index </param> ''' <param name="vktIndexName">Name of the index </param>
''' <returns>Returns value as Datatable</returns> ''' <returns>Returns value as Datatable</returns>
''' <remarks></remarks> ''' <remarks></remarks>
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 Try
Dim missing As Boolean = False Dim missing As Boolean = False
Dim valueCount As Integer = 0 Dim valueCount As Integer = 0
@ -791,7 +800,7 @@ Public Class Windream
''' <param name="WMPath">full path to the file</param> ''' <param name="WMPath">full path to the file</param>
''' <returns>Returns WMObject</returns> ''' <returns>Returns WMObject</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Public Shared Function GetWMObjectForFile(ByVal WMPath As String) As WMObject Public Function GetWMObjectForFile(ByVal WMPath As String) As WMObject
Try Try
If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
WMPath = WMPath.Substring(2) WMPath = WMPath.Substring(2)
@ -817,7 +826,7 @@ Public Class Windream
''' <param name="folderpath">The path of the folder</param> ''' <param name="folderpath">The path of the folder</param>
''' <returns>True if exists or false if not or error occured</returns> ''' <returns>True if exists or false if not or error occured</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Public Shared Function TestFolderExists(folderpath As String) Public Function TestFolderExists(folderpath As String)
Try Try
If folderpath.StartsWith("\") = False And folderpath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then If folderpath.StartsWith("\") = False And folderpath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
folderpath = folderpath.Substring(2) folderpath = folderpath.Substring(2)
@ -839,7 +848,7 @@ Public Class Windream
''' <param name="WMPath">full path to the file</param> ''' <param name="WMPath">full path to the file</param>
''' <returns>Returns true when file was deleted, false if not</returns> ''' <returns>Returns true when file was deleted, false if not</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Public Shared Function TestFileExists(ByVal WMPath As String) Public Function TestFileExists(ByVal WMPath As String)
Try Try
If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
WMPath = WMPath.Substring(2) WMPath = WMPath.Substring(2)
@ -856,6 +865,18 @@ Public Class Windream
Return False Return False
End Try End Try
End Function 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 #End Region
#Region "+++++ Remove +++++" #Region "+++++ Remove +++++"
''' <summary> ''' <summary>
@ -864,7 +885,7 @@ Public Class Windream
''' <param name="WMPath">full path to the file</param> ''' <param name="WMPath">full path to the file</param>
''' <returns>Returns true when file was deleted, false if not</returns> ''' <returns>Returns true when file was deleted, false if not</returns>
''' <remarks></remarks> ''' <remarks></remarks>
Public Shared Function RemFile(ByVal WMPath As String) Public Function RemFile(ByVal WMPath As String)
Try Try
If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
WMPath = WMPath.Substring(2) WMPath = WMPath.Substring(2)
@ -890,7 +911,7 @@ Public Class Windream
''' <param name="deleteValue">Value which is to be deleted</param> ''' <param name="deleteValue">Value which is to be deleted</param>
''' <returns>Returns true when indexing was successfull, false if not</returns> ''' <returns>Returns true when indexing was successfull, false if not</returns>
''' <remarks></remarks> ''' <remarks></remarks>
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 Try
Logger.Info("Removing Value '" & deleteValue & "' of Index '" & vktIndexName & "' " & WMPath) Logger.Info("Removing Value '" & deleteValue & "' of Index '" & vktIndexName & "' " & WMPath)
Dim oWMFile As WINDREAMLib.WMObject = GetWMObjectForFile(WMPath) Dim oWMFile As WINDREAMLib.WMObject = GetWMObjectForFile(WMPath)

View File

@ -1,6 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="TestGUI.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup> </startup>
<userSettings>
<TestGUI.My.MySettings>
<setting name="WMFilepath" serializeAs="String">
<value />
</setting>
<setting name="WMIndexName" serializeAs="String">
<value />
</setting>
<setting name="WMSearch" serializeAs="String">
<value />
</setting>
</TestGUI.My.MySettings>
</userSettings>
</configuration> </configuration>

View File

@ -23,40 +23,194 @@ Partial Class Form1
<System.Diagnostics.DebuggerStepThrough()> _ <System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent() Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button() 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.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() Me.SuspendLayout()
' '
'Button1 '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.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(267, 23) Me.Button1.Size = New System.Drawing.Size(267, 23)
Me.Button1.TabIndex = 0 Me.Button1.TabIndex = 0
Me.Button1.Text = "windream instanzieren" Me.Button1.Text = "windream instanzieren"
Me.Button1.UseVisualStyleBackColor = True 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 '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.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(267, 23) Me.Button2.Size = New System.Drawing.Size(75, 23)
Me.Button2.TabIndex = 1 Me.Button2.TabIndex = 13
Me.Button2.Text = "Logger initialisieren" Me.Button2.Text = "Button2"
Me.Button2.UseVisualStyleBackColor = True 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 'Form1
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(800, 450) Me.ClientSize = New System.Drawing.Size(800, 450)
Me.Controls.Add(Me.GridControl1)
Me.Controls.Add(Me.Button2) 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.Controls.Add(Me.Button1)
Me.Name = "Form1" Me.Name = "Form1"
Me.Text = "Form1" Me.Text = "Form1"
CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False) Me.ResumeLayout(False)
Me.PerformLayout()
End Sub End Sub
Friend WithEvents Button1 As Button 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 Button2 As Button
Friend WithEvents GridControl1 As DevExpress.XtraGrid.GridControl
Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView
End Class End Class

View File

@ -1,7 +1,55 @@
Imports Modules.Windream Imports Modules.Windream
Imports Modules.Logging
Public Class Form1 Public Class Form1
Dim MyLogger As Logger
Protected _windream As Windream
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 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
Dim WM As New Windream("W", True) 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
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 Sub
End Class End Class

View File

@ -10,7 +10,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyTitle("TestGUI")> <Assembly: AssemblyTitle("TestGUI")>
<Assembly: AssemblyDescription("")> <Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")> <Assembly: AssemblyCompany("DD JJMS")>
<Assembly: AssemblyProduct("TestGUI")> <Assembly: AssemblyProduct("TestGUI")>
<Assembly: AssemblyCopyright("Copyright © 2018")> <Assembly: AssemblyCopyright("Copyright © 2018")>
<Assembly: AssemblyTrademark("")> <Assembly: AssemblyTrademark("")>

View File

@ -1,10 +1,10 @@
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
' <auto-generated> ' <auto-generated>
' This code was generated by a tool. ' Dieser Code wurde von einem Tool generiert.
' Runtime Version:4.0.30319.42000 ' Laufzeitversion:4.0.30319.42000
' '
' Changes to this file may cause incorrect behavior and will be lost if ' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' the code is regenerated. ' der Code erneut generiert wird.
' </auto-generated> ' </auto-generated>
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
@ -15,21 +15,21 @@ Option Explicit On
Namespace My Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality" #Region "Automatische My.Settings-Speicherfunktion"
#If _MyType = "WindowsForms" Then #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
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then If My.Application.SaveMySettingsOnExit Then
My.Settings.Save() My.Settings.Save()
End If End If
@ -53,6 +53,42 @@ Namespace My
Return defaultInstance Return defaultInstance
End Get End Get
End Property End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property WMFilepath() As String
Get
Return CType(Me("WMFilepath"),String)
End Get
Set
Me("WMFilepath") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property WMIndexName() As String
Get
Return CType(Me("WMIndexName"),String)
End Get
Set
Me("WMIndexName") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property WMSearch() As String
Get
Return CType(Me("WMSearch"),String)
End Get
Set
Me("WMSearch") = value
End Set
End Property
End Class End Class
End Namespace End Namespace

View File

@ -1,7 +1,15 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true"> <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
<Profiles> <Profiles />
<Profile Name="(Default)" /> <Settings>
</Profiles> <Setting Name="WMFilepath" Type="System.String" Scope="User">
<Settings /> <Value Profile="(Default)" />
</Setting>
<Setting Name="WMIndexName" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="WMSearch" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile> </SettingsFile>

View File

@ -0,0 +1 @@
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@ -47,13 +47,29 @@
<OptionInfer>On</OptionInfer> <OptionInfer>On</OptionInfer>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="DevExpress.Data.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Printing.v18.1.Core, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Utils.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraGrid.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraLayout.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraPrinting.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Modules.Windream"> <Reference Include="Modules.Windream">
<HintPath>..\Modules.Windream\bin\Debug\Modules.Windream.dll</HintPath> <HintPath>..\Modules.Windream\bin\Debug\Modules.Windream.dll</HintPath>
</Reference> </Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.5.8\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Deployment" /> <Reference Include="System.Deployment" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -102,6 +118,7 @@
<EmbeddedResource Include="Form1.resx"> <EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.vb</DependentUpon> <DependentUpon>Form1.vb</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="My Project\licenses.licx" />
<EmbeddedResource Include="My Project\Resources.resx"> <EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator> <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput> <LastGenOutput>Resources.Designer.vb</LastGenOutput>
@ -120,6 +137,16 @@
<LastGenOutput>Settings.Designer.vb</LastGenOutput> <LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None> </None>
<None Include="App.config" /> <None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Modules.Logging\Modules.Logging.vbproj">
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
<Name>Modules.Logging</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project> </Project>

4
TestGUI/packages.config Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.5.8" targetFramework="net461" />
</packages>