Skip to content

Commit 58de517

Browse files
authored
Merge pull request #108 from Zaprit/fix-crash-on-mac
Put Eto Ask MessageBox in UI thread
2 parents ebfda18 + 6e8a77b commit 58de517

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Refresher/EtoPlatformInterface.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,14 @@ public override void ErrorPrompt(string prompt)
4545

4646
public override QuestionResult Ask(string question)
4747
{
48+
4849
State.Logger.LogInfo(Platform, $"Asking user '{question}'...");
49-
DialogResult result = MessageBox.Show(question, "Refresher", MessageBoxButtons.YesNo, MessageBoxType.Question);
50+
DialogResult result = DialogResult.None;
51+
Application.Instance.Invoke(() =>
52+
{
53+
result = MessageBox.Show(question, "Refresher", MessageBoxButtons.YesNo, MessageBoxType.Question);
54+
});
55+
5056
// ReSharper disable once SwitchExpressionHandlesSomeKnownEnumValuesWithExceptionInDefault
5157
State.Logger.LogInfo(Platform, $"User answered {result.ToString()}");
5258
return result switch

0 commit comments

Comments
 (0)