Reputation: 21521
I am writing a program that manages a bunch of timers.
The user has to start them manually, and is able to get information from each timer, to know the remaining time for example.
I don't want the GUI to freeze, therefore I don't want to have a timer on the main form thread that freezes the whole thing.
So, does the Timer class send the timer on a new thread, or it keeps it on the main UI thread?
Otherwise, should I use a Background Worker to accomplish this?
Upvotes: 2
Views: 289
Reputation: 2206
Depends on the type timer you use, I suggest to read these articles to decide the best for you.
Upvotes: 0
Reputation: 300827
The System.Windows.Forms.Timer
event runs on the UI thread.
Instead you can use a System.Threading.Timer
which runs on a worker thread.
Ref. : Comparing the Timer Classes in the .NET Framework Class Library
Upvotes: 7