Catch exceptions on history updates
This commit is contained in:
parent
c705b4396f
commit
3579d779e8
@ -4,6 +4,8 @@
|
||||
|
||||
using BreCalClient.misc.Api;
|
||||
using BreCalClient.misc.Model;
|
||||
using log4net;
|
||||
using log4net.Core;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@ -22,6 +24,7 @@ namespace BreCalClient
|
||||
|
||||
private readonly ConcurrentDictionary<int, ShipcallControlModel> _shipcalls;
|
||||
private readonly StaticApi _staticApi;
|
||||
private readonly static ILog _log = LogManager.GetLogger(typeof(HistoryDialog));
|
||||
|
||||
#endregion
|
||||
|
||||
@ -68,8 +71,9 @@ namespace BreCalClient
|
||||
private async void RefreshHistory()
|
||||
{
|
||||
List<History> allHistories = new();
|
||||
this.stackPanel.Children.Clear();
|
||||
|
||||
try
|
||||
{
|
||||
foreach (int shipcall_id in _shipcalls.Keys)
|
||||
{
|
||||
List<History> shipcallHistory = await _staticApi.HistoryGetAsync(shipcall_id);
|
||||
@ -77,6 +81,8 @@ namespace BreCalClient
|
||||
allHistories.AddRange(shipcallHistory);
|
||||
}
|
||||
|
||||
this.stackPanel.Children.Clear();
|
||||
|
||||
// sort all entries
|
||||
allHistories.Sort((x, y) => { return y.Timestamp.CompareTo(x.Timestamp); });
|
||||
|
||||
@ -107,6 +113,14 @@ namespace BreCalClient
|
||||
}
|
||||
|
||||
Mouse.OverrideCursor = null;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Here we rather not show a dialog box since it may confuse the user
|
||||
_log.Error(e.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool FilterShipcall(int shipcallId)
|
||||
|
||||
@ -38,7 +38,7 @@ namespace BreCalClient
|
||||
|
||||
#region Fields
|
||||
|
||||
private static Int32 _uiUpdateRunning = 0;
|
||||
private static int _uiUpdateRunning = 0;
|
||||
|
||||
private Credentials? _credentials;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user