From cc743cd6024ecf8a18af6595ff86dbeaaf8339e3 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Mon, 13 May 2024 17:18:47 +0200 Subject: [PATCH] Bugfix: Only continue on refresh timer if ui Update has been completed --- src/BreCalClient/MainWindow.xaml.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index e707445..40a85f3 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -505,6 +505,11 @@ namespace BreCalClient try { double interval = (double) SHIPCALL_UPDATE_INTERVAL_SECONDS / PROGRESS_STEPS; + + if (Interlocked.CompareExchange(ref _uiUpdateRunning, 1, 0) == 1) // do not restart progress unless UI update has completed + await Task.Delay(TimeSpan.FromSeconds(interval)); + + System.Diagnostics.Trace.WriteLine("restarting refresh countdown"); for (int i = 0; i < PROGRESS_STEPS; i++) { await Task.Delay(TimeSpan.FromSeconds(interval), _tokenSource.Token);