I use a timer initialized like this:
timer = new System.Windows.Forms.Timer
{
Interval = monitorConfig.Interval
};
timer.Tick += Timer_Tick;
In Timer_Tick
event, after a certain condition I stop ther timer with
timer.Stop();
I do some stuff then i try to restart the timer after a delay like this:
var cancellationTokenSource = new CancellationTokenSource();
var cancellationToken = cancellationTokenSource.Token;
Task.Delay(timerDelay).ContinueWith((t) =>
{
logger.Info("Starting Timer");
timer.Start();
}, cancellationToken);
But the timer does not restart I must be missing something Thank you for your help