I need to accomplish the following scenario. ThreadMethod() is a Timer method, where I have UI update in the Invoke statement. I need to wait till the Invoke finish its work, and then continue the method. How can I cope with this?
public void ThreadMethod(){
//do some work
this.Invoke((MethodInvoker)delegate
{
//do some GUI update
});
//wait till Invoke finish its work
}
You don't need to do anything. Invoke (unlike BeginInvoke) will block until the scheduled delegate has finished executing.
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