MS TimerErrorHandling

This commit is contained in:
2020-04-21 12:27:37 +02:00
parent 103619ebac
commit cf108c9276
2 changed files with 226 additions and 207 deletions

View File

@@ -723,57 +723,63 @@ Public Class frmMain
Visible = True
End Sub
Private Sub Timer_Tick(sender As System.Object, e As EventArgs) Handles TimerRefresh.Tick
If TimerRefresh.Enabled = False Then
Exit Sub
End If
If bwBasicData.IsBusy Then
LOGGER.Info("bwBasicData is busy - no Refreshing")
Exit Sub
End If
If Application.OpenForms().OfType(Of frmValidator).Any Then
Exit Sub
End If
If Application.OpenForms().OfType(Of frmAdministration).Any Then
Exit Sub
End If
If Application.OpenForms().OfType(Of frmAdmin2).Any Then
Exit Sub
End If
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
' oUpdate = $"UPDATE TBPM_PROFILE_FILES SET IN_WORK = 0, WORK_USER = NULL, IN_WORK_WHEN = NULL where UPPER(WORK_USER) = UPPER('{USER_USERNAME}')"
' ClassDatabase.Execute_non_Query(oUpdate)
' Catch ex As Exception
' LOGGER.Warn($"Unexpected Error in freefileforUser [{oUpdate}] - {ex.Message}")
' End Try
'End If
If bwSync.IsBusy Then
Exit Sub
End If
Try
SaveGridLayout()
'bwSync.ReportProgress(10)
LoadNavBar()
'bwSync.ReportProgress(60)
Dim oStopWatch As New RefreshHelper.SW("Decide_Load")
Decide_Load()
oStopWatch.Done()
'bwSync.ReportProgress(95)
If USER_LANGUAGE <> "de-DE" Then
bsilastsync.Caption = "Last Client-Sync: " & Now.ToLongTimeString
Else
bsilastsync.Caption = "Letzte Synchronisation: " & Now.ToLongTimeString
If TimerRefresh.Enabled = False Then
Exit Sub
End If
If bwBasicData.IsBusy Then
LOGGER.Info("bwBasicData is busy - no Refreshing")
Exit Sub
End If
If Application.OpenForms().OfType(Of frmValidator).Any Then
Exit Sub
End If
If Application.OpenForms().OfType(Of frmAdministration).Any Then
Exit Sub
End If
If Application.OpenForms().OfType(Of frmAdmin2).Any Then
Exit Sub
End If
If GridControl_Docs.Visible = True And formopenClose = False Then RefreshHelper.LoadViewInfo()
Handling_DEBUG_USER()
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
' oUpdate = $"UPDATE TBPM_PROFILE_FILES SET IN_WORK = 0, WORK_USER = NULL, IN_WORK_WHEN = NULL where UPPER(WORK_USER) = UPPER('{USER_USERNAME}')"
' ClassDatabase.Execute_non_Query(oUpdate)
' Catch ex As Exception
' LOGGER.Warn($"Unexpected Error in freefileforUser [{oUpdate}] - {ex.Message}")
' End Try
'End If
If bwSync.IsBusy Then
Exit Sub
End If
Try
SaveGridLayout()
'bwSync.ReportProgress(10)
LoadNavBar()
'bwSync.ReportProgress(60)
Dim oStopWatch As New RefreshHelper.SW("Decide_Load")
Decide_Load()
oStopWatch.Done()
'bwSync.ReportProgress(95)
If USER_LANGUAGE <> "de-DE" Then
bsilastsync.Caption = "Last Client-Sync: " & Now.ToLongTimeString
Else
bsilastsync.Caption = "Letzte Synchronisation: " & Now.ToLongTimeString
End If
If GridControl_Docs.Visible = True And formopenClose = False Then RefreshHelper.LoadViewInfo()
Handling_DEBUG_USER()
Catch ex As Exception
LOGGER.Error(ex)
End Try
Catch ex As Exception
LOGGER.Error(ex)
End Try
'BarEditItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
'' call this method to start your asynchronous Task.
'bwSync.RunWorkerAsync()
@@ -853,14 +859,20 @@ Public Class frmMain
End Sub
Private Sub TimerReminder_Tick(sender As Object, e As EventArgs) Handles TimerReminder.Tick
If Application.OpenForms().OfType(Of frmValidator).Any Then
Exit Sub
End If
Try
If Application.OpenForms().OfType(Of frmValidator).Any Then
Exit Sub
End If
If CURR_DT_OVERVIEW.Rows.Count > 0 Then
Dim oMessage As String = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("App.ReminderPipeline")
NotifyIcon1.ShowBalloonTip(30000, $"Reminder {ADDITIONAL_TITLE}", oMessage, ToolTipIcon.Info)
End If
Catch ex As Exception
LOGGER.Warn($"Error TimerReminder: {ex.Message}")
End Try
If CURR_DT_OVERVIEW.Rows.Count > 0 Then
Dim oMessage As String = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("App.ReminderPipeline")
NotifyIcon1.ShowBalloonTip(30000, $"Reminder {ADDITIONAL_TITLE}", oMessage, ToolTipIcon.Info)
End If
End Sub
@@ -1837,27 +1849,31 @@ Public Class frmMain
Private Sub Timer5Mins_Tick(sender As Object, e As EventArgs) Handles Timer5Mins.Tick
Try
If Not bwBasicData.IsBusy Then
BarEditItem1.Caption = "Get BasicData"
BarEditItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
bwBasicData.RunWorkerAsync()
End If
If Not bwBasicData.IsBusy Then
BarEditItem1.Caption = "Get BasicData"
BarEditItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
bwBasicData.RunWorkerAsync()
End If
If USER_DEBUG_LOG = True Then
' 'Jetzt de rinsert der Inhalte
If Not IsNothing(LOGCONFIG.Logs) Then
If LOGCONFIG.Logs.Count > 0 Then
' Dim odel = $"delete from TBPM_LOG_DEBUG where userid = {USER_ID}"
' ClassDatabase.Execute_non_Query(odel)
If USER_DEBUG_LOG = True Then
' 'Jetzt de rinsert der Inhalte
If Not IsNothing(LOGCONFIG.Logs) Then
If LOGCONFIG.Logs.Count > 0 Then
' Dim odel = $"delete from TBPM_LOG_DEBUG where userid = {USER_ID}"
' ClassDatabase.Execute_non_Query(odel)
Dim thread As New Thread(AddressOf DebuglogBackgroundthread)
thread.Start()
Dim thread As New Thread(AddressOf DebuglogBackgroundthread)
thread.Start()
End If
End If
End If
End If
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