Skip to content

Commit

Permalink
Common: thread check MessageShowAgain
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Oct 25, 2022
1 parent 5a8243d commit 0bdf82f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;

namespace MissionPlanner
Expand Down Expand Up @@ -283,7 +284,18 @@ public static DialogResult MessageShowAgain(string title, string promptText, boo

ThemeManager.ApplyThemeTo(form);

DialogResult dialogResult = form.ShowDialog();
DialogResult dialogResult = DialogResult.Cancel;
if (Application.OpenForms.Count > 0)
{
if (Application.OpenForms[0].InvokeRequired)
Application.OpenForms[0].Invoke(new Action(() => { dialogResult = form.ShowDialog(); }));
else
dialogResult = form.ShowDialog();
}
else
{
dialogResult = form.ShowDialog();
}

form.Dispose();

Expand Down

0 comments on commit 0bdf82f

Please sign in to comment.