Compare commits

..

No commits in common. "80e35223e04ee08d3b40412303c0243fee19dcba" and "fe2499707d7689149442dc89ba794f74266fcebd" have entirely different histories.

4 changed files with 43 additions and 72 deletions

View File

@ -1 +1 @@
1.2.1.2
1.2.0.0

View File

@ -8,8 +8,8 @@
<SignAssembly>True</SignAssembly>
<StartupObject>BreCalClient.App</StartupObject>
<AssemblyOriginatorKeyFile>..\..\misc\brecal.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>1.2.1.2</AssemblyVersion>
<FileVersion>1.2.1.2</FileVersion>
<AssemblyVersion>1.2.0.10</AssemblyVersion>
<FileVersion>1.2.0.0</FileVersion>
<Title>Bremen calling client</Title>
<Description>A Windows WPF client for the Bremen calling API.</Description>
<ApplicationIcon>containership.ico</ApplicationIcon>

View File

@ -38,8 +38,7 @@ namespace BreCalClient
#region Fields
//private static int _uiUpdateRunning = 0;
private static SemaphoreSlim uiLock = new SemaphoreSlim(1);
private static int _uiUpdateRunning = 0;
private Credentials? _credentials;
@ -98,10 +97,9 @@ namespace BreCalClient
var jitterer = new Random();
var retryPolicy =
// Policy.Handle<HttpRequestException>()
Policy.HandleResult<RestSharp.RestResponse>(resp => resp.StatusCode == HttpStatusCode.Unauthorized)
//.OrResult<RestSharp.RestResponse>
.WaitAndRetryAsync(1,
Policy.Handle<HttpRequestException>()
.OrResult<RestSharp.RestResponse>(resp => resp.StatusCode == HttpStatusCode.Unauthorized)
.WaitAndRetryAsync(3,
retryAttempt =>
{
var calculatedDelayInMilliseconds = Math.Pow(2, retryAttempt) * 1000;
@ -116,7 +114,6 @@ namespace BreCalClient
Trace.WriteLine("token refreshed");
});
RetryConfiguration.AsyncRetryPolicy = retryPolicy;
this.generalProgressStatus.Maximum = PROGRESS_STEPS;
}
@ -238,7 +235,7 @@ namespace BreCalClient
NewWithModel(null);
}
private async void NewWithModel(ShipcallControlModel? model)
private void NewWithModel(ShipcallControlModel? model)
{
EditShipcallControl esc = new()
{
@ -253,9 +250,7 @@ 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)
@ -349,12 +344,10 @@ namespace BreCalClient
this.FilterShipcalls();
}
private async void SearchFilterControl_SearchFilterChanged()
private void SearchFilterControl_SearchFilterChanged()
{
this.FilterShipcalls();
await uiLock.WaitAsync();
this.UpdateUI();
uiLock.Release();
}
private void checkboxShowCancelledCalls_Checked(object sender, RoutedEventArgs e)
@ -363,13 +356,11 @@ namespace BreCalClient
this.SearchFilterControl_SearchFilterChanged();
}
private async void comboBoxSortOrder_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
private 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)
@ -454,7 +445,6 @@ namespace BreCalClient
{
labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}";
labelLatestUpdate.Text = $"Last update: {DateTime.Now.ToLongTimeString()}";
labelStatusBar.Text = "";
generalProgressStatus.Value = 0;
}));
}
@ -472,9 +462,6 @@ namespace BreCalClient
}
}
try
{
if (shipcalls != null)
{
foreach (Shipcall shipcall in shipcalls)
@ -482,7 +469,7 @@ namespace BreCalClient
// load times for each shipcall
List<Times> currentTimes = await _timesApi.TimesGetAsync(shipcall.Id);
if (!_allShipcallsDict.ContainsKey(shipcall.Id))
if(!_allShipcallsDict.ContainsKey(shipcall.Id))
{
// add entry
ShipcallControlModel scm = new()
@ -512,28 +499,12 @@ namespace BreCalClient
}
this.FilterShipcalls();
await uiLock.WaitAsync();
this.UpdateUI();
}
}
catch(Exception ex)
{
_log.Error(ex);
}
finally
{
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));
System.Diagnostics.Trace.WriteLine("restarting refresh countdown");
for (int i = 0; i < PROGRESS_STEPS; i++)
{
await Task.Delay(TimeSpan.FromSeconds(interval), _tokenSource.Token);
@ -791,7 +762,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
{
@ -811,7 +782,7 @@ namespace BreCalClient
}
finally
{
// _uiUpdateRunning = 0;
_uiUpdateRunning = 0;
}
Mouse.OverrideCursor = null;

View File

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<ApplicationRevision>10</ApplicationRevision>
<ApplicationVersion>1.2.1.2</ApplicationVersion>
<ApplicationVersion>1.2.0.10</ApplicationVersion>
<BootstrapperEnabled>False</BootstrapperEnabled>
<Configuration>Release</Configuration>
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>