Exemple #1
0
 private void btn_cancel_Click(object sender, EventArgs e)
 {
     timer_alarm.Stop();
     Melody.Melody1_stop();
     Melody.Melody2_stop();
     rb_alarm1.Checked  = false;
     rb_alarm2.Checked  = false;
     lbl_status.Visible = true;
     lbl_status.Text    = "Status: Alarm is Canceled!";
 }
Exemple #2
0
 public static void waiting5_2()
 {
     Melody.Melody2_stop();
     System.Threading.Thread.Sleep(5000);
 }
Exemple #3
0
        //Alarm2 is for Melody2
        public void Alarm2()
        {
            //Yes==Dismiss && No=Snooze
            Melody.Melody2_play();
            string            message = "Do you want to close the alarm?";
            string            title   = "Close Window";
            MessageBoxButtons button  = MessageBoxButtons.YesNo;
            DialogResult      result  = MessageBox.Show(message, title, button, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                Melody.Melody2_stop();
            }
            else
            {
                if (cb_snooze.SelectedIndex == cb_snooze.FindStringExact("3 seconds"))
                {
                    waiting3_2();
                    for (; ;)
                    {
                        Melody.Melody2_play();
                        MessageBoxButtons button1 = MessageBoxButtons.YesNo;
                        DialogResult      result1 = MessageBox.Show(message, title, button1, MessageBoxIcon.Question);
                        if (result1 == DialogResult.Yes)
                        {
                            Melody.Melody2_stop();
                            break;
                        }
                        else
                        {
                            waiting3_2();
                        }
                    }
                }
                else if (cb_snooze.SelectedIndex == cb_snooze.FindStringExact("5 seconds"))
                {
                    waiting5_2();
                    for (; ;)
                    {
                        Melody.Melody2_play();
                        MessageBoxButtons button1 = MessageBoxButtons.YesNo;
                        DialogResult      result1 = MessageBox.Show(message, title, button1, MessageBoxIcon.Question);
                        if (result1 == DialogResult.Yes)
                        {
                            Melody.Melody2_stop();
                            break;
                        }
                        else
                        {
                            waiting5_2();
                        }
                    }
                }
                else if (cb_snooze.SelectedIndex == cb_snooze.FindStringExact("7 seconds"))
                {
                    waiting7_2();
                    for (; ;)
                    {
                        Melody.Melody2_play();
                        MessageBoxButtons button1 = MessageBoxButtons.YesNo;
                        DialogResult      result1 = MessageBox.Show(message, title, button1, MessageBoxIcon.Question);
                        if (result1 == DialogResult.Yes)
                        {
                            Melody.Melody2_stop();
                            break;
                        }
                        else
                        {
                            waiting7_2();
                        }
                    }
                }
            }
        }