zooflow: msgbox

This commit is contained in:
Jonathan Jenne
2022-05-24 12:16:23 +02:00
parent 6cefffc2a6
commit ba3b4c7bf5
12 changed files with 117 additions and 90 deletions

View File

@@ -20,6 +20,7 @@ Public Class ClassInit
Private ReadOnly _MainForm As frmFlowForm
Private ReadOnly _Database As DatabaseWithFallback
Private ReadOnly _FormHelper As FormHelper
Private _Loader As ClassInitLoader
Public Event Completed As EventHandler
@@ -27,6 +28,7 @@ Public Class ClassInit
Public Sub New(LogConfig As LogConfig, ParentForm As frmFlowForm)
MyBase.New(LogConfig)
_MainForm = ParentForm
_FormHelper = New FormHelper(LogConfig, ParentForm)
End Sub
Public Sub InitializeApplication()
@@ -49,6 +51,37 @@ Public Class ClassInit
_Loader.Run()
End Sub
Private Sub InitCompleted(sender As Object, e As RunWorkerCompletedEventArgs)
If Not IsNothing(e.Error) Then
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}"
Dim oMsgBox As New frmDialog(oMessage, _MainForm.Text, frmDialog.DialogType.Error)
oMsgBox.ShowDialog()
Application.ExitThread()
Else
' Copy back state from MyApplication Helper to My.Application
Dim oMyApplication As My.MyApplication = DirectCast(e.Result, My.MyApplication)
My.Application.Settings = oMyApplication.Settings
My.Application.User = oMyApplication.User
My.Application.Modules = oMyApplication.Modules
My.Application.ModulesActive = oMyApplication.ModulesActive
My.Application.ClipboardWatcher = oMyApplication.ClipboardWatcher
RaiseEvent Completed(sender, Nothing)
End If
End Sub
#Region "=== Init Steps ==="
Private Sub InitializeBase(MyApplication As My.MyApplication)
@@ -358,37 +391,6 @@ Public Class ClassInit
SplashScreenManager.Default.SendCommand(frmSplash.SplashScreenCommand.SetActionName, Progress.CurrentStep.Name)
End Sub
Private Sub InitCompleted(sender As Object, e As RunWorkerCompletedEventArgs)
If Not IsNothing(e.Error) Then
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}"
Dim oMsgBox As New frmDialog(oMessage, _MainForm.Text, frmDialog.DialogType.Error)
oMsgBox.ShowDialog()
Application.ExitThread()
Else
' Copy back state from MyApplication Helper to My.Application
Dim oMyApplication As My.MyApplication = DirectCast(e.Result, My.MyApplication)
My.Application.Settings = oMyApplication.Settings
My.Application.User = oMyApplication.User
My.Application.Modules = oMyApplication.Modules
My.Application.ModulesActive = oMyApplication.ModulesActive
My.Application.ClipboardWatcher = oMyApplication.ClipboardWatcher
RaiseEvent Completed(sender, Nothing)
End If
End Sub
Private Sub HandleUserInfo(MyApplication As My.MyApplication, Row As DataRow)
Dim oValue As Object = Row.Item("VALUE")
Dim oName As String = Row.Item("NAME").ToString