jj: add service config form
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
<section name="EDMI_ClientSuite.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
<section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="EDMI_ClientSuite.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
@@ -73,4 +76,11 @@
|
||||
<remove invariant="FirebirdSql.Data.FirebirdClient" />
|
||||
<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".NET Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient" />
|
||||
</DbProviderFactories>
|
||||
</system.data></configuration>
|
||||
</system.data><userSettings>
|
||||
<EDMI_ClientSuite.My.MySettings>
|
||||
<setting name="ICMServiceAddress" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</EDMI_ClientSuite.My.MySettings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -61,6 +61,9 @@
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DevExpress.Dashboard.v18.1.Core, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||
<Reference Include="DevExpress.Data.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
@@ -225,6 +228,12 @@
|
||||
<Compile Include="frmMain.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="frmServiceConfig.Designer.vb">
|
||||
<DependentUpon>frmServiceConfig.vb</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="frmServiceConfig.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="frmSplash.designer.vb">
|
||||
<DependentUpon>frmSplash.vb</DependentUpon>
|
||||
</Compile>
|
||||
@@ -293,6 +302,9 @@
|
||||
<EmbeddedResource Include="frmMain.resx">
|
||||
<DependentUpon>frmMain.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="frmServiceConfig.resx">
|
||||
<DependentUpon>frmServiceConfig.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="frmSplash.resx">
|
||||
<DependentUpon>frmSplash.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -350,6 +362,7 @@
|
||||
<None Include="Connected Services\NetworkService_DDEDM\System.Data.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="My Project\app.manifest" />
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
|
||||
@@ -34,10 +34,5 @@ Namespace My
|
||||
Protected Overrides Sub OnCreateMainForm()
|
||||
Me.MainForm = Global.EDMI_ClientSuite.frmMain
|
||||
End Sub
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Protected Overrides Sub OnCreateSplashScreen()
|
||||
Me.SplashScreen = Global.EDMI_ClientSuite.frmSplash
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
@@ -6,6 +6,5 @@
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<SplashScreen>frmSplash</SplashScreen>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
12
EDMI_ClientSuite/My Project/Settings.Designer.vb
generated
12
EDMI_ClientSuite/My Project/Settings.Designer.vb
generated
@@ -62,6 +62,18 @@ Namespace My
|
||||
Return CType(Me("EDM_NetworkService_Adress"),String)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.UserScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||
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
|
||||
|
||||
|
||||
@@ -5,5 +5,8 @@
|
||||
<Setting Name="EDM_NetworkService_Adress" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">net.tcp://172.24.12.67:9000/DigitalData/Services/Main</Value>
|
||||
</Setting>
|
||||
<Setting Name="ICMServiceAddress" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
76
EDMI_ClientSuite/My Project/app.manifest
Normal file
76
EDMI_ClientSuite/My Project/app.manifest
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC-Manifestoptionen
|
||||
Wenn Sie die Ebene der Benutzerkontensteuerung für Windows ändern möchten, ersetzen Sie den
|
||||
Knoten "requestedExecutionLevel" wie folgt.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Durch Angabe des Elements "requestedExecutionLevel" wird die Datei- und Registrierungsvirtualisierung deaktiviert.
|
||||
Entfernen Sie dieses Element, wenn diese Virtualisierung aus Gründen der Abwärtskompatibilität
|
||||
für die Anwendung erforderlich ist.
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Eine Liste der Windows-Versionen, unter denen diese Anwendung getestet
|
||||
und für die sie entwickelt wurde. Wenn Sie die Auskommentierung der entsprechenden Elemente aufheben,
|
||||
wird von Windows automatisch die kompatibelste Umgebung ausgewählt. -->
|
||||
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- Gibt an, dass die Anwendung mit DPI-Werten kompatibel ist und von Windows nicht automatisch auf höhere
|
||||
DPI-Werte skaliert wird. WPF-Anwendungen (Windows Presentation Foundation) sind automatisch mit DPI-Werten kompatibel und müssen sich nicht
|
||||
anmelden. Für Windows Forms-Anwendungen für .NET Framework 4.6, die sich für diese Einstellung anmelden, muss
|
||||
auch die Einstellung "'EnableWindowsFormsHighDpiAutoResizing" in der "app.config" auf "true" festgelegt werden. -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
|
||||
<!-- Designs für allgemeine Windows-Steuerelemente und -Dialogfelder (Windows XP und höher) aktivieren -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
</assembly>
|
||||
@@ -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
|
||||
|
||||
146
EDMI_ClientSuite/frmServiceConfig.Designer.vb
generated
Normal file
146
EDMI_ClientSuite/frmServiceConfig.Designer.vb
generated
Normal file
@@ -0,0 +1,146 @@
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||
Partial Class frmServiceConfig
|
||||
Inherits DevExpress.XtraEditors.XtraForm
|
||||
|
||||
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
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.
|
||||
<System.Diagnostics.DebuggerStepThrough()> _
|
||||
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
|
||||
120
EDMI_ClientSuite/frmServiceConfig.resx
Normal file
120
EDMI_ClientSuite/frmServiceConfig.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
37
EDMI_ClientSuite/frmServiceConfig.vb
Normal file
37
EDMI_ClientSuite/frmServiceConfig.vb
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user