Modules/TestGUI/Form1.vb
2018-08-21 16:52:37 +02:00

90 lines
2.9 KiB
VB.net

Imports DigitalData.Modules.Windream
Imports DigitalData.Modules.Logging
Public Class Form1
Dim MyLogger As LogConfig
Protected _windream As Windream
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
_windream = New Windream("W", True)
If _windream.LoggedInSession = 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 LogConfig(LogConfig.PathType.AppData,)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles GetValue.Click
My.Settings.Save()
If IsNothing(_windream) Then
MsgBox("windream initialisieren")
Exit Sub
End If
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()
If IsNothing(_windream) Then
MsgBox("windream initialisieren")
Exit Sub
End If
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()
If IsNothing(_windream) Then
MsgBox("windream initialisieren")
Exit Sub
End If
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
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Dim items As New List(Of String)
items = _windream.GetChoicelistItems(ComboBox1.Text)
MsgBox("choicelist items:" & vbNewLine & (String.Join(vbNewLine, items.ToArray)))
End Sub
Private Sub ComboBox1_Click(sender As Object, e As EventArgs) Handles ComboBox1.Click
Dim lists = _windream.GetChoiceLists()
ComboBox1.Items.Clear()
For Each list As String In lists
ComboBox1.Items.Add(list)
Next
ComboBox1.DroppedDown = True
End Sub
End Class