mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Add alert if database load fails
Task is executed without reporting exceptions; continue after the task with another that checks if it failed.
This commit is contained in:
parent
8778d8c6b7
commit
0eb7bf7a4b
1 changed files with 11 additions and 1 deletions
|
@ -79,7 +79,17 @@ namespace PKHeX.WinForms
|
|||
// Load Data
|
||||
B_Search.Enabled = false;
|
||||
L_Count.Text = "Loading...";
|
||||
new Task(LoadDatabase).Start();
|
||||
var task = new Task(LoadDatabase);
|
||||
task.ContinueWith(z =>
|
||||
{
|
||||
if (!z.IsFaulted)
|
||||
return;
|
||||
Invoke((MethodInvoker)(() => L_Count.Text = "Failed."));
|
||||
if (z.Exception == null)
|
||||
return;
|
||||
WinFormsUtil.Error("Loading database failed.", z.Exception.InnerException ?? new Exception(z.Exception.Message));
|
||||
});
|
||||
task.Start();
|
||||
|
||||
Menu_SearchSettings.DropDown.Closing += (sender, e) =>
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue