Interface ITimerService
Provides methods for starting and stopping timers.
public interface ITimerService
- Extension Methods
Methods
Delay(Action<IServiceProvider>, TimeSpan)
Starts a timer with the specified action which will tick only once after the specified delay.
TimerReference Delay(Action<IServiceProvider> action, TimeSpan delay)
Parameters
actionAction<IServiceProvider>The action perform at the ticker
delayTimeSpanThe delay after which the timer will tick.
Returns
- TimerReference
A reference to the started timer
Start(Action<IServiceProvider, TimerReference>, TimeSpan)
Starts a timer with the specified interval and action.
TimerReference Start(Action<IServiceProvider, TimerReference> action, TimeSpan interval)
Parameters
actionAction<IServiceProvider, TimerReference>The action to perform each timer tick.
intervalTimeSpanThe interval at which to tick.
Returns
- TimerReference
A reference to the started timer.
Start(Action<IServiceProvider>, TimeSpan)
Starts a timer with the specified interval and action.
TimerReference Start(Action<IServiceProvider> action, TimeSpan interval)
Parameters
actionAction<IServiceProvider>The action to perform each timer tick.
intervalTimeSpanThe interval at which to tick.
Returns
- TimerReference
A reference to the started timer.
Stop(TimerReference)
Stops the specified timer.
void Stop(TimerReference timer)
Parameters
timerTimerReferenceThe timer to stop.