performance fixes for drawing group header, log (to database on) unhandled exceptions
This commit is contained in:
@@ -13,10 +13,20 @@ Namespace My
|
||||
"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
|
||||
LOGGER.Error(e.Exception)
|
||||
|
||||
Try
|
||||
If USER_DEBUG_LOG = True Then
|
||||
Dim oLogMessage = LOGCONFIG.Logs.Last()
|
||||
Dim oLogSplit As String() = oLogMessage.Split("|")
|
||||
Dim oDBMessage = PrepareLogMessage(oLogMessage)
|
||||
|
||||
Dim oSQL = $"INSERT INTO [dbo].[TBPM_LOG_DEBUG] ([USERID], [LOGMSG], [ADDED_WHEN], DATE_STR) VALUES({USER_ID},'{oDBMessage}',GETDATE(),'{Now}')"
|
||||
ClassDatabase.Execute_non_Query(oSQL)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
|
||||
MsgBox(oMessage, MsgBoxStyle.Critical, "Process Manager")
|
||||
End Sub
|
||||
|
||||
@@ -44,6 +44,22 @@
|
||||
Public Function IntToColor(int As Integer) As Color
|
||||
Return ColorTranslator.FromWin32(int)
|
||||
End Function
|
||||
|
||||
Public Function PrepareLogMessage(LogMessage As String) As String
|
||||
Dim oLogSplit As String()
|
||||
oLogSplit = LogMessage.Split("|")
|
||||
|
||||
If oLogSplit.Count < 3 Then
|
||||
Return LogMessage
|
||||
Else
|
||||
Dim omsg = oLogSplit(2).
|
||||
Replace("'", "''").
|
||||
Replace("\\n", "").
|
||||
Replace(Chr(13), "").
|
||||
Replace(Chr(10), "")
|
||||
Return omsg
|
||||
End If
|
||||
End Function
|
||||
End Module
|
||||
|
||||
|
||||
|
||||
@@ -31,8 +31,11 @@ Public Class frmMain
|
||||
Private NO_WORKFLOWITEMS As Boolean = False
|
||||
Private InResetlayout As Boolean = False
|
||||
Private RefreshHelper As RefreshHelper
|
||||
Private formopenClose As Boolean = False
|
||||
Private formShown As Boolean = False
|
||||
|
||||
Private FormOpenClose As Boolean = False
|
||||
Private FormShown As Boolean = False
|
||||
Private GridIsLoaded As Boolean = False
|
||||
|
||||
Private allgFunk As New ClassAllgemeineFunktionen
|
||||
Private _Init As New ClassInit
|
||||
Private CurrNavBarGroup As NavBarGroup
|
||||
@@ -43,7 +46,7 @@ Public Class frmMain
|
||||
|
||||
Private Sub frmMain_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
Try
|
||||
formopenClose = True
|
||||
FormOpenClose = True
|
||||
' Position und Größe speichern
|
||||
My.Settings.frmMainSize = Me.Size
|
||||
My.Settings.frmMainPosition = Me.Location
|
||||
@@ -86,7 +89,7 @@ Public Class frmMain
|
||||
bbtniMetadataFile.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||||
End If
|
||||
|
||||
formopenClose = True
|
||||
FormOpenClose = True
|
||||
LOGGER.Debug("Initializing MainForm....")
|
||||
|
||||
' Create helper to save/load expanded GroupColumns at runtime
|
||||
@@ -200,7 +203,7 @@ Public Class frmMain
|
||||
End If
|
||||
Check_Timer_Notification()
|
||||
Check_Timer_Inactivity()
|
||||
formShown = True
|
||||
FormShown = True
|
||||
Restore_Form_Position()
|
||||
|
||||
|
||||
@@ -239,7 +242,7 @@ Public Class frmMain
|
||||
End If
|
||||
LOGGER.Debug("MainForm initialized!")
|
||||
End If
|
||||
formopenClose = False
|
||||
FormOpenClose = False
|
||||
End Sub
|
||||
Sub Check_Timer_Notification()
|
||||
Try
|
||||
@@ -597,7 +600,6 @@ Public Class frmMain
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -884,7 +886,7 @@ Public Class frmMain
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If GridControl_Docs.Visible = True And formopenClose = False Then RefreshHelper.SaveViewInfo()
|
||||
If GridControl_Docs.Visible = True And FormOpenClose = False Then RefreshHelper.SaveViewInfo()
|
||||
'If Not Application.OpenForms().OfType(Of frmValidator).Any Then
|
||||
' Dim oUpdate = "Not Defined"
|
||||
' Try
|
||||
@@ -913,7 +915,7 @@ Public Class frmMain
|
||||
Else
|
||||
bsilastsync.Caption = "Letzte Synchronisation: " & Now.ToLongTimeString
|
||||
End If
|
||||
If GridControl_Docs.Visible = True And formopenClose = False Then RefreshHelper.LoadViewInfo()
|
||||
If GridControl_Docs.Visible = True And FormOpenClose = False Then RefreshHelper.LoadViewInfo()
|
||||
|
||||
Handling_DEBUG_USER()
|
||||
Catch ex As Exception
|
||||
@@ -935,17 +937,21 @@ Public Class frmMain
|
||||
End Sub
|
||||
Private Sub Decide_Load(FormLoad As Boolean)
|
||||
Try
|
||||
GridIsLoaded = False
|
||||
|
||||
If USER_EXISTS = False Then
|
||||
Exit Sub
|
||||
End If
|
||||
If TimerRefresh.Enabled = True Then
|
||||
TimerRefresh.Enabled = False
|
||||
End If
|
||||
|
||||
If GRID_LOAD_TYPE = "OVERVIEW" Then
|
||||
Load_Grid_Overview(FormLoad)
|
||||
ElseIf GRID_LOAD_TYPE.StartsWith("PROFILE#") Then
|
||||
Load_single_Profile()
|
||||
End If
|
||||
|
||||
If SHOW_MASS_VALIDATOR = False Then
|
||||
GridView_Docs.OptionsSelection.MultiSelect = False
|
||||
GridView_Docs.OptionsSelection.MultiSelectMode = GridMultiSelectMode.RowSelect
|
||||
@@ -958,7 +964,10 @@ Public Class frmMain
|
||||
GridView_Docs.OptionsSelection.MultiSelect = True
|
||||
GridView_Docs.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CheckBoxRowSelect
|
||||
End If
|
||||
|
||||
GridIsLoaded = True
|
||||
Catch ex As Exception
|
||||
GridIsLoaded = True
|
||||
LOGGER.Error(ex)
|
||||
LOGGER.Info("Unexpected error in Decide_load: " & ex.Message)
|
||||
End Try
|
||||
@@ -1691,7 +1700,7 @@ Public Class frmMain
|
||||
|
||||
End Sub
|
||||
Sub Reset_GridLayout(FormLoad As Boolean)
|
||||
If GridControl_Docs.Visible = True And formopenClose = False Then RefreshHelper.SaveViewInfo()
|
||||
If GridControl_Docs.Visible = True And FormOpenClose = False Then RefreshHelper.SaveViewInfo()
|
||||
InResetlayout = True
|
||||
' Layout zurücksetzen
|
||||
ResetLayout()
|
||||
@@ -1710,91 +1719,80 @@ Public Class frmMain
|
||||
|
||||
Private Sub GridView_Docs_CustomDrawGroupRow(sender As Object, e As Views.Base.RowObjectCustomDrawEventArgs) Handles GridView_Docs.CustomDrawGroupRow
|
||||
Try
|
||||
If formShown = False Then
|
||||
' Added
|
||||
If FormOpenClose = True And GridIsLoaded = False Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim info As GridGroupRowInfo = TryCast(e.Info, GridGroupRowInfo)
|
||||
Dim view As GridView = sender
|
||||
Dim oGroupItem As GridGroupSummaryItem = CType(view.GroupSummary(Tag), GridGroupSummaryItem)
|
||||
' Dim value As Object = view.GetGroupSummaryValue(e.RowHandle, item)
|
||||
|
||||
If info.Column.FieldName = "GROUP_TEXT" Then
|
||||
info.GroupText = info.GroupValueText
|
||||
|
||||
Dim _color As String = "LightGray"
|
||||
Dim _FontColor As String = "Black"
|
||||
Dim oColorString As String = "LightGray"
|
||||
Dim oFontColorString As String = "Black"
|
||||
Dim oFoundConfig As Boolean = False
|
||||
|
||||
For Each row As DataRow In CURR_DT_VWPM_PROFILE_ACTIVE.Rows
|
||||
'LOGGER.Debug($"CustomDrawGroupRow: Working on ProfileID [{row.Item("GUID")}]...")
|
||||
If row.Item("GROUP_TEXT") = info.GroupValueText Then
|
||||
oFoundConfig = True
|
||||
_color = row.Item("GROUP_COLOR")
|
||||
_FontColor = row.Item("GROUP_FONT_COLOR")
|
||||
oColorString = row.Item("GROUP_COLOR")
|
||||
oFontColorString = row.Item("GROUP_FONT_COLOR")
|
||||
|
||||
' Added
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If oFoundConfig = False Then
|
||||
LOGGER.Debug($"CustomDrawGroupRow: Could not find a ColorConfig for ProfileGroupValueText [{info.GroupValueText}]...")
|
||||
|
||||
' Added
|
||||
Exit Sub
|
||||
End If
|
||||
Dim oColor As Color
|
||||
Dim oFontColor As Color
|
||||
Try
|
||||
If _color.Contains(";") Or _color.Contains(".") Then
|
||||
Dim oColorSplit As String()
|
||||
If _color.Contains(";") Then
|
||||
oColorSplit = _color.Split(";")
|
||||
ElseIf _color.Contains(".") Then
|
||||
oColorSplit = _color.Split(".")
|
||||
End If
|
||||
|
||||
Dim oColor As Color = ParseColorString(oColorString, Color.LightGray, "Background Color")
|
||||
Dim oFontColor As Color = ParseColorString(oFontColorString, Color.Black, "Font Color")
|
||||
|
||||
Try
|
||||
oColor = Color.FromArgb(oColorSplit(0), oColorSplit(1), oColorSplit(2))
|
||||
Catch ex As Exception
|
||||
LOGGER.Info($"CustomDrawGroupRow: Could not get Color.FromArgb [{_color}]")
|
||||
oColor = Color.LightGray
|
||||
End Try
|
||||
|
||||
Else
|
||||
Try
|
||||
oColor = Color.FromName(_color)
|
||||
Catch ex As Exception
|
||||
LOGGER.Info($"CustomDrawGroupRow: Could not get Color.FromName [{_color}]")
|
||||
oColor = Color.LightGray
|
||||
End Try
|
||||
|
||||
End If
|
||||
If _FontColor.Contains(";") Then
|
||||
Try
|
||||
oFontColor = Color.FromArgb(_FontColor)
|
||||
Catch ex As Exception
|
||||
LOGGER.Info($"CustomDrawGroupRow: Could not get Color.FromArgb [{_FontColor}]")
|
||||
oFontColor = Color.Black
|
||||
End Try
|
||||
|
||||
Else
|
||||
Try
|
||||
oFontColor = Color.FromName(_FontColor)
|
||||
Catch ex As Exception
|
||||
LOGGER.Info($"CustomDrawGroupRow(FC): Could not get Color.FromName [{_FontColor}]")
|
||||
oFontColor = Color.Black
|
||||
End Try
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Info($"CustomDrawGroupRow(FC): Error getting Color [{_FontColor}]")
|
||||
oColor = Color.LightGray
|
||||
End Try
|
||||
info.Appearance.BackColor = oColor
|
||||
info.Appearance.ForeColor = oFontColor
|
||||
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function ParseColorString(ColorString As String, DefaultColor As Color, ColorDescription As String) As Color
|
||||
Dim oResultColor As Color
|
||||
|
||||
If ColorString.Contains(";") Or ColorString.Contains(".") Then
|
||||
Dim oSplitColorString As String()
|
||||
|
||||
If ColorString.Contains(";") Then
|
||||
oSplitColorString = ColorString.Split(";")
|
||||
Else
|
||||
oSplitColorString = ColorString.Split(".")
|
||||
End If
|
||||
|
||||
Try
|
||||
oResultColor = Color.FromArgb(oSplitColorString(0), oSplitColorString(1), oSplitColorString(2))
|
||||
Catch ex As Exception
|
||||
oResultColor = DefaultColor
|
||||
LOGGER.Info("ParseColorString: Could not get Color.FromArgb [{0}] for {1}", ColorString, ColorDescription)
|
||||
End Try
|
||||
Else
|
||||
Try
|
||||
oResultColor = Color.FromName(ColorString)
|
||||
Catch ex As Exception
|
||||
LOGGER.Info("ParseColorString: Could not get Color.FromArgb [{0}] for {1}", ColorString, ColorDescription)
|
||||
oResultColor = DefaultColor
|
||||
End Try
|
||||
End If
|
||||
|
||||
Return oResultColor
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub GridView_Docs_MouseDown(sender As Object, e As MouseEventArgs) Handles GridView_Docs.MouseDown
|
||||
Dim view As GridView = sender
|
||||
Dim hi As GridHitInfo = view.CalcHitInfo(e.Location)
|
||||
@@ -1826,7 +1824,7 @@ Public Class frmMain
|
||||
|
||||
Private Sub GridView_Docs_LostFocus(sender As Object, e As EventArgs) Handles GridView_Docs.LostFocus
|
||||
' Save expanded GroupRows
|
||||
If GridControl_Docs.Visible = True And formopenClose = False Then RefreshHelper.SaveViewInfo()
|
||||
If GridControl_Docs.Visible = True And FormOpenClose = False Then RefreshHelper.SaveViewInfo()
|
||||
End Sub
|
||||
Sub LoadCURRENT_DT_PROFILES()
|
||||
CURRENT_DT_PROFILES = ClassDatabase.Return_Datatable("select * from TBPM_PROFILE where ACTIVE = 1", "LoadCURRENT_DT_PROFILES")
|
||||
@@ -1919,15 +1917,10 @@ Public Class frmMain
|
||||
Dim oSQL As String = "None"
|
||||
Try
|
||||
For Each oSLogstring As String In LOGCONFIG.Logs
|
||||
Dim oLogSplit As String()
|
||||
oLogSplit = oSLogstring.Split("|")
|
||||
'Console.WriteLine(oLogSplit(2))
|
||||
Dim omsg = oLogSplit(2).Replace("'", "''")
|
||||
omsg = omsg.Replace("\\n", "")
|
||||
omsg = omsg.Replace(Chr(10), "")
|
||||
omsg = omsg.Replace(Chr(13), "")
|
||||
Dim odatetime As Date = CDate(oLogSplit(0))
|
||||
oSQL = $"INSERT INTO [dbo].[TBPM_LOG_DEBUG] ([USERID] , [LOGMSG], [ADDED_WHEN],DATE_STR) VALUES({USER_ID},'{omsg}',GetDate(),'{odatetime}')"
|
||||
Dim oLogSplit As String() = oSLogstring.Split("|")
|
||||
Dim oMessage = PrepareLogMessage(oSLogstring)
|
||||
Dim oDateTime As Date = CDate(oLogSplit(0))
|
||||
oSQL = $"INSERT INTO [dbo].[TBPM_LOG_DEBUG] ([USERID] , [LOGMSG], [ADDED_WHEN],DATE_STR) VALUES({USER_ID},'{oMessage}',GetDate(),'{oDateTime}')"
|
||||
ClassDatabase.Execute_non_Query(oSQL)
|
||||
Next
|
||||
LOGCONFIG.ClearLogs()
|
||||
@@ -1935,7 +1928,6 @@ Public Class frmMain
|
||||
LOGGER.Error(ex)
|
||||
LOGGER.Warn($"oSQL so far [{oSQL}]")
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
Private Sub tsslblDEBUG_LOG_MouseHover(sender As Object, e As EventArgs)
|
||||
MsgBox("UserDebugMode is activated remotely. Debugdata will be transferred to database and will be deleted after 10 days!!", MsgBoxStyle.Information, ADDITIONAL_TITLE)
|
||||
@@ -1948,7 +1940,6 @@ Public Class frmMain
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub LöscheAlleFilterToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LöscheAlleFilterToolStripMenuItem.Click
|
||||
Try
|
||||
GridView_Docs.ClearFindFilter()
|
||||
@@ -1986,7 +1977,7 @@ Public Class frmMain
|
||||
|
||||
Private Sub frmMain_Resize(sender As Object, e As EventArgs) Handles Me.Resize
|
||||
Try
|
||||
If formShown = False Then
|
||||
If FormShown = False Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@@ -2014,14 +2005,14 @@ Public Class frmMain
|
||||
|
||||
|
||||
Private Sub bbtniRefresh_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniRefresh.ItemClick
|
||||
If GridControl_Docs.Visible = True And formopenClose = False Then
|
||||
If GridControl_Docs.Visible = True And FormOpenClose = False Then
|
||||
RefreshHelper.SaveViewInfo()
|
||||
SaveGridLayout()
|
||||
End If
|
||||
|
||||
LoadNavBar()
|
||||
Decide_Load(False)
|
||||
If GridControl_Docs.Visible = True And formopenClose = False Then RefreshHelper.LoadViewInfo()
|
||||
If GridControl_Docs.Visible = True And FormOpenClose = False Then RefreshHelper.LoadViewInfo()
|
||||
End Sub
|
||||
|
||||
Private Sub bbtniMonitor_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniMonitor.ItemClick
|
||||
@@ -2119,7 +2110,7 @@ Public Class frmMain
|
||||
End Sub
|
||||
|
||||
Private Sub GridView_Docs_RowStyle(sender As Object, e As RowStyleEventArgs) Handles GridView_Docs.RowStyle
|
||||
If formShown = False Then
|
||||
If FormShown = False Then
|
||||
Exit Sub
|
||||
End If
|
||||
If e.RowHandle = -1 Then
|
||||
@@ -2187,7 +2178,7 @@ Public Class frmMain
|
||||
GetBaseData("Load")
|
||||
LoadNavBar()
|
||||
Decide_Load(False)
|
||||
If GridControl_Docs.Visible = True And formopenClose = False Then RefreshHelper.LoadViewInfo()
|
||||
If GridControl_Docs.Visible = True And FormOpenClose = False Then RefreshHelper.LoadViewInfo()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -2214,7 +2205,7 @@ Public Class frmMain
|
||||
_Init.InitUserLogin()
|
||||
LoadNavBar()
|
||||
Decide_Load(False)
|
||||
If GridControl_Docs.Visible = True And formopenClose = False Then RefreshHelper.LoadViewInfo()
|
||||
If GridControl_Docs.Visible = True And FormOpenClose = False Then RefreshHelper.LoadViewInfo()
|
||||
End Sub
|
||||
|
||||
Private Sub GridView_Docs_ColumnFilterChanged(sender As Object, e As EventArgs) Handles GridView_Docs.ColumnFilterChanged
|
||||
@@ -2236,12 +2227,12 @@ Public Class frmMain
|
||||
XtraSaveFileDialog1.FileName = "OverviewProcessManager.xlsx"
|
||||
XtraSaveFileDialog1.DefaultExt = ".xlsx"
|
||||
|
||||
If XtraSaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
|
||||
Dim oOptions As New XlsxExportOptions() With {
|
||||
If XtraSaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
|
||||
Dim oOptions As New XlsxExportOptions() With {
|
||||
.ExportMode = XlsxExportMode.SingleFile
|
||||
}
|
||||
GridView_Docs.ExportToXlsx(XtraSaveFileDialog1.FileName, oOptions)
|
||||
End If
|
||||
GridView_Docs.ExportToXlsx(XtraSaveFileDialog1.FileName, oOptions)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user