a while back I ran across a situation where we needed to display message-boxes to the user for notifications but we could not use MessageBox.Show because it blocks the GUI thread (so nothing on the screen gets updated while the dialog is active). Any suggestions on an alternative?
[I coded an alternative at the time but I don't like it. I'll post it as an answer if nothing better appears though]
EDIT: the dialog must float on top of the main window; i don't care if it appears in the taskbar or not. More than one dialog may be active at once in certain circumstances.
ADDENDUM: my solution was a base form that provided OK and CANCEL buttons to emit Completed and Cancelled events; OK called a virtual ValidateData for subclass override. The calling form used properties to avoid recreating the form each time (the form was just hidden instead of closed) and kept a dictionary of active forms to prevent the same form from being activated more than once. This looks like a modal form, supports multiple pop-up forms at once, but does not tie up the main GUI thread.
I agree with rslite and Mitchel Sellers. Creating a non-Modal form to display the information needed is the best route to go. If you have multiple messages, you might want to consider putting them into a ListBox and have the user double-click on them to get the full information needing to be displayed.
I suggest going with a non-modal approach, like others said, but a little more specific:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With