43 lines
1.7 KiB
VB.net
43 lines
1.7 KiB
VB.net
Public Class frmConfigService
|
|
Private _Service As ClassService
|
|
|
|
Private Sub frmServiceConfig_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
_Service = New ClassService(My.LogConfig)
|
|
|
|
If My.ConfigManager.Config.ServiceConnection <> String.Empty Then
|
|
txtIPAddress.Text = My.ConfigManager.Config.ServiceIP
|
|
txtPort.Text = My.ConfigManager.Config.ServicePort
|
|
End If
|
|
|
|
txtIPAddress.Focus()
|
|
End Sub
|
|
|
|
Private Async Sub btnTest_Click(sender As Object, e As EventArgs) Handles btnTest.Click
|
|
Dim oIPAddress = txtIPAddress.Text
|
|
Dim oPort = txtPort.Text
|
|
Dim oEndpointURL = $"net.tcp://{oIPAddress}:{oPort}/DigitalData/Services/Main"
|
|
Dim oResult As ClassService.ConnectionTestResult
|
|
|
|
My.Config.ServiceIP = oIPAddress
|
|
My.Config.ServicePort = Integer.Parse(oPort)
|
|
|
|
lblStatus.Text = "Verbindung wird hergestellt..."
|
|
oResult = Await _Service.TestConnectionAsync(My.ConfigManager.Config.ServiceConnection)
|
|
|
|
If oResult = ClassService.ConnectionTestResult.Successful Then
|
|
My.ConfigManager.Save()
|
|
lblStatus.Text = "Verbindung hergestellt."
|
|
Else
|
|
Select Case oResult
|
|
Case ClassService.ConnectionTestResult.NotFound
|
|
lblStatus.Text = "Dienst konnte nicht gefunden werden. Bitte überprüfen sie Addresse und Port."
|
|
Case Else
|
|
lblStatus.Text = "Unbekannter Fehler."
|
|
End Select
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
|
|
DialogResult = DialogResult.OK
|
|
End Sub
|
|
End Class |