A timer is being used in my C# application to determine if an expected event has occured in a timely fassion. This is how I am currently attempting to do this:
// At some point in the application where the triggering event has just occured.
// Now, the expected event should happen within the next second.
timeout = false;
timer1.Interval = 1000; // Set timeout for 1 second.
timer1.Start();
timer1_Tick(object sender, EventArgs e)
{
timeout = true;
}
// At some point in the application where the expected event has occured.
timer1.Stop();
// At a later point in the application where the timeout is
// checked, before procedding.
if ( timeout )
{
// Do something.
}
Now, what I am wondering is when the Start()
or Stop()
member methods are called, does that cause the timer count to reset? I am using Microsoft Visual C# 2008 Express Edition. Thanks.