void ClockTick(object sender, ClockEventArgs args) { //while (true) //{ // Console.WriteLine("trick"); // if() //} Console.WriteLine($"Tick...{args.Hour}:{args.Minute}"); }
public void alarm(int h, int m) { //Console.WriteLine("這一波只能說和程序配合的不好"); if (hour == h && minute == m) { ClockEventArgs args = new ClockEventArgs() { Hour = h, Minute = m }; Alarm(this, args); } }
public void tick() { minute++; if (minute > 60) { hour++; minute = 0; } if (hour > 24) { minute = 0; hour = 0; } ClockEventArgs args = new ClockEventArgs() { Hour = hour, Minute = minute }; Tick(this, args); }
void ClockAlarm(object sender, ClockEventArgs args) { Console.WriteLine("Ring...Ring..."); }