コード例 #1
0
        private void AlarmTimer_Tick(object sender, EventArgs e)
        {
            if (totalSeconds2 > 0)
            {
                TimeMethod();
                LoadItems();
                totalSeconds2--;
                int      hours2   = totalSeconds2 / 3600;
                int      minutes2 = (totalSeconds2 / 60) % 60;
                int      seconds2 = (totalSeconds2 % 60);
                TimeSpan y        = new TimeSpan(hours2, minutes2, seconds2);
                AlarmBox.Text = y.ToString();
                //AlarmBox.BeginUpdate();
                //AlarmBox.Items.Add(" " + y.ToString());
                //AlarmBox.EndUpdate();
            }
            else
            {
                for (int i = 1; i < 2; i++)
                {
                    Console.Beep();
                }

                AlarmTimer.Stop();
                DialogResult result = (MessageBox.Show(" Put on snooze + 5 min ", " Time * up ", MessageBoxButtons.YesNo, MessageBoxIcon.Question));

                switch (result)
                {
                case DialogResult.Yes:

                    totalSeconds2 = 5 * 60;
                    AlarmTimer.Start();
                    MessageBox.Show(" Added 5 mins ");
                    break;

                case DialogResult.No:
                    break;
                }
            }
        }
コード例 #2
0
 private void ResetBut_Click(object sender, EventArgs e)
 {
     bCurrent_Time           = true;
     Start_StopBut.Text      = "Start/Stop";
     Start_StopBut.BackColor = default(Color);
     Start_StopBut.UseVisualStyleBackColor        = true;
     Start_Stop_Countdown.Text                    = "Start/Stop";
     Start_Stop_Countdown.BackColor               = default(Color);
     Start_Stop_Countdown.UseVisualStyleBackColor = true;
     Current_Time.Visible = true;
     StopurTime.Visible   = false;
     on1 = true;
     on2 = true;
     stopWatch.Reset();
     Start_Stop_Countdown.Enabled = false;
     CountdownTimer.Stop();
     Countdown_Time.ResetText();
     Countdown_Time.Visible = false;
     OmGangBox.Items.Clear();
     AlarmTimer.Stop();
     AlarmBox.Items.Clear();
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: NastyaUSM/AlarmClock
 private void StopButton_Click(object sender, EventArgs e)
 {
     AlarmClockLabel.Text = "";
     AlarmTimer.Stop();
 }