diff --git a/misc/version.txt b/misc/version.txt index cb36e65..b6a8162 100644 --- a/misc/version.txt +++ b/misc/version.txt @@ -1 +1 @@ -1.2.1.0 \ No newline at end of file +1.2.1.1 \ No newline at end of file diff --git a/src/BreCalClient/BreCalClient.csproj b/src/BreCalClient/BreCalClient.csproj index dd0f203..9e5c884 100644 --- a/src/BreCalClient/BreCalClient.csproj +++ b/src/BreCalClient/BreCalClient.csproj @@ -8,8 +8,8 @@ True BreCalClient.App ..\..\misc\brecal.snk - 1.2.1.0 - 1.2.1.0 + 1.2.1.1 + 1.2.1.1 Bremen calling client A Windows WPF client for the Bremen calling API. containership.ico diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index 2494f64..8e40e2d 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -38,7 +38,8 @@ namespace BreCalClient #region Fields - private static int _uiUpdateRunning = 0; + //private static int _uiUpdateRunning = 0; + private static SemaphoreSlim uiLock = new SemaphoreSlim(1); private Credentials? _credentials; @@ -237,7 +238,7 @@ namespace BreCalClient NewWithModel(null); } - private void NewWithModel(ShipcallControlModel? model) + private async void NewWithModel(ShipcallControlModel? model) { EditShipcallControl esc = new() { @@ -252,7 +253,9 @@ namespace BreCalClient // create UI & save new dialog model if (esc.ShipcallModel.Shipcall != null) { + await uiLock.WaitAsync(); this.UpdateUI(); + uiLock.Release(); esc.ShipcallModel.Shipcall?.Participants.Clear(); foreach (ParticipantAssignment pa in esc.ShipcallModel.AssignedParticipants.Values) @@ -346,10 +349,12 @@ namespace BreCalClient this.FilterShipcalls(); } - private void SearchFilterControl_SearchFilterChanged() + private async void SearchFilterControl_SearchFilterChanged() { this.FilterShipcalls(); + await uiLock.WaitAsync(); this.UpdateUI(); + uiLock.Release(); } private void checkboxShowCancelledCalls_Checked(object sender, RoutedEventArgs e) @@ -358,11 +363,13 @@ namespace BreCalClient this.SearchFilterControl_SearchFilterChanged(); } - private void comboBoxSortOrder_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) + private async void comboBoxSortOrder_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { _sortOrder = (Extensions.SortOrder) this.comboBoxSortOrder.SelectedIndex; this.FilterShipcalls(); + await uiLock.WaitAsync(); this.UpdateUI(); + uiLock.Release(); } private void buttonHistory_Click(object sender, RoutedEventArgs e) @@ -502,15 +509,18 @@ namespace BreCalClient } this.FilterShipcalls(); - this.UpdateUI(); + await uiLock.WaitAsync(); + this.UpdateUI(); + uiLock.Release(); } 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)); + + //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++) @@ -770,7 +780,7 @@ namespace BreCalClient this.Dispatcher.Invoke(new Action(() => { - if (Interlocked.CompareExchange(ref _uiUpdateRunning, 1, 0) == 1) return; + //if (Interlocked.CompareExchange(ref _uiUpdateRunning, 1, 0) == 1) return; try { @@ -790,7 +800,7 @@ namespace BreCalClient } finally { - _uiUpdateRunning = 0; + // _uiUpdateRunning = 0; } Mouse.OverrideCursor = null; diff --git a/src/BreCalClient/Properties/PublishProfiles/ClickOnceProfile.pubxml b/src/BreCalClient/Properties/PublishProfiles/ClickOnceProfile.pubxml index 8091412..c8a52ab 100644 --- a/src/BreCalClient/Properties/PublishProfiles/ClickOnceProfile.pubxml +++ b/src/BreCalClient/Properties/PublishProfiles/ClickOnceProfile.pubxml @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 10 - 1.2.1.0 + 1.2.1.1 False Release True