Пример #1
0
 void Clock_Alarm(object sender, ClockEventArgs args)
 {
     if (args.CurrentHour == args.SetHour && args.CurrentMinute == args.SetMinute && args.CurrentSecond == args.SetSecond)
     {
         Console.Write("闹钟正在响铃!");
     }
     else
     {
         Console.Write("闹钟未到响铃时刻!");
     }
 }
Пример #2
0
        public void SClick(int Hour, int Minute, int Second)
        {
            Console.Write($"现在是{Hour}时{Minute}分{Second}秒");
            ClockEventArgs args1 = new ClockEventArgs()
            {
                CurrentHour   = Hour,
                CurrentMinute = Minute,
                CurrentSecond = Second
            };

            Alarm(this, args1);
        }
Пример #3
0
        public void Click(int Hour, int Minute, int Second)
        {
            Console.Write($"现在是{Hour}时{Minute}分{Second}秒");
            ClockEventArgs args = new ClockEventArgs()
            {
                CurrentHour   = Hour,
                CurrentMinute = Minute,
                CurrentSecond = Second
            };

            while (true)
            {
                Tick(this, args);
                System.Threading.Thread.Sleep(1000);
            }
        }
Пример #4
0
        public void SClick(int Hour, int Minute, int Second)
        {
            //System.Timers.Timer t = new System.Timers.Timer(1000);


            Console.Write($"现在是{Hour}时{Minute}分{Second}秒");
            ClockEventArgs args1 = new ClockEventArgs()

            {
                CurrentHour   = Hour,
                CurrentMinute = Minute,
                CurrentSecond = Second
            };

            //触发Alarm事件
            Alarm(this, args1);
        }
Пример #5
0
 void Clock_Tick(object sender, ClockEventArgs args)
 {
     Console.Write("闹钟正在走时!");
 }