Search code examples
c#asynchronoustimerexecution

Force timer's tick (including async behavior)


On my application I have a timer that checks for configuration updates from the server in a few minutes intervals.

The configuration retrieval is a pretty time consuming process, so I want to force the timer's "Tick" event, but I cannot just call the timer_tick(bla,bla,bla) because it will execute synchronously.

Is there a simple way to force the timer to "Tick" (without creating a new thread)? The behavior should "reset" the time-left of the timer (so, if originally the timer was set to 2 minutes interval and 1 minute already past - after forcing the "Tick" - the timer will start counting 2 minutes again)


Solution

  • change it's timeout value.