Add Utils.RunBackground

This commit is contained in:
2023-03-09 23:02:54 +01:00
parent 54ba861b0e
commit 483657911d
4 changed files with 18 additions and 12 deletions

View File

@ -46,6 +46,16 @@ namespace WGneu {
return a.Select(ch => ch - '0').Aggregate((sum, n) => (sum * 10 + n) % b);
}
public static void RunBackground(string title, Func<Task> a) {
Task.Run(async () => {
try {
await a();
} catch (Exception e) {
MessageBox.Show(e.ToString(), title, MessageBoxButton.OK, MessageBoxImage.Error);
}
});
}
public sealed class TemporaryFile : IDisposable {
private int Usages = 0;
public string FilePath { get; private set; }