Hi I am testing some stuff for my program, everytime a test is complete a new Message Box should show. The problem is that only a new Message Box will open after I closed the Message Box before that. I tried putting the Message Box into a new Task, but that did not work either...
Task.Run(() => System.Windows.MessageBox.Show(
dirs[directory] + " is done, it took " + stopwatch.Elapsed,
"Done with " + dirs[directory],
System.Windows.MessageBoxButton.OK,
System.Windows.MessageBoxImage.Information,
System.Windows.MessageBoxResult.OK,
System.Windows.MessageBoxOptions.ServiceNotification));
I also tried to make the method async and await Task.Run, no luck there too
await Task.Run(() => System.Windows.MessageBox.Show(
dirs[directory] + " is done, it took " + stopwatch.Elapsed,
"Done with " + dirs[directory],
System.Windows.MessageBoxButton.OK,
System.Windows.MessageBoxImage.Information,
System.Windows.MessageBoxResult.OK,
System.Windows.MessageBoxOptions.ServiceNotification));
MessageBox.Show invokes MessageBox function (winuser.h).
On the remarks you can read:
If you create a message box while a dialog box is present, use a handle to the dialog box as the
hWnd
parameter. ThehWnd
parameter should not identify a child window, such as a control in a dialog box.
But you can't get the hWnd
of a message box.
You're better of creating a custom window for this.