private void SetAlarmTimer() { _AlarmTimer.Stop(); _AlarmTimer.ClearJobs(); _AlarmTimer.AddJob(AlarmTime, new TickHandler(_AlarmTimer_Elapsed)); _AlarmTimer.Start(); }
void ItmAlarm_Click(object sender, EventArgs e) { try { _AlarmDialog.SetSchedule(GetSetting("alarm", "Daily|4:30 PM")); if (_AlarmDialog.ShowDialog(this) == DialogResult.OK) { IScheduledItem Item = _AlarmDialog.GetSchedule(); SetSetting("alarm", _AlarmDialog.GetScheduleString()); _AlarmTimer.Stop(); _AlarmTimer.ClearJobs(); _AlarmTimer.AddJob(Item, new TickHandler(AlarmTimer_Elapsed)); _AlarmTimer.Start(); } } catch (Exception ex) { Startup.HandleException(ex); } }