diff --git a/src/BreCalClient/MainWindow.xaml b/src/BreCalClient/MainWindow.xaml index 7ec2652..2944ee9 100644 --- a/src/BreCalClient/MainWindow.xaml +++ b/src/BreCalClient/MainWindow.xaml @@ -106,14 +106,16 @@ - + - + + + @@ -140,7 +142,11 @@ - + + + + + diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index a4dd1d3..e2fa72a 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -34,6 +34,7 @@ namespace BreCalClient private readonly ILog _log = LogManager.GetLogger(typeof(MainWindow)); private const int SHIPCALL_UPDATE_INTERVAL_SECONDS = 30; + private const int PROGRESS_STEPS = 50; #region Fields @@ -112,6 +113,7 @@ namespace BreCalClient Trace.WriteLine("token refreshed"); }); RetryConfiguration.AsyncRetryPolicy = retryPolicy; + this.generalProgressStatus.Maximum = PROGRESS_STEPS; } #endregion @@ -403,8 +405,9 @@ namespace BreCalClient this.Dispatcher.Invoke(new Action(() => { - labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}"; - labelGeneralStatus.Text = $"Ok"; + labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}"; + labelLatestUpdate.Text = $"Last update: {DateTime.Now.ToLongTimeString()}"; + generalProgressStatus.Value = 0; })); } catch (Exception ex) @@ -463,7 +466,15 @@ namespace BreCalClient try { - await Task.Delay(TimeSpan.FromSeconds(SHIPCALL_UPDATE_INTERVAL_SECONDS), _tokenSource.Token); + double interval = (double) SHIPCALL_UPDATE_INTERVAL_SECONDS / PROGRESS_STEPS; + for (int i = 0; i < PROGRESS_STEPS; i++) + { + await Task.Delay(TimeSpan.FromSeconds(interval), _tokenSource.Token); + this.Dispatcher.Invoke(new Action(() => + { + this.generalProgressStatus.Value = i; + })); + } } catch(TaskCanceledException) { } }