Bugfix for update deadlock and increased version to 1.2.1.1

This commit is contained in:
Daniel Schick 2024-05-14 10:48:11 +02:00
parent c5df95625d
commit 97d4fa9faf

View File

@ -38,7 +38,8 @@ namespace BreCalClient
#region Fields
private static Int32 _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,7 +509,9 @@ namespace BreCalClient
}
this.FilterShipcalls();
await uiLock.WaitAsync();
this.UpdateUI();
uiLock.Release();
}
try
@ -765,7 +774,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
{
@ -785,7 +794,7 @@ namespace BreCalClient
}
finally
{
_uiUpdateRunning = 0;
// _uiUpdateRunning = 0;
}
Mouse.OverrideCursor = null;