mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 04:18:43 +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")
|
||||
{
|
||||
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);
|
||||
|
||||
VsShellUtilities.ShowMessageBox(ServiceProvider.GlobalProvider, message, title,
|
||||
OLEMSGICON.OLEMSGICON_NOICON, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
VsShellUtilities.ShowMessageBox(ServiceProvider.GlobalProvider, message, title,
|
||||
OLEMSGICON.OLEMSGICON_NOICON, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue