OverlayAktualisierung im frmMain

This commit is contained in:
Developer01
2026-07-01 15:48:13 +02:00
parent 744199dbbc
commit a2e5d1c136

View File

@@ -1335,9 +1335,7 @@ Public Class frmMain
End Sub End Sub
Private Async Sub TimerRefresh_Tick(sender As System.Object, e As EventArgs) Handles TimerRefresh.Tick Private Async Sub TimerRefresh_Tick(sender As System.Object, e As EventArgs) Handles TimerRefresh.Tick
Try Try
If TimerRefresh.Enabled = False Then If TimerRefresh.Enabled = False Then Exit Sub
Exit Sub
End If
If bwBasicData.IsBusy Then If bwBasicData.IsBusy Then
LOGGER.Info("backGroundWorker BasicData in Action - no Client-Sync") LOGGER.Info("backGroundWorker BasicData in Action - no Client-Sync")
bsiMessage.Caption = "bwBasicData is busy - no Refreshing" bsiMessage.Caption = "bwBasicData is busy - no Refreshing"
@@ -1348,7 +1346,7 @@ Public Class frmMain
TimerRefresh_running = True TimerRefresh_running = True
' Cancel Refresh if a Validator Form or an Admin Form is opened ' Cancel Refresh if Validator/Admin Form is opened
If Application.OpenForms().OfType(Of frmMassValidator).Any() Or If Application.OpenForms().OfType(Of frmMassValidator).Any() Or
Application.OpenForms().OfType(Of frmValidator).Any() Or Application.OpenForms().OfType(Of frmValidator).Any() Or
Application.OpenForms().OfType(Of frmAdministration).Any() Or Application.OpenForms().OfType(Of frmAdministration).Any() Or
@@ -1356,7 +1354,11 @@ Public Class frmMain
Exit Sub Exit Sub
End If End If
'bsilastsync.Caption = $"{ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("CaptLastSync")}: " & Now.ToLongTimeString ' ✅ Prüfung ob Fenster aktiv ist
Dim isWindowActive As Boolean = (Me.ContainsFocus OrElse Me Is Form.ActiveForm)
If isWindowActive Then
' ====== FENSTER IST AKTIV → MIT Overlay ======
bsilastsync.Caption = String.Format(S.Letzte_Synchronisation___0_, Now.ToLongTimeString) bsilastsync.Caption = String.Format(S.Letzte_Synchronisation___0_, Now.ToLongTimeString)
If GridControlWorkflows.Visible = True And FormOpenClose = False Then If GridControlWorkflows.Visible = True And FormOpenClose = False Then
@@ -1369,29 +1371,35 @@ Public Class frmMain
End If End If
Try Try
'bwSync.ReportProgress(10)
LoadNavBar() LoadNavBar()
'bwSync.ReportProgress(60)
Dim oStopWatch As New RefreshHelper.SW("Decide_Load") Dim oStopWatch As New RefreshHelper.SW("Decide_Load")
Await Decide_Load(False) Await Decide_Load(False, ForceReload:=False, AllowOverlay:=True) ' ✅ Overlay ERLAUBT
oStopWatch.Done() oStopWatch.Done()
'bwSync.ReportProgress(95)
If GridControlWorkflows.Visible = True And FormOpenClose = False Then RefreshHelper.LoadViewInfo() If GridControlWorkflows.Visible = True And FormOpenClose = False Then
RefreshHelper.LoadViewInfo()
End If
Handling_DEBUG_USER() Handling_DEBUG_USER()
Catch ex As Exception Catch ex As Exception
LOGGER.Error(ex) LOGGER.Error(ex)
End Try End Try
Else
' ====== FENSTER IST INAKTIV → OHNE Overlay ======
LOGGER.Debug("TimerRefresh: Silent background update (window not active)")
Try
LoadNavBar()
Await Decide_Load(False, ForceReload:=False, AllowOverlay:=False) ' ✅ Overlay VERBOTEN
' KEIN RefreshHelper.LoadViewInfo() → verhindert UI-Flackern
Catch ex As Exception
LOGGER.Error(ex)
End Try
End If
Catch ex As Exception Catch ex As Exception
LOGGER.Error(ex) LOGGER.Error(ex)
End Try End Try
TimerRefresh_running = False TimerRefresh_running = False
'BarEditItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
'' call this method to start your asynchronous Task.
'bwSync.RunWorkerAsync()
End Sub End Sub
Private Sub NotifyIcon1_Click(sender As System.Object, e As EventArgs) Handles NotifyIcon1.Click Private Sub NotifyIcon1_Click(sender As System.Object, e As EventArgs) Handles NotifyIcon1.Click
@@ -1400,10 +1408,14 @@ Public Class frmMain
' ======================================== ' ========================================
' HAUPTLADEMETHODE - Koordiniert den gesamten Ladevorgang ' HAUPTLADEMETHODE - Koordiniert den gesamten Ladevorgang
' ======================================== ' ========================================
Private Async Function Decide_Load(pIsFormLoad As Boolean, Optional ForceReload As Boolean = False) As Tasks.Task Private Async Function Decide_Load(pIsFormLoad As Boolean, Optional ForceReload As Boolean = False, Optional AllowOverlay As Boolean = True) As Tasks.Task
Dim oHandle As Object = Nothing Dim oHandle As Object = Nothing
Dim overlayStartedHere As Boolean = False Dim overlayStartedHere As Boolean = False
If Not _overlayActive Then
' ✅ Overlay nur anzeigen, wenn explizit erlaubt UND Fenster aktiv ist
Dim shouldShowOverlay As Boolean = AllowOverlay AndAlso (Me.ContainsFocus OrElse Me Is Form.ActiveForm)
If shouldShowOverlay AndAlso Not _overlayActive Then
oHandle = SplashScreenManager.ShowOverlayForm(Me) oHandle = SplashScreenManager.ShowOverlayForm(Me)
_overlayActive = True _overlayActive = True
overlayStartedHere = True overlayStartedHere = True
@@ -1481,9 +1493,9 @@ Public Class frmMain
LOGGER.Info("Unexpected error in Decide_load: " & ex.Message) LOGGER.Info("Unexpected error in Decide_load: " & ex.Message)
Finally Finally
FRONTEND_ACTION = FA_NONE FRONTEND_ACTION = FA_NONE
If overlayStartedHere Then If overlayStartedHere AndAlso _overlayActive Then
_overlayActive = False
SplashScreenManager.CloseOverlayForm(oHandle) SplashScreenManager.CloseOverlayForm(oHandle)
_overlayActive = False
End If End If
If refreshWasEnabled Then If refreshWasEnabled Then
TimerRefresh.Start() TimerRefresh.Start()