diff --git a/EDMI_ClientSuite/App.config b/EDMI_ClientSuite/App.config
index 9720616f..cf3cc8b8 100644
--- a/EDMI_ClientSuite/App.config
+++ b/EDMI_ClientSuite/App.config
@@ -5,6 +5,9 @@
+
+
+
@@ -73,4 +76,11 @@
-
\ No newline at end of file
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EDMI_ClientSuite/ApplicationEvents.vb b/EDMI_ClientSuite/ApplicationEvents.vb
index bc254e28..6740854b 100644
--- a/EDMI_ClientSuite/ApplicationEvents.vb
+++ b/EDMI_ClientSuite/ApplicationEvents.vb
@@ -6,5 +6,8 @@
' StartupNextInstance: Wird beim Starten einer Einzelinstanzanwendung ausgelöst, wenn die Anwendung bereits aktiv ist.
' NetworkAvailabilityChanged: Wird beim Herstellen oder Trennen der Netzwerkverbindung ausgelöst.
Partial Friend Class MyApplication
+ Public Sub App_Shutdown(sender As Object, e As EventArgs) Handles Me.Shutdown
+
+ End Sub
End Class
End Namespace
diff --git a/EDMI_ClientSuite/ClassInit.vb b/EDMI_ClientSuite/ClassInit.vb
index c2346e4a..84f1c36b 100644
--- a/EDMI_ClientSuite/ClassInit.vb
+++ b/EDMI_ClientSuite/ClassInit.vb
@@ -4,24 +4,66 @@ Imports System.ServiceModel
Imports EDMI_ClientSuite.NetworkService_DDEDM
Public Class ClassInit
- Private Const OPEN_TIMEOUT = 10
+ Private Const OPEN_TIMEOUT_SECONDS = 3
Private Const MAX_MESSAGE_SIZE = 2147483647
Private Const MAX_BUFFER_SIZE = 2147483647
Private Const MAX_ARRAY_LENGTH = 2147483647
Private Const MAX_STRING_LENGTH = 2147483647
Private Const MAX_CONNECTIONS = 10000
- Public Property _LogConfig As LogConfig
+ Public Enum ConnectionTestResult
+ Successful
+ NotFound
+ Unknown
+ End Enum
+
+ Private ReadOnly _Logger As Logger
Public Sub New()
- _LogConfig = New LogConfig(PathType.AppData)
+ _Logger = My.LogConfig.GetLogger()
End Sub
- Public Function CreateService() As ChannelFactory(Of IEDMServiceChannel)
- Return CreateChannelFactory()
+ Public Function TestConnectionURLExists()
+ Return My.Settings.ICMServiceAddress <> String.Empty
End Function
- Private Function CreateChannelFactory() As ChannelFactory(Of IEDMServiceChannel)
+ Public Async Function TestConnectionAsync(EndpointURL As String) As Task(Of ConnectionTestResult)
+ Return Await Task.Factory.StartNew(Function()
+ Try
+ Dim oChannelFactory = GetChannelFactory(EndpointURL)
+ Dim oChannel = oChannelFactory.CreateChannel()
+ oChannel.OperationTimeout = New TimeSpan(0, 0, OPEN_TIMEOUT_SECONDS)
+ oChannel.Open()
+ oChannel.Close()
+
+ Return ConnectionTestResult.Successful
+ Catch ex As EndpointNotFoundException
+ Return ConnectionTestResult.NotFound
+ Catch ex As Exception
+ Return ConnectionTestResult.Unknown
+ End Try
+ End Function)
+ End Function
+
+ Public Function GetChannelFactory() As ChannelFactory(Of IEDMServiceChannel)
+ Return GetChannelFactory(My.Settings.ICMServiceAddress)
+ End Function
+
+ Public Function GetChannelFactory(EndpointURL As String) As ChannelFactory(Of IEDMServiceChannel)
+ Dim oBinding = GetBinding()
+ Dim oEndpoint = GetEndpoint(EndpointURL)
+
+ Dim oFactory As New ChannelFactory(Of IEDMServiceChannel)(oBinding, oEndpoint)
+ Return oFactory
+ End Function
+
+ Private Function GetEndpoint(EndpointURL As String) As EndpointAddress
+ Dim oEndpoint = New EndpointAddress(EndpointURL)
+
+ Return oEndpoint
+ End Function
+
+ Private Function GetBinding() As NetTcpBinding
Dim oBinding As New NetTcpBinding()
oBinding.Security.Mode = SecurityMode.Transport
oBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows
@@ -31,10 +73,9 @@ Public Class ClassInit
oBinding.MaxConnections = MAX_CONNECTIONS
oBinding.ReaderQuotas.MaxArrayLength = MAX_ARRAY_LENGTH
oBinding.ReaderQuotas.MaxStringContentLength = MAX_STRING_LENGTH
- oBinding.OpenTimeout = New TimeSpan(0, 0, OPEN_TIMEOUT)
- Dim oEndpointAddress = New EndpointAddress(My.Settings.EDM_NetworkService_Adress)
+ oBinding.OpenTimeout = New TimeSpan(0, 0, OPEN_TIMEOUT_SECONDS)
- Return New ChannelFactory(Of IEDMServiceChannel)(oBinding, oEndpointAddress)
+ Return oBinding
End Function
End Class
diff --git a/EDMI_ClientSuite/EDMI_ClientSuite.vbproj b/EDMI_ClientSuite/EDMI_ClientSuite.vbproj
index 573239e6..e4571d7a 100644
--- a/EDMI_ClientSuite/EDMI_ClientSuite.vbproj
+++ b/EDMI_ClientSuite/EDMI_ClientSuite.vbproj
@@ -61,6 +61,9 @@
On
+
+ My Project\app.manifest
+
@@ -225,6 +228,12 @@
Form
+
+ frmServiceConfig.vb
+
+
+ Form
+
frmSplash.vb
@@ -293,6 +302,9 @@
frmMain.vb
+
+ frmServiceConfig.vb
+
frmSplash.vb
@@ -350,6 +362,7 @@
Designer
+
MyApplicationCodeGenerator
Application.Designer.vb
diff --git a/EDMI_ClientSuite/My Project/Application.Designer.vb b/EDMI_ClientSuite/My Project/Application.Designer.vb
index 4d9b26d7..55d6a2a9 100644
--- a/EDMI_ClientSuite/My Project/Application.Designer.vb
+++ b/EDMI_ClientSuite/My Project/Application.Designer.vb
@@ -34,10 +34,5 @@ Namespace My
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.EDMI_ClientSuite.frmMain
End Sub
-
- _
- Protected Overrides Sub OnCreateSplashScreen()
- Me.SplashScreen = Global.EDMI_ClientSuite.frmSplash
- End Sub
End Class
End Namespace
diff --git a/EDMI_ClientSuite/My Project/Application.myapp b/EDMI_ClientSuite/My Project/Application.myapp
index b84db44c..5eb49b3b 100644
--- a/EDMI_ClientSuite/My Project/Application.myapp
+++ b/EDMI_ClientSuite/My Project/Application.myapp
@@ -6,6 +6,5 @@
0
true
0
- frmSplash
true
\ No newline at end of file
diff --git a/EDMI_ClientSuite/My Project/Settings.Designer.vb b/EDMI_ClientSuite/My Project/Settings.Designer.vb
index 6ec95a4e..4c923afa 100644
--- a/EDMI_ClientSuite/My Project/Settings.Designer.vb
+++ b/EDMI_ClientSuite/My Project/Settings.Designer.vb
@@ -62,6 +62,18 @@ Namespace My
Return CType(Me("EDM_NetworkService_Adress"),String)
End Get
End Property
+
+ _
+ Public Property ICMServiceAddress() As String
+ Get
+ Return CType(Me("ICMServiceAddress"),String)
+ End Get
+ Set
+ Me("ICMServiceAddress") = value
+ End Set
+ End Property
End Class
End Namespace
diff --git a/EDMI_ClientSuite/My Project/Settings.settings b/EDMI_ClientSuite/My Project/Settings.settings
index c95acafd..feab57fd 100644
--- a/EDMI_ClientSuite/My Project/Settings.settings
+++ b/EDMI_ClientSuite/My Project/Settings.settings
@@ -5,5 +5,8 @@
net.tcp://172.24.12.67:9000/DigitalData/Services/Main
+
+
+
\ No newline at end of file
diff --git a/EDMI_ClientSuite/My Project/app.manifest b/EDMI_ClientSuite/My Project/app.manifest
new file mode 100644
index 00000000..ef881eb8
--- /dev/null
+++ b/EDMI_ClientSuite/My Project/app.manifest
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EDMI_ClientSuite/frmMain.vb b/EDMI_ClientSuite/frmMain.vb
index 317ad4ae..f83dfda3 100644
--- a/EDMI_ClientSuite/frmMain.vb
+++ b/EDMI_ClientSuite/frmMain.vb
@@ -4,8 +4,29 @@ Imports DevExpress.XtraBars.Docking2010.Views.Widget
Imports System.ComponentModel
Imports EDMI_ClientSuite.ClassLayout
Imports System.IO
+Imports DigitalData.Modules.Logging
+Imports DigitalData.Modules.Logging.LogConfig
Public Class frmMain
+ Private _Logger As Logger
+
+ Public Sub New()
+ ' Dieser Aufruf ist für den Designer erforderlich.
+ InitializeComponent()
+
+ ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
+
+ ' Initialize Logger
+ Dim oLogConfig As New LogConfig(PathType.AppData)
+ _Logger = oLogConfig.GetLogger()
+
+ ' This sets the LogConfig object that is used in the WHOLE application!!
+ My.LogConfig = oLogConfig
+
+ ' Show splashscreen
+ frmSplash.ShowDialog()
+ End Sub
+
Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
LabelCurrentUser.Caption = Environment.UserName
LabelCurrentMachine.Caption = Environment.MachineName
diff --git a/EDMI_ClientSuite/frmServiceConfig.Designer.vb b/EDMI_ClientSuite/frmServiceConfig.Designer.vb
new file mode 100644
index 00000000..307237ce
--- /dev/null
+++ b/EDMI_ClientSuite/frmServiceConfig.Designer.vb
@@ -0,0 +1,146 @@
+ _
+Partial Class frmServiceConfig
+ Inherits DevExpress.XtraEditors.XtraForm
+
+ 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
+ _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Wird vom Windows Form-Designer benötigt.
+ Private components As System.ComponentModel.IContainer
+
+ 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
+ 'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
+ 'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
+ _
+ Private Sub InitializeComponent()
+ Me.txtIPAddress = New System.Windows.Forms.TextBox()
+ Me.btnCancel = New System.Windows.Forms.Button()
+ Me.btnTest = New System.Windows.Forms.Button()
+ Me.txtPort = New System.Windows.Forms.TextBox()
+ Me.Label1 = New System.Windows.Forms.Label()
+ Me.Label2 = New System.Windows.Forms.Label()
+ Me.Label3 = New System.Windows.Forms.Label()
+ Me.lblStatus = New System.Windows.Forms.Label()
+ Me.lblURL = New System.Windows.Forms.TextBox()
+ Me.SuspendLayout()
+ '
+ 'txtIPAddress
+ '
+ Me.txtIPAddress.Location = New System.Drawing.Point(12, 32)
+ Me.txtIPAddress.Name = "txtIPAddress"
+ Me.txtIPAddress.Size = New System.Drawing.Size(250, 21)
+ Me.txtIPAddress.TabIndex = 0
+ '
+ 'btnCancel
+ '
+ Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
+ Me.btnCancel.Location = New System.Drawing.Point(338, 124)
+ Me.btnCancel.Name = "btnCancel"
+ Me.btnCancel.Size = New System.Drawing.Size(75, 23)
+ Me.btnCancel.TabIndex = 1
+ Me.btnCancel.Text = "Cancel"
+ Me.btnCancel.UseVisualStyleBackColor = True
+ '
+ 'btnTest
+ '
+ Me.btnTest.Location = New System.Drawing.Point(223, 124)
+ Me.btnTest.Name = "btnTest"
+ Me.btnTest.Size = New System.Drawing.Size(109, 23)
+ Me.btnTest.TabIndex = 2
+ Me.btnTest.Text = "Verbindungstest"
+ Me.btnTest.UseVisualStyleBackColor = True
+ '
+ 'txtPort
+ '
+ Me.txtPort.Location = New System.Drawing.Point(268, 32)
+ Me.txtPort.Name = "txtPort"
+ Me.txtPort.Size = New System.Drawing.Size(145, 21)
+ Me.txtPort.TabIndex = 0
+ Me.txtPort.Text = "9000"
+ '
+ 'Label1
+ '
+ Me.Label1.AutoSize = True
+ Me.Label1.Location = New System.Drawing.Point(12, 16)
+ Me.Label1.Name = "Label1"
+ Me.Label1.Size = New System.Drawing.Size(64, 13)
+ Me.Label1.TabIndex = 3
+ Me.Label1.Text = "IP-Adresse:"
+ '
+ 'Label2
+ '
+ Me.Label2.AutoSize = True
+ Me.Label2.Location = New System.Drawing.Point(265, 16)
+ Me.Label2.Name = "Label2"
+ Me.Label2.Size = New System.Drawing.Size(31, 13)
+ Me.Label2.TabIndex = 3
+ Me.Label2.Text = "Port:"
+ '
+ 'Label3
+ '
+ Me.Label3.AutoSize = True
+ Me.Label3.Location = New System.Drawing.Point(9, 83)
+ Me.Label3.Name = "Label3"
+ Me.Label3.Size = New System.Drawing.Size(42, 13)
+ Me.Label3.TabIndex = 4
+ Me.Label3.Text = "Status:"
+ '
+ 'lblStatus
+ '
+ Me.lblStatus.AutoSize = True
+ Me.lblStatus.Location = New System.Drawing.Point(9, 96)
+ Me.lblStatus.Name = "lblStatus"
+ Me.lblStatus.Size = New System.Drawing.Size(86, 13)
+ Me.lblStatus.TabIndex = 4
+ Me.lblStatus.Text = "Nicht verbunden"
+ '
+ 'lblURL
+ '
+ Me.lblURL.Location = New System.Drawing.Point(12, 59)
+ Me.lblURL.Name = "lblURL"
+ Me.lblURL.ReadOnly = True
+ Me.lblURL.Size = New System.Drawing.Size(401, 21)
+ Me.lblURL.TabIndex = 0
+ '
+ 'frmServiceConfig
+ '
+ Me.AcceptButton = Me.btnTest
+ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.CancelButton = Me.btnCancel
+ Me.ClientSize = New System.Drawing.Size(425, 159)
+ Me.Controls.Add(Me.lblStatus)
+ Me.Controls.Add(Me.Label3)
+ Me.Controls.Add(Me.Label2)
+ Me.Controls.Add(Me.Label1)
+ Me.Controls.Add(Me.btnTest)
+ Me.Controls.Add(Me.btnCancel)
+ Me.Controls.Add(Me.txtPort)
+ Me.Controls.Add(Me.lblURL)
+ Me.Controls.Add(Me.txtIPAddress)
+ Me.Name = "frmServiceConfig"
+ Me.Text = "Dienst Kommunikation konfigurieren"
+ Me.ResumeLayout(False)
+ Me.PerformLayout()
+
+ End Sub
+
+ Friend WithEvents txtIPAddress As TextBox
+ Friend WithEvents btnCancel As Button
+ Friend WithEvents btnTest As Button
+ Friend WithEvents txtPort As TextBox
+ Friend WithEvents Label1 As Label
+ Friend WithEvents Label2 As Label
+ Friend WithEvents Label3 As Label
+ Friend WithEvents lblStatus As Label
+ Friend WithEvents lblURL As TextBox
+End Class
diff --git a/EDMI_ClientSuite/frmServiceConfig.resx b/EDMI_ClientSuite/frmServiceConfig.resx
new file mode 100644
index 00000000..1af7de15
--- /dev/null
+++ b/EDMI_ClientSuite/frmServiceConfig.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/EDMI_ClientSuite/frmServiceConfig.vb b/EDMI_ClientSuite/frmServiceConfig.vb
new file mode 100644
index 00000000..45161233
--- /dev/null
+++ b/EDMI_ClientSuite/frmServiceConfig.vb
@@ -0,0 +1,37 @@
+Imports EDMI_ClientSuite.ClassInit
+
+Public Class frmServiceConfig
+ Private _Init As ClassInit
+
+ Private Sub frmServiceConfig_Load(sender As Object, e As EventArgs) Handles Me.Load
+ _Init = New ClassInit()
+
+ If _Init.TestConnectionURLExists() Then
+ lblURL.Text = My.Settings.ICMServiceAddress
+ End If
+ 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 ConnectionTestResult
+
+ lblStatus.Text = "Verbindung wird hergestellt..."
+ oResult = Await _Init.TestConnectionAsync(oEndpointURL)
+
+ If oResult = ConnectionTestResult.Successful Then
+ My.Settings.ICMServiceAddress = oEndpointURL
+ lblURL.Text = oEndpointURL
+ 'My.Settings.Save()
+ lblStatus.Text = "Verbindung hergestellt."
+ Else
+ Select Case oResult
+ Case 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
+End Class
\ No newline at end of file
diff --git a/EDMI_ClientSuite/frmSplash.vb b/EDMI_ClientSuite/frmSplash.vb
index 496e0f6f..0ccd18b7 100644
--- a/EDMI_ClientSuite/frmSplash.vb
+++ b/EDMI_ClientSuite/frmSplash.vb
@@ -1,5 +1,6 @@
Imports System.ComponentModel
Imports System.ServiceModel
+Imports System.Threading
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Logging.LogConfig
Imports EDMI_ClientSuite.NetworkService_DDEDM
@@ -13,7 +14,7 @@ Public NotInheritable Class frmSplash
Private _CurrentRetry As Integer = 0
Private Const SLEEP_TIME = 600
- Private Const INIT_STEPS = 1
+ Private Const INIT_STEPS = 2
Private Const MAX_RETRIES = 10
Private Const OPEN_TIMEOUT = 10
@@ -23,13 +24,29 @@ Public NotInheritable Class frmSplash
lblVersion.Text = String.Format("Version {0}", My.Application.Info.Version.ToString)
BringToFront()
- StartWorker()
+
+ Dim oInit As New ClassInit()
+ Dim oConnectionURLExists = oInit.TestConnectionURLExists
+
+ If Not oConnectionURLExists Then
+ Dim oResult = frmServiceConfig.ShowDialog()
+
+ If oResult = DialogResult.Cancel Then
+ MsgBox("Es wurde keine Dienst Verbindungsurl hinterlegt. Die Anwendung wird beendet.")
+ Application.Exit()
+ Else
+ StartWorker()
+ End If
+ Else
+ StartWorker()
+ End If
End Sub
Private Function SetProgress(_step As Integer)
Return _step * (100 / INIT_STEPS)
End Function
+#Region "Worker"
Private Sub StartWorker()
AddHandler _Worker.DoWork, AddressOf bw_DoWork
AddHandler _Worker.ProgressChanged, AddressOf bw_ProgressChanged
@@ -39,33 +56,21 @@ Public NotInheritable Class frmSplash
_Worker.RunWorkerAsync()
End Sub
-#Region "Worker"
Private Sub bw_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs)
- Dim oInit As ClassInit
-
- Try
- oInit = New ClassInit()
- My.LogConfig = oInit._LogConfig
- _Logger = My.LogConfig.GetLogger()
- Catch ex As Exception
- Throw New Exception($"Error while initializing Logger: {ex.Message}", ex)
- End Try
+ Dim oInit As New ClassInit()
'------------------
_Worker.ReportProgress(SetProgress(1), "Connecting to service..")
- Try
- My.ChannelFactory = oInit.CreateService()
- My.Channel = My.ChannelFactory.CreateChannel()
- AddHandler My.Channel.Faulted, Sub()
- _Logger.Error("Could not connect to service")
- Throw New Exception("Could not connect to service")
- End Sub
- My.Channel.Open()
- Catch ex As Exception
- Throw New Exception($"Error while connectiong to service: {ex.Message}", ex)
- End Try
- System.Threading.Thread.Sleep(SLEEP_TIME)
+ Dim oChannelFactory As ChannelFactory(Of IEDMServiceChannel)
+ Dim oChannel As IEDMServiceChannel
+ Dim oConnectionSuccessful = False
+
+
+ oChannelFactory = oInit.GetChannelFactory()
+ oChannel = oChannelFactory.CreateChannel()
+
+ Thread.Sleep(SLEEP_TIME)
' TODO: Initialize Usersettings and populate My.Application.User
End Sub