Skip to content

Commit 0bdf82f

Browse files
committedOct 25, 2022
Common: thread check MessageShowAgain
1 parent 5a8243d commit 0bdf82f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed
 

‎Common.cs

+13-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using System.Reflection;
1313
using System.Runtime.InteropServices;
1414
using System.Text.RegularExpressions;
15+
using System.Threading;
1516
using System.Windows.Forms;
1617

1718
namespace MissionPlanner
@@ -283,7 +284,18 @@ public static DialogResult MessageShowAgain(string title, string promptText, boo
283284

284285
ThemeManager.ApplyThemeTo(form);
285286

286-
DialogResult dialogResult = form.ShowDialog();
287+
DialogResult dialogResult = DialogResult.Cancel;
288+
if (Application.OpenForms.Count > 0)
289+
{
290+
if (Application.OpenForms[0].InvokeRequired)
291+
Application.OpenForms[0].Invoke(new Action(() => { dialogResult = form.ShowDialog(); }));
292+
else
293+
dialogResult = form.ShowDialog();
294+
}
295+
else
296+
{
297+
dialogResult = form.ShowDialog();
298+
}
287299

288300
form.Dispose();
289301

0 commit comments

Comments
 (0)
Please sign in to comment.