config in client suite

This commit is contained in:
Jonathan Jenne
2019-02-13 16:23:02 +01:00
parent 9ee59ac400
commit 914ba9dc90
11 changed files with 64 additions and 103 deletions

View File

@@ -1,4 +1,5 @@
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Logging.LogConfig
Namespace My
@@ -13,7 +14,10 @@ Namespace My
Public Sub App_Startup() Handles Me.Startup
Dim oLogConfig As New LogConfig(PathType.AppData)
Dim oConfigManager As New ConfigManager(Of ClassConfig)(oLogConfig, Windows.Forms.Application.UserAppDataPath, Windows.Forms.Application.CommonAppDataPath)
LogConfig = oLogConfig
ConfigManager = oConfigManager
_Logger = LogConfig.GetLogger()
_Logger.Info("Starting Client Suite..")

View File

@@ -0,0 +1,3 @@
Public Class ClassConfig
Public Property ServiceConnection As String = String.Empty
End Class

View File

@@ -1,5 +1,5 @@
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Logging.LogConfig
Imports DigitalData.Modules.Config
Imports System.ServiceModel
Imports EDMI_ClientSuite.NetworkService_DDEDM
Imports System.ServiceModel.Channels
@@ -19,8 +19,9 @@ Public Class ClassInit
_Logger = My.LogConfig.GetLogger()
End Sub
Public Function TestConnectionURLExists()
Return My.Settings.ICMServiceAddress <> String.Empty
Public Function TestConnectionURLExists() As Boolean
Return My.ConfigManager.Config.ServiceConnection <> String.Empty
'Return My.Settings.ICMServiceAddress <> String.Empty
End Function
Public Async Function TestConnectionAsync(EndpointURL As String) As Task(Of ConnectionTestResult)
@@ -44,7 +45,8 @@ Public Class ClassInit
End Function
Public Function GetChannelFactory() As IChannelFactory(Of IEDMServiceChannel)
Return GetChannelFactory(My.Settings.ICMServiceAddress)
'Return GetChannelFactory(My.Settings.ICMServiceAddress)
Return GetChannelFactory(My.ConfigManager.Config.ServiceConnection)
End Function
Public Function GetChannelFactory(EndpointURL As String) As ChannelFactory(Of IEDMServiceChannel)

View File

@@ -115,6 +115,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ApplicationEvents.vb" />
<Compile Include="ClassConfig.vb" />
<Compile Include="ClassConstants.vb" />
<Compile Include="ClassInit.vb" />
<Compile Include="ClassLayout.vb" />
@@ -368,6 +369,10 @@
<None Include="Resources\folder_go.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Config\Config.vbproj">
<Project>{44982F9B-6116-44E2-85D0-F39650B1EF99}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\EDMI_FILE_OPs\EDMIFileOps.vbproj">
<Project>{5b1171dc-fffe-4813-a20d-786aae47b320}</Project>
<Name>EDMIFileOps</Name>

View File

@@ -1,5 +1,6 @@
Imports System.ServiceModel
Imports System.Threading
Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Logging
Imports EDMI_ClientSuite.NetworkService_DDEDM
@@ -10,6 +11,7 @@ Namespace My
''' </summary>
<HideModuleName()>
Module Extension
Property ConfigManager As ConfigManager(Of ClassConfig)
Property LogConfig As LogConfig
Property ChannelFactory As ChannelFactory(Of IEDMServiceChannel)
Property Channel As IEDMServiceChannel

View File

@@ -20,7 +20,9 @@ Public Class frmConfigService
If oResult = ConnectionTestResult.Successful Then
' Save Endpoint URL
My.Settings.ICMServiceAddress = oEndpointURL
My.ConfigManager.Config.ServiceConnection = oEndpointURL
My.ConfigManager.Save()
'My.Settings.ICMServiceAddress = oEndpointURL
lblStatus.Text = "Verbindung hergestellt."
Else
Select Case oResult

View File

@@ -26,7 +26,7 @@ Public NotInheritable Class frmSplash
BringToFront()
Dim oInit As New ClassInit()
Dim oConnectionURLExists = oInit.TestConnectionURLExists
Dim oConnectionURLExists = oInit.TestConnectionURLExists()
If Not oConnectionURLExists Then
Dim oResult = frmConfigService.ShowDialog()