I got a System.Timers.Timer (Even if Threading.Timer is more powerfull, I need the restart option) which should call an Event(Function) for data exchange. My Timer Init:
private System.Timers.Timer _scheduler; //on class level
_scheduler = new System.Timers.Timer(double.Parse(Config.TimeIntervall));
_scheduler.AutoReset = false;
_scheduler.Elapsed += (o, args) => InterfaceSingleRun();
_scheduler.Start();
The function starts a task, and in the finally statement I got
_scheduler.Start()
to restart my Timer, which should start counting down the intervall again
My Problem: I want to prevent overlapping, because I don't know how long the Task will be running (depends on Server), but the _schedulter.Start() just restarts the Elapsed Event, instead of waiting the intervall time.
Could you please tell me if I just misunderstood the MSDN-Site/the Timer got some issues and how to fix them/or my code is just messed up :)
Thanks
EDIT: Solved the Problem, thanks to Hans Passant. I was working with seconds, which the program interpreted as milliseconds.
Config.TimeIntervallis in seconds instead of milliseconds. - Hans Passant