コード例 #1
0
        private void OnAlarm(InfoAboutTimer e)
        {
            EventHandler<InfoAboutTimer> temp = Alarm;

            if (temp != null)
                Alarm(this, e);
        }
コード例 #2
0
 public void StartTimer()
 {
     if (countdown > 0)
     {
         InfoAboutTimer info = new InfoAboutTimer(DateTime.Now);
         Thread.Sleep(countdown);
         OnAlarm(info);
         ResetTimer();
     }
 }
コード例 #3
0
 private void ProcessingEventAlarmClassOven(object sender, InfoAboutTimer e)
 {
     Console.WriteLine("The timer is completed!");
     Console.WriteLine("Your food is ready, Sir!");
 }
コード例 #4
0
 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)");
 }
コード例 #5
0
        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);
        }