P
Peter Johnsson
How come the eventhandler for the timer's elapsed time event is called over
and over again, even though the AutoReset property is set to false, if you
assign a new value to the timer objects interval property inside the event
handler?
Example follows:
Constructor:
mTimer = new System.Timers.Timer(20000);
mTimer.AutoReset = false;
mTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimerEvent);
OnTimerEvent(...):
mTimer.Interval = 10000;
As soon as the timer is started, it will start its countdown and then
finally call the eventhandler, but it will continue doing so forever just
because I'm assigning a new value to its interval property inside the
handler.
// Curious
and over again, even though the AutoReset property is set to false, if you
assign a new value to the timer objects interval property inside the event
handler?
Example follows:
Constructor:
mTimer = new System.Timers.Timer(20000);
mTimer.AutoReset = false;
mTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimerEvent);
OnTimerEvent(...):
mTimer.Interval = 10000;
As soon as the timer is started, it will start its countdown and then
finally call the eventhandler, but it will continue doing so forever just
because I'm assigning a new value to its interval property inside the
handler.
// Curious