I am trying to show MessageBoxfrom another Threadusing Dispatcher.Invoke.
Has appeared MessageBox. But without clicking OKon a button , MessageBoxI can still control the main window.
I think if there is a way to block the input of the main window before clicking the button OK?
Any help is appreciated.
The code I still have:
void ShowError(String message) //I call this function in another thread
{
if (this.Dispatcher.CheckAccess())
MessageBox.Show(message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
else
{
this.Dispatcher.Invoke(
new Action(() =>
{
MessageBox.Show(message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}));
}
}
source
share