private void OnAlarm(InfoAboutTimer e) { EventHandler<InfoAboutTimer> temp = Alarm; if (temp != null) Alarm(this, e); }
public void StartTimer() { if (countdown > 0) { InfoAboutTimer info = new InfoAboutTimer(DateTime.Now); Thread.Sleep(countdown); OnAlarm(info); ResetTimer(); } }
private void ProcessingEventAlarmClassOven(object sender, InfoAboutTimer e) { Console.WriteLine("The timer is completed!"); Console.WriteLine("Your food is ready, Sir!"); }
private void ProcessingEventAlarmClassWashingMachine(object sender, InfoAboutTimer e) { Console.WriteLine("The timer is completed!"); Console.WriteLine("Things washed!"); Console.WriteLine("Now you will find the Ironing)"); }
private void ProcessingEventAlarmClassAlarmClock(object sender, InfoAboutTimer e) { TimeSpan time = DateTime.Now - e.dt; Console.WriteLine("{0:D}:{1:D}:{2:D} - passed since start of timer", time.Hours, time.Minutes, time.Seconds); }