Imports DigitalData.Modules.Config Imports DigitalData.Modules.EDMI.API Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging.LogConfig Namespace My ' Für MyApplication sind folgende Ereignisse verfügbar: ' Startup: Wird beim Starten der Anwendung noch vor dem Erstellen des Startformulars ausgelöst. ' Shutdown: Wird nach dem Schließen aller Anwendungsformulare ausgelöst. Dieses Ereignis wird nicht ausgelöst, wenn die Anwendung mit einem Fehler beendet wird. ' UnhandledException: Wird bei einem Ausnahmefehler ausgelöst. ' 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 Private _Logger As Logger Private oUserAppDataPath As String = Windows.Forms.Application.UserAppDataPath Private _BaseLocalUserConfigPath As String = Windows.Forms.Application.LocalUserAppDataPath Private oCommonAppDataPath As String = Windows.Forms.Application.CommonAppDataPath Private oStartupPath As String = Windows.Forms.Application.StartupPath Public Sub App_Startup() Handles Me.Startup Dim oLogConfig As New LogConfig(LogPath:=PathType.AppData, CompanyName:="Digital Data", ProductName:="ZooFlow") With {.Debug = True} If My.Settings.UseAppConfigConString = True Then ' UserAppDataPath = StartupPath oCommonAppDataPath = oStartupPath End If ' System Config files like Service Url will be saved in %LocalAppdata% so they will remain on the machine Dim oConfigManager As New ConfigManager(Of ClassConfig)(oLogConfig, oUserAppDataPath, oCommonAppDataPath, oStartupPath) ' Layout files will be saved in %Appdata% (Roaming) so they will be syncronized with the user profile Dim oUIConfigPath = IO.Path.Combine(oUserAppDataPath, ClassConstants.FOLDER_NAME_LAYOUT) Dim oUIConfigAlternatePath = IO.Path.Combine(oUserAppDataPath, ClassConstants.FOLDER_NAME_LAYOUT) Dim oUIConfigManager As New ConfigManager(Of ClassUIConfig)(oLogConfig, oUIConfigPath, oUIConfigPath, oUIConfigAlternatePath) 'If oConfigManager.Config.ConnectionStringAppServer <> String.Empty Then ' MyConStringAppserv = DecryptConnectionString(oConfigManager.Config.ConnectionStringAppServer) ' If InitAppDatabase() Then ' Logger.Debug("ConnectionStringAppServer will be used") ' End If 'End If LogConfig = oLogConfig LogConfig.Debug = True SystemConfigManager = oConfigManager UIConfigManager = oUIConfigManager _Logger = LogConfig.GetLogger() _Logger.Debug("Starting ZooFlow...") If oConfigManager.Config.AppServerConfig <> String.Empty Then Try Dim oSplit() As String = oConfigManager.Config.AppServerConfig.ToString.Split(":"c) Dim oAppServerAddress As String = oSplit(0) Dim oAppServerPort As Integer = 9000 If oSplit.Length = 2 Then oAppServerPort = oSplit(1) End If My.Application.Service.Client = New Client(LogConfig, oAppServerAddress, oAppServerPort) If Not IsNothing(My.Application.Service.Client) Then If My.Application.Service.Client.Connect() Then My.Application.Service.IsActive = True End If End If Catch ex As Exception _Logger.Warn($"Could not initialize the AppServer: {ex.Message}") End Try End If Dim oCommandLineArgs As New ClassCommandlineArgs(LogConfig) Dim oArgs = Environment.GetCommandLineArgs().Skip(1).ToList() oCommandLineArgs.Parse(oArgs) CommandLineFunction = oCommandLineArgs.FunctionName CommandLineArguments = oCommandLineArgs.FunctionArgs End Sub Public Sub App_Shutdown(sender As Object, e As EventArgs) Handles Me.Shutdown _Logger.Debug("Shutting down Client Suite..") End Sub End Class End Namespace