/// <summary> /// Counter to countdown the snooze timer in seconds /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void timer_Snooze_Tick(object sender, EventArgs e) { //counter increments until it hits the set snooze time if (_counter < int.Parse(snzText.Text)) { _counter++; } //once time it shows the alarm message box to stop/reset snooze else { timer_Snooze.Stop(); _counter = 0; AlarmMessageBox message = new AlarmMessageBox(timer_Snooze); message.Show(); } }
/// <summary> /// Activate message box if the alarm is checked off /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void alarm_Elapsed(object sender, EventArgs e) { int t = 0; //Checks the time for all checked elements for the alarm clock while (t < cbAlarm.CheckedItems.Count) { //if the alarm time is equal to the current time string alarm = cbAlarm.CheckedItems[t].ToString(); if (alarm == DateTime.Now.ToString()) { //creates new message box which passes in the snooze timer AlarmMessageBox message = new AlarmMessageBox(timer_Snooze); message.Show(); } t++; } }