public void Stop()
{
#region Require
if (this.disposed)
{
throw new ObjectDisposedException("Timer");
}
#endregion
#region Guard
if (!this.running)
{
return;
}
#endregion
// Stop and destroy timer.
int result = timeKillEvent(this.timerID);
Debug.Assert(result == TIMERR_NOERROR);
this.running = false;
if (this.SynchronizingObject != null && this.SynchronizingObject.InvokeRequired)
{
this.SynchronizingObject.BeginInvoke(
new EventRaiser(this.OnStopped),
new object[] { EventArgs.Empty });
}
else
{
this.OnStopped(EventArgs.Empty);
}
}