mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +00:00
Made MessageBox always use UI thread
This commit is contained in:
parent
9f300f940e
commit
5e145ae2be
1 changed files with 16 additions and 3 deletions
|
|
@ -14,10 +14,23 @@ namespace Cosmos.VS.DebugEngine
|
||||||
|
|
||||||
public static void MessageBox(string message, string title = "Cosmos Debug Engine")
|
public static void MessageBox(string message, string title = "Cosmos Debug Engine")
|
||||||
{
|
{
|
||||||
ThreadHelper.ThrowIfNotOnUIThread();
|
if (!ThreadHelper.CheckAccess())
|
||||||
|
{
|
||||||
|
ThreadHelper.JoinableTaskFactory.Run(async delegate {
|
||||||
|
// Switch to main thread
|
||||||
|
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
|
||||||
|
|
||||||
|
|
||||||
|
VsShellUtilities.ShowMessageBox(ServiceProvider.GlobalProvider, message, title,
|
||||||
|
OLEMSGICON.OLEMSGICON_NOICON, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
VsShellUtilities.ShowMessageBox(ServiceProvider.GlobalProvider, message, title,
|
VsShellUtilities.ShowMessageBox(ServiceProvider.GlobalProvider, message, title,
|
||||||
OLEMSGICON.OLEMSGICON_NOICON, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
|
OLEMSGICON.OLEMSGICON_NOICON, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue