From bc46ccadb39d52a0650c7584e1874c65a01df3bd Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 14 Oct 2020 14:37:52 +0200 Subject: [PATCH 1/4] Add UnhandledException EventHandler --- app/DD_PM_WINDREAM/ApplicationEvents.vb | 24 ++++++++++++++++++++++++ app/DD_PM_WINDREAM/DD_PM_WINDREAM.vbproj | 1 + 2 files changed, 25 insertions(+) create mode 100644 app/DD_PM_WINDREAM/ApplicationEvents.vb diff --git a/app/DD_PM_WINDREAM/ApplicationEvents.vb b/app/DD_PM_WINDREAM/ApplicationEvents.vb new file mode 100644 index 0000000..1314cba --- /dev/null +++ b/app/DD_PM_WINDREAM/ApplicationEvents.vb @@ -0,0 +1,24 @@ +Imports Microsoft.VisualBasic.ApplicationServices + +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 Sub MyApplication_UnhandledException(sender As Object, e As UnhandledExceptionEventArgs) Handles Me.UnhandledException + Dim oMessage = "Application encountered an unhandled error!" & vbNewLine & vbNewLine & + "The errormessage was:" & vbNewLine & e.Exception.Message & vbNewLine & + "The stacktrace was:" & vbNewLine & e.Exception.StackTrace + + If IsNothing(LOGGER) = False Then + LOGGER.Info(oMessage) + LOGGER.Error(e.Exception) + End If + + MsgBox(oMessage, MsgBoxStyle.Critical, "Process Manager") + End Sub + End Class +End Namespace diff --git a/app/DD_PM_WINDREAM/DD_PM_WINDREAM.vbproj b/app/DD_PM_WINDREAM/DD_PM_WINDREAM.vbproj index 5458cfc..ff4c9fd 100644 --- a/app/DD_PM_WINDREAM/DD_PM_WINDREAM.vbproj +++ b/app/DD_PM_WINDREAM/DD_PM_WINDREAM.vbproj @@ -237,6 +237,7 @@ + From 3f97727cee6d980c9aa8703b92f193147b2589cd Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 14 Oct 2020 14:38:51 +0200 Subject: [PATCH 2/4] add general error handling & logging --- app/DD_PM_WINDREAM/frmMain.vb | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/app/DD_PM_WINDREAM/frmMain.vb b/app/DD_PM_WINDREAM/frmMain.vb index c0fe190..f30e9a1 100644 --- a/app/DD_PM_WINDREAM/frmMain.vb +++ b/app/DD_PM_WINDREAM/frmMain.vb @@ -89,7 +89,6 @@ Public Class frmMain formopenClose = True LOGGER.Debug("Initializing MainForm....") - ' Create helper to save/load expanded GroupColumns at runtime RefreshHelper = New RefreshHelper(GridView_Docs, "GUID") @@ -1964,16 +1963,20 @@ Public Class frmMain End Sub Private Sub frmMain_Resize(sender As Object, e As EventArgs) Handles Me.Resize - If formShown = False Then - Exit Sub - End If + Try + If formShown = False Then + Exit Sub + End If - If WindowState = FormWindowState.Maximized Then - My.Settings.frmMainWindowState = "Maximized" - ElseIf WindowState = FormWindowState.Normal Then - My.Settings.frmMainWindowState = "Normal" - End If - My.Settings.Save() + If WindowState = FormWindowState.Maximized Then + My.Settings.frmMainWindowState = "Maximized" + ElseIf WindowState = FormWindowState.Normal Then + My.Settings.frmMainWindowState = "Normal" + End If + My.Settings.Save() + Catch ex As Exception + LOGGER.Error(ex) + End Try End Sub Private Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniGrundeinstellung.ItemClick Try @@ -2058,8 +2061,6 @@ Public Class frmMain Catch ex As Exception LOGGER.Warn($"Timer5Mins Error: {ex.Message}") End Try - - End Sub Private Sub bwBasicData_DoWork(sender As Object, e As DoWorkEventArgs) Handles bwBasicData.DoWork GetBaseData("bwBasicData") @@ -2205,7 +2206,7 @@ Public Class frmMain tslblObjectCount.Text = objectCount_Descr tslblObjectCount.ForeColor = Color.DarkOrange Catch ex As Exception - + LOGGER.Error(ex.Message) End Try End Sub From f59a56843c5bde76ecb6fb57cfcb1175f46d4e9c Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 14 Oct 2020 14:39:11 +0200 Subject: [PATCH 3/4] remove measurestring calls from comboboxes for now --- app/DD_PM_WINDREAM/frmMassValidator.vb | 36 ++++++++++----- app/DD_PM_WINDREAM/frmValidator.vb | 64 +++++++++++++++++--------- 2 files changed, 67 insertions(+), 33 deletions(-) diff --git a/app/DD_PM_WINDREAM/frmMassValidator.vb b/app/DD_PM_WINDREAM/frmMassValidator.vb index e827f4f..453c32b 100644 --- a/app/DD_PM_WINDREAM/frmMassValidator.vb +++ b/app/DD_PM_WINDREAM/frmMassValidator.vb @@ -273,17 +273,31 @@ Public Class frmMassValidator End If #End Region - Dim maxWith As Integer = cmb.Width - Using g As Graphics = Me.CreateGraphics - For Each oItem As Object In cmb.Items 'Für alle Einträge... - Dim g1 As Graphics = cmb.CreateGraphics - If g1.MeasureString(Text, cmb.Font).Width + 30 > maxWith Then - maxWith = g1.MeasureString(Text, cmb.Font).Width + 30 - End If - g1.Dispose() - Next oItem - End Using - cmb.DropDownWidth = maxWith + 'Dim oMaxWidth As Integer = cmb.Width + + 'Using oGraphics As Graphics = cmb.CreateGraphics() + ' Dim oStringLength = oGraphics.MeasureString(Text, cmb.Font).Width + ' If oStringLength + 30 > oMaxWidth Then + ' oMaxWidth = oStringLength + 30 + ' End If + 'End Using + + 'Using g As Graphics = Me.CreateGraphics + ' For Each oItem As Object In cmb.Items 'Für alle Einträge... + ' Dim g1 As Graphics = cmb.CreateGraphics + ' If g1.MeasureString(Text, cmb.Font).Width + 30 > oMaxWidth Then + ' oMaxWidth = g1.MeasureString(Text, cmb.Font).Width + 30 + ' End If + ' g1.Dispose() + ' Next oItem + 'End Using + + 'cmb.DropDownWidth = oMaxWidth + + + + + oControl = cmb End If diff --git a/app/DD_PM_WINDREAM/frmValidator.vb b/app/DD_PM_WINDREAM/frmValidator.vb index 9b8f8da..84c4214 100644 --- a/app/DD_PM_WINDREAM/frmValidator.vb +++ b/app/DD_PM_WINDREAM/frmValidator.vb @@ -906,17 +906,26 @@ Public Class frmValidator #End Region - Dim maxWith As Integer = oComboBox.Width - Using g As Graphics = Me.CreateGraphics - For Each oItem As Object In oComboBox.Items 'Für alle Einträge... - Dim g1 As Graphics = oComboBox.CreateGraphics - If g1.MeasureString(Text, oComboBox.Font).Width + 30 > maxWith Then - maxWith = g1.MeasureString(Text, oComboBox.Font).Width + 30 - End If - g1.Dispose() - Next oItem - End Using - oComboBox.DropDownWidth = maxWith + 'Dim oMaxWidth As Integer = oComboBox.Width + + 'Using oGraphics As Graphics = oComboBox.CreateGraphics() + ' Dim oStringLength = oGraphics.MeasureString(Text, oComboBox.Font).Width + ' If oStringLength + 30 > oMaxWidth Then + ' oMaxWidth = oStringLength + 30 + ' End If + 'End Using + + 'Using g As Graphics = Me.CreateGraphics + ' For Each oItem As Object In oComboBox.Items 'Für alle Einträge... + ' Dim g1 As Graphics = oComboBox.CreateGraphics + ' If g1.MeasureString(Text, oComboBox.Font).Width + 30 > oMaxWidth Then + ' oMaxWidth = g1.MeasureString(Text, oComboBox.Font).Width + 30 + ' End If + ' g1.Dispose() + ' Next oItem + 'End Using + + 'oComboBox.DropDownWidth = oMaxWidth oMyControl = oComboBox End If @@ -2269,17 +2278,28 @@ Public Class frmValidator cmbpanel.DisplayMember = resultDT.Columns(0).ColumnName cmbpanel.ValueMember = resultDT.Columns(0).ColumnName - Dim maxWith As Integer = cmbpanel.Width - Using g As Graphics = Me.CreateGraphics - For Each oItem As Object In cmbpanel.Items 'Für alle Einträge... - Dim g1 As Graphics = cmbpanel.CreateGraphics - If g1.MeasureString(Text, cmbpanel.Font).Width + 30 > maxWith Then - maxWith = g1.MeasureString(Text, cmbpanel.Font).Width + 30 - End If - g1.Dispose() - Next oItem - End Using - cmbpanel.DropDownWidth = maxWith + + + 'Dim oMaxWidth As Integer = cmbpanel.Width + + 'Using oGraphics As Graphics = cmbpanel.CreateGraphics() + ' Dim oStringLength = oGraphics.MeasureString(Text, cmbpanel.Font).Width + ' If oStringLength + 30 > oMaxWidth Then + ' oMaxWidth = oStringLength + 30 + ' End If + 'End Using + + 'Using g As Graphics = Me.CreateGraphics + ' For Each oItem As Object In cmbpanel.Items 'Für alle Einträge... + ' Dim g1 As Graphics = cmbpanel.CreateGraphics + ' If g1.MeasureString(Text, cmbpanel.Font).Width + 30 > oMaxWidth Then + ' oMaxWidth = g1.MeasureString(Text, cmbpanel.Font).Width + 30 + ' End If + ' g1.Dispose() + ' Next oItem + 'End Using + + 'cmbpanel.DropDownWidth = oMaxWidth ElseIf displayboxname.StartsWith(ClassControlCreator.PREFIX_LOOKUP) Or displayboxname.StartsWith(ClassControlCreator.PREFIX_TABLE) Then LOGGER.Warn("Depending_Control_Set_Result PREFIX_LOOKUP NOT IMPLEMENTED") From 771ab9cb0458bf197de2b87ebfdc6e17c7fb98a3 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 14 Oct 2020 14:39:44 +0200 Subject: [PATCH 4/4] Version 2.1.4.9 --- app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb b/app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb index 8cecbf8..21d1bd3 100644 --- a/app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb +++ b/app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - +