To pop-up a message box, I'm using MessageBox.Show(...)
. I usually wrap the call in an Invoke:
BeginInvoke (new Action (() => {
MessageBox.Show ());
}));
(I removed a part of the original question which was answered elsewhere)
Do I always need to wrap the MessageBox call in an (Begin-)Invoke
if I'm calling from a non-GUI thread?
Short answer: yes, because I would consider it a best practice.
Longer answer:
You should not get into a situation where you have to ask yourself this question, at least not in the long run. Usually, in a well designed piece of software, you have defined "gateways" between the user interface and the "rest of the world", this would also be the place where you raise the events that notify the GUI that something has to be done (via BeginInvoke(EventRaiserMethod(params))).
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