mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-02 17:46:51 -05: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:
@@ -79,7 +79,17 @@ public SAV_Database(PKMEditor f1, SAVEditor saveditor)
|
||||
// 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) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user