private void SecondsCounter(object sender, TimerEventArgs e) { if (e.Seconds > 0) { this.SecondsLeft--; } else { this.timer.Stop(); this.timer.Enabled = false; this.timer.Dispose(); this.Alarm?.Invoke(this, new TimerEventArgs(this.alarmPeriod)); } }
private static void Alarm(object sender, TimerEventArgs e) { Console.WriteLine("Time's up - exiting"); Console.Beep(); isrunning = false; }
private static void DisplayCountDown(object sender, TimerEventArgs e) { Console.WriteLine(e.Seconds); }