Do I need to call MessageBox calls?

To pop up a message box, I use MessageBox.Show(...). I usually make a call in Invoke:

BeginInvoke (new Action (() => {
    MessageBox.Show ());
}));

(I deleted part of the original question that was answered elsewhere )

Do I always need to wrap a MessageBox call in (Begin -) Invokeif I call from a thread without a GUI?

+5
source share
2 answers

Short answer: yes, because I consider this to be best practice.

Longer answer:

, , , . , "" " ", , , GUI , - ( BeginInvoke (EventRaiserMethod (params))).

+1
  • , , MessageBox.Show, .
    , , MessageBox.Show , .
    - , , -
  • , msgbox.
0

All Articles