Zooflow: Improve frmServiceConfig, Init Errors Handling, Hide Backnavigation in Results

This commit is contained in:
Jonathan Jenne
2022-04-13 10:28:35 +02:00
parent 62748c9053
commit 711734bd12
13 changed files with 224 additions and 409 deletions

View File

@@ -37,9 +37,8 @@ Public Class ClassInit
' === Init Schritte definieren
_Loader.AddStep("Initializing Base", AddressOf InitializeBase, True)
'_Loader.AddStep("Initializing Database (1/2)", AddressOf InitializeDatabase, True)
_Loader.AddStep("Initializing EDMI Service", AddressOf InitializeService, True)
_Loader.AddStep("Initializing Database (2/2)", AddressOf InitializeDatabaseWithFallback, True)
_Loader.AddStep("Initializing Database", AddressOf InitializeDatabaseWithFallback, True)
_Loader.AddStep("Initializing User", AddressOf InitializeUser, True)
_Loader.AddStep("Initializing Language", AddressOf InitializeLanguage, False)
_Loader.AddStep("Initializing 3rd-party licenses", AddressOf Initialize3rdParty, False)
@@ -137,12 +136,18 @@ Public Class ClassInit
End Sub
Private Sub InitializeDatabaseWithFallback(MyApplication As My.MyApplication)
Try
Dim oECMConnectionString = MyApplication.Service.Client.ClientConfig.ConnectionStringECM
Logger.Debug("Loading client config..")
Dim oClientConfig = MyApplication.Service.Client.ClientConfig
Logger.Debug("Establishing ECM connection..")
Dim oECMConnectionString = oClientConfig.ConnectionStringECM
My.DatabaseECM = New MSSQLServer(My.LogConfig, oECMConnectionString)
Dim oIDBConnectionString = MyApplication.Service.Client.ClientConfig.ConnectionStringIDB
Logger.Debug("Establishing IDB connection..")
Dim oIDBConnectionString = oClientConfig.ConnectionStringIDB
My.DatabaseIDB = New MSSQLServer(My.LogConfig, oIDBConnectionString)
Logger.Debug("Establishing Database connection with fallback..")
My.Database = New DatabaseWithFallback(LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB)
Catch ex As Exception
Logger.Error(ex)
@@ -163,18 +168,21 @@ Public Class ClassInit
End If
For Each oRow As DataRow In oDatatable.Rows
Dim oType As String = oRow("TYPE").ToString
Dim oType As String = oRow.ItemEx("TYPE", "")
Select Case oType
Case "USER"
Case MODULE_USER
HandleUserInfo(MyApplication, oRow)
Case MODULE_CLIPBOARDWATCHER
HandleModuleInfo(MyApplication, oType, oRow)
Case MODULE_GLOBAL_INDEXER
HandleModuleInfo(MyApplication, oType, oRow)
Case MODULE_ZOOFLOW
HandleModuleInfo(MyApplication, oType, oRow)
End Select
Next
@@ -311,7 +319,19 @@ Public Class ClassInit
Private Sub InitCompleted(sender As Object, e As RunWorkerCompletedEventArgs)
If Not IsNothing(e.Error) Then
MsgBox("Beim Initialisieren des Programms ist folgender Fehler aufgetreten:" & vbNewLine & vbNewLine & e.Error.Message, MsgBoxStyle.Critical, _MainForm.Text)
Dim oMessageStart = $"Beim Initialisieren des Programms ist folgender Fehler aufgetreten:"
Dim oMessageEnd = "Das Program wird nun beendet"
Dim oMessage1 = $"{vbNewLine}{vbNewLine}{e.Error.Message}"
Dim oMessage2 = ""
If TypeOf e.Error Is InitException Then
Dim oException As InitException = DirectCast(e.Error, InitException)
oMessage2 = $"{vbNewLine}{vbNewLine}Details: {oException.InnerException.Message}"
End If
Dim oMessage = $"{oMessageStart}{oMessage1}{oMessage2}{oMessageEnd}"
MsgBox(oMessage, MsgBoxStyle.Critical, _MainForm.Text)
Application.ExitThread()
Else
' Copy back state from MyApplication Helper to My.Application