Batch Editor Alert Fix (#2703)

Running a batch editor job in the same window pops the alert message in incrementing numbers until the window is closed.
This commit is contained in:
ReignOfComputer 2020-02-13 01:58:46 +08:00 committed by GitHub
parent 9f6d234c53
commit fbcbbc7b05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,7 +162,7 @@ private void RunBackgroundWorker()
private void RunBatchEdit(StringInstructionSet[] sets, string source, string destination)
{
editor = new Core.BatchEditor();
bool finished = false; // hack cuz DoWork event isn't cleared after completion
bool finished = false, displayed = false; // hack cuz DoWork event isn't cleared after completion
b.DoWork += (sender, e) =>
{
if (finished)
@ -179,7 +179,8 @@ private void RunBatchEdit(StringInstructionSet[] sets, string source, string des
b.RunWorkerCompleted += (sender, e) =>
{
string result = editor.GetEditorResults(sets);
WinFormsUtil.Alert(result);
if (!displayed) WinFormsUtil.Alert(result);
displayed = true;
FLP_RB.Enabled = RTB_Instructions.Enabled = B_Go.Enabled = true;
SetupProgressBar(0);
};