Accesing timer from other thread
-
Hello. I have a windows forms application that has some timers. One of these timers has a tick event that raises another thread to continue with the application. I did that because the next operations include listening to a socket, and the UI gets blocked. The problem is that in some occasions, I need to reactivate the timer, but it is not raised. I think it's because it's called from another thread. Any way to solve that?
Regards, Diego F.
-
Hello. I have a windows forms application that has some timers. One of these timers has a tick event that raises another thread to continue with the application. I did that because the next operations include listening to a socket, and the UI gets blocked. The problem is that in some occasions, I need to reactivate the timer, but it is not raised. I think it's because it's called from another thread. Any way to solve that?
Regards, Diego F.
What you need is Control.Invoke[^]. Robert
-
What you need is Control.Invoke[^]. Robert
-
Something like this should work:
timer.Invoke(new MethodInvoker(timer.Start));
Robert