public void Alarm() { TickEventArgs args = new TickEventArgs() { Time = DateTime.Now }; TimeSpan span; while (true) { onTick(this, args); System.Threading.Thread.Sleep(1000); span = alarmTime.Subtract(args.Time); if (span.TotalSeconds < 1 && span.TotalSeconds > 0) { onAlarm(this, args); } } }
public void ringing(object sender, TickEventArgs args) { Console.WriteLine("Ringing now!"); }
public void show(object sender, TickEventArgs args) { Console.WriteLine("Tick:" + args.Time.ToString("T")); }
public void addTime(object sender, TickEventArgs args) { args.Time = DateTime.Now; }