ZooFlow: Use Error Handling from Common

This commit is contained in:
Jonathan Jenne 2021-04-26 16:31:57 +02:00
parent 18786bee33
commit af040e4ee9
2 changed files with 24 additions and 29 deletions

View File

@ -1,6 +1,8 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> Imports DigitalData.GUIs.Common.Base
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmFlowForm Partial Class frmFlowForm
Inherits DevExpress.XtraEditors.XtraForm Inherits BaseForm
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> <System.Diagnostics.DebuggerNonUserCode()>
@ -23,7 +25,7 @@ Partial Class frmFlowForm
<System.Diagnostics.DebuggerStepThrough()> <System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent() Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container() Me.components = New System.ComponentModel.Container()
Dim SplashScreenManager As DevExpress.XtraSplashScreen.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, Nothing, true, true) Dim SplashScreenManager As DevExpress.XtraSplashScreen.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, Nothing, True, True)
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmFlowForm)) Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmFlowForm))
Me.NotifyIcon = New System.Windows.Forms.NotifyIcon(Me.components) Me.NotifyIcon = New System.Windows.Forms.NotifyIcon(Me.components)
Me.ContextMenuSystray = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.ContextMenuSystray = New System.Windows.Forms.ContextMenuStrip(Me.components)

View File

@ -18,7 +18,6 @@ Public Class frmFlowForm
Private Const OPACITY_HIDDEN = 0.65 Private Const OPACITY_HIDDEN = 0.65
Private Const OPACITY_SHOWN = 0.85 Private Const OPACITY_SHOWN = 0.85
Private Logger As Logger
Private DTIDB_SEARCHES As DataTable Private DTIDB_SEARCHES As DataTable
' Common Helpers Classes ' Common Helpers Classes
@ -58,6 +57,8 @@ Public Class frmFlowForm
Private WithEvents Watcher As ClipboardWatcher.Watcher = ClipboardWatcher.Watcher.Singleton Private WithEvents Watcher As ClipboardWatcher.Watcher = ClipboardWatcher.Watcher.Singleton
Public Sub New() Public Sub New()
MyBase.New(My.LogConfig)
' Dieser Aufruf ist für den Designer erforderlich. ' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent() InitializeComponent()
@ -66,9 +67,6 @@ Public Class frmFlowForm
End Sub End Sub
Private Sub frmFlowForm_Load(sender As Object, e As EventArgs) Handles Me.Load Private Sub frmFlowForm_Load(sender As Object, e As EventArgs) Handles Me.Load
' === Initialize Logger ===
Logger = My.LogConfig.GetLogger()
' === Show Splash Screen === ' === Show Splash Screen ===
SplashScreenManager.ShowForm(Me, GetType(frmSplash), False, False) SplashScreenManager.ShowForm(Me, GetType(frmSplash), False, False)
@ -250,8 +248,7 @@ Public Class frmFlowForm
ProfileLoader = New ClassProfileLoader(My.LogConfig, AppServerOrDB) ProfileLoader = New ClassProfileLoader(My.LogConfig, AppServerOrDB)
ProfileLoader.LoadProfiles() ProfileLoader.LoadProfiles()
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) ShowErrorMessage(ex)
MsgBox("Error while initializing Clipboard Watcher!", MsgBoxStyle.Critical, Text)
End Try End Try
Else Else
My.Application.ClipboardWatcher.MonitoringActive = False My.Application.ClipboardWatcher.MonitoringActive = False
@ -291,6 +288,8 @@ Public Class frmFlowForm
If oDT.Rows.Count = 0 Then If oDT.Rows.Count = 0 Then
Throw New ApplicationException("No Default Path configured for User!") Throw New ApplicationException("No Default Path configured for User!")
'Logger.Warn("No Default Path configured for User. Skipping.")
'Exit Sub
End If End If
Dim oFolderWatchPath = oDT.Rows.Item(0).Item("FOLDER_PATH") Dim oFolderWatchPath = oDT.Rows.Item(0).Item("FOLDER_PATH")
@ -319,9 +318,7 @@ Public Class frmFlowForm
'FWFunction_STARTED = True 'FWFunction_STARTED = True
FolderWatch.StartStop_FolderWatch() FolderWatch.StartStop_FolderWatch()
Catch ex As Exception Catch ex As Exception
MsgBox($"Init_Folderwatch: Unexpected error while starting FolderWatch: {ex.Message}", MsgBoxStyle.Critical) ShowErrorMessage(ex)
Logger.Error(ex)
Logger.Info($"Init_Folderwatch: Unexpected error: {ex.Message}")
End Try End Try
Try Try
@ -350,8 +347,7 @@ Public Class frmFlowForm
'FWFunction_STARTED = True 'FWFunction_STARTED = True
FolderWatch.StartStop_FolderWatchSCAN() FolderWatch.StartStop_FolderWatchSCAN()
Catch ex As Exception Catch ex As Exception
MsgBox($"Init_Folderwatch: Unexpected error while starting FolderWatchScan: {ex.Message}", MsgBoxStyle.Critical) ShowErrorMessage(ex)
Logger.Info($"Init_Folderwatch: Unexpected error: {ex.Message}")
End Try End Try
End Sub End Sub
@ -529,12 +525,12 @@ Public Class frmFlowForm
Private Function FormLoaded_Visible() As Boolean Private Function FormLoaded_Visible() As Boolean
For Each frm As Form In Application.OpenForms For Each frm As Form In Application.OpenForms
If frm.Name.Equals("frmSearchStart") Or frm.Name.Equals("frmGlobix_Index") Or frm.Name.Equals("frmAdmin_Start") Then If frm.Name.Equals("frmSearchStart") Or frm.Name.Equals("frmGlobix_Index") Or frm.Name.Equals("frmAdmin_Start") Then
Me.Visible = False Return False
Exit Function
End If End If
Next Next
Me.Visible = True
TimerCheckActiveForms.Enabled = False TimerCheckActiveForms.Enabled = False
Return True
End Function End Function
Private Sub DatenbankverbindungToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DatenbankverbindungToolStripMenuItem.Click Private Sub DatenbankverbindungToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DatenbankverbindungToolStripMenuItem.Click
@ -542,13 +538,13 @@ Public Class frmFlowForm
End Sub End Sub
Private Sub TimerCheckActiveForms_Tick(sender As Object, e As EventArgs) Handles TimerCheckActiveForms.Tick Private Sub TimerCheckActiveForms_Tick(sender As Object, e As EventArgs) Handles TimerCheckActiveForms.Tick
FormLoaded_Visible() Visible = FormLoaded_Visible()
If Me.Visible = False Then Exit Sub If Visible = False Then Exit Sub
End Sub End Sub
Private Sub NotifyIcon_DoubleClick(sender As Object, e As EventArgs) Handles NotifyIcon.DoubleClick Private Sub NotifyIcon_DoubleClick(sender As Object, e As EventArgs) Handles NotifyIcon.DoubleClick
If Me.Visible = False Then If Visible = False Then
Me.Visible = True Visible = True
TimerCheckActiveForms.Enabled = False TimerCheckActiveForms.Enabled = False
End If End If
End Sub End Sub
@ -657,7 +653,7 @@ Public Class frmFlowForm
Next Next
Show() Show()
Catch ex As Exception Catch ex As Exception
MsgBox("Unexpected Error in Check_Dropped_Files:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) ShowErrorMessage(ex)
Show() Show()
End Try End Try
@ -673,8 +669,7 @@ Public Class frmFlowForm
TimerCheckActiveForms.Enabled = True TimerCheckActiveForms.Enabled = True
End If End If
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) ShowErrorMessage(ex)
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try End Try
End Sub End Sub
Sub NotifyIconReset() Sub NotifyIconReset()
@ -696,7 +691,7 @@ Public Class frmFlowForm
End Select End Select
NotifyIcon.ShowBalloonTip(30000, NI_TITLE, NI_MESSAGE, oNIType) NotifyIcon.ShowBalloonTip(30000, NI_TITLE, NI_MESSAGE, oNIType)
Catch ex As Exception Catch ex As Exception
ShowErrorMessage(ex)
End Try End Try
End Sub End Sub
Sub Start_Folderwatch() Sub Start_Folderwatch()
@ -749,8 +744,7 @@ Public Class frmFlowForm
Logger.Info("FWSCAN not started") Logger.Info("FWSCAN not started")
End If End If
Catch ex As Exception Catch ex As Exception
Logger.Info("Error while starting folderwatch scan: " & ex.Message) ShowErrorMessage(ex)
Logger.Error(ex.Message)
End Try End Try
Try Try
@ -786,8 +780,7 @@ Public Class frmFlowForm
Logger.Info("Folderwatch not started") Logger.Info("Folderwatch not started")
End If End If
Catch ex As Exception Catch ex As Exception
Logger.Info("Error while starting folderwatch: " & ex.Message) ShowErrorMessage(ex)
Logger.Error(ex.Message)
End Try End Try
If TimerFolderwatch.Enabled = False Then If TimerFolderwatch.Enabled = False Then