144 lines
4.8 KiB
VB.net
144 lines
4.8 KiB
VB.net
Imports DigitalData.Modules.Windream
|
|
Imports DigitalData.Modules.Logging
|
|
Imports System.ComponentModel
|
|
|
|
Public Class Form1
|
|
Dim MyLogger As LogConfig
|
|
Shared Logger As NLog.Logger
|
|
|
|
Protected _windream As Windream
|
|
Protected _windream2 As Windream2
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
Dim serverName As String = TextBox1.Text
|
|
|
|
' Windream.vb
|
|
'_windream = New Windream("W", True, False)
|
|
|
|
' Windream2.vb
|
|
Try
|
|
_windream2 = New ConnectionBuilder(MyLogger.LogFactory).
|
|
WithDriveLetter("W").
|
|
WithSessionReconnect().
|
|
With64BitSupport().
|
|
WithServerName("sdd-vmx02-aps01").
|
|
Connect()
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
MsgBox("Login failed!")
|
|
Exit Sub
|
|
End Try
|
|
|
|
If _windream2.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.CurrentDirectory, Nothing, "MAIN")
|
|
Logger = MyLogger.LogFactory.GetCurrentClassLogger()
|
|
|
|
Dim MySecondLogger = New LogConfig(LogConfig.PathType.CurrentDirectory, Nothing, "MAIN2")
|
|
Dim SecondLogger = MySecondLogger.LogFactory.GetCurrentClassLogger()
|
|
|
|
Logger.Warn("WANRING!!!")
|
|
Logger.Info("INFO!!!")
|
|
Logger.Debug("DEBUG!!!")
|
|
|
|
SecondLogger.Warn("WANRING!!!")
|
|
SecondLogger.Info("INFO!!!")
|
|
SecondLogger.Debug("DEBUG!!!")
|
|
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
|
|
|
|
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
|
|
Dim bw1 As New BackgroundWorker
|
|
Dim bw2 As New BackgroundWorker
|
|
|
|
AddHandler bw1.DoWork, Sub()
|
|
Dim config1 As New LogConfig(LogConfig.PathType.CurrentDirectory, Nothing, "TEST1")
|
|
Dim logger As NLog.Logger = config1.LogFactory.GetCurrentClassLogger()
|
|
|
|
logger.Warn("WANRING!!!")
|
|
logger.Info("INFO!!!")
|
|
logger.Debug("DEBUG!!!")
|
|
|
|
Console.WriteLine("This is logger 1 calling!")
|
|
Console.WriteLine(config1.LogFile)
|
|
End Sub
|
|
|
|
|
|
bw1.RunWorkerAsync()
|
|
End Sub
|
|
End Class
|