If I have an instance of a System.Timers.Timer that has a long interval - say 1 minute, how can I find out if it is started without waiting for the Tick?
If Enabled is set to true and AutoReset is set to false , the Timer raises the Elapsed event only once, the first time the interval elapses. If the interval is set after the Timer has started, the count is reset.
Remarks. The Timer component is a server-based timer that raises an Elapsed event in your application after the number of milliseconds in the Interval property has elapsed. You can configure the Timer object to raise the event just once or repeatedly using the AutoReset property.
If a timer is fired on the main thread's run loop, you will probably have a problem with either the timer function or UI operation. For example, suppose you have triggered a timer. There is also a tableView in your app that shows a list to the user and the user is scrolling the table.
Yes, they run in a different thread.
System.Timer.Timer.Enabled
should work, when you call "Start" it sets Enabled to TRUE, "Stop" sets it to FALSE.
if (timer1.Enabled) { // Do Something }
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