private void CheckTimers (DateTime now) {
lock (TimerList) {
int count = TimerList.Count;
if (count == 0)
return;
for (int i = 0; i < TimerList.Count; i++) {
Timer timer = (Timer) TimerList [i];
if (timer.Enabled && timer.Expires <= now) {
// Timer ticks:
// - Before MainForm.OnLoad if DoEvents () is called.
// - After MainForm.OnLoad if not.
//
if (in_doevents ||
(Application.MWFThread.Current.Context != null &&
Application.MWFThread.Current.Context.MainForm != null &&
Application.MWFThread.Current.Context.MainForm.IsLoaded)) {
timer.FireTick ();
timer.Update (now);
}
}
}
}
}