This is just a curious question. Which one is the best way to update UI from another thread. First, this one:
private delegate void MyDelegateMethod();
void
The default Action delegate worked 90% of the time:
private void Log(String value)
{
// Verify that we're on the same thread
if (textBox1.InvokeRequired)
{
// We're not on the same thread - Invoke the UI thread
textBox1.Invoke(new Action(Log), value);
return;
}
// We're on the same thread - Update UI
textBox1.Text += value + "\r\n";
}
private void OnSomethingHappened()
{
Log("Something happened!");
}