public Clock(DateTime wakeup, bool snooze = false, int numSnooze = 0, int snoozeInterval = 0) { _info = new AlarmInfo(); _info.Time = DateTime.Now; _e = new AlarmEventArgs(); _e.Time = wakeup; _e.Snooze = snooze; _e.NumSnooze = numSnooze; _e.SnoozeInterval = snoozeInterval; }
private static void AlarmHandler(ref Clock.AlarmInfo info, AlarmEventArgs e) { int count = 0; do { Thread.Sleep(200); Console.WriteLine("Ring..."); count++; } while (count < 4); Console.WriteLine(); Console.WriteLine("Next snooze is in {0} minutes\nWakeup time is set to {1}", e.SnoozeInterval, e.Time); Console.WriteLine(); }
private static void TickHandler(ref Clock.AlarmInfo info, AlarmEventArgs e) { Console.WriteLine("Now {0}", info.Time); }
protected virtual void OnAlarm(AlarmEventArgs e) { AlarmEventHandler handler = AlarmEvent; if (handler != null) { handler(ref _info, e); } }