Add WPFUi to prevent stuck state

Add Range to TournamentService
Use DataTable to export CSV
DataTable can be ordered on Total
This commit is contained in:
2019-05-31 23:34:34 +02:00
parent 3d73071925
commit 21713fed69
7 changed files with 227 additions and 114 deletions

View File

@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace LaDOSE.DesktopApp.Utils
{
@@ -14,5 +17,30 @@ namespace LaDOSE.DesktopApp.Utils
Application.Current.Dispatcher.BeginInvoke(action);
}
public static void Await(Action function,string message=null)
{
Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
Task tsk = Task.Factory.StartNew(new Action(function));
tsk.ContinueWith(t =>
{
Application.Current.Dispatcher.Invoke(() =>
System.Windows.Input.Mouse.OverrideCursor = null);
MessageBox.Show(t.Exception.InnerException.Message);
},
CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted,
TaskScheduler.FromCurrentSynchronizationContext());
tsk.ContinueWith(task =>
{
if (!string.IsNullOrEmpty(message))
MessageBox.Show(message);
Application.Current.Dispatcher.Invoke(() =>
System.Windows.Input.Mouse.OverrideCursor = null);
});
}
}
}