예제 #1
0
        public int CalculateTime()
        {
            int milliseconds = 0;

            try
            {
                if (TimeType == TimeType.Countdown)
                {
                    milliseconds = TimeInterpreter.InterpretCountdown(TimeFormat.Text);
                }
                else if (TimeType == TimeType.Time)
                {
                    milliseconds = TimeInterpreter.InterpretTime(TimeFormat.Text);
                }
                else
                {
                    MessageBox.Show("Choose timer type");
                }
            }
            catch (FormatException exception)
            {
                MessageBox.Show("Incorrect time format");
                Console.WriteLine(exception);
            }

            return(milliseconds);
        }
예제 #2
0
 private void AddTen_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         if (AddTen.Text == "+10")
         {
             AddTen.Text = "+1";
         }
         else
         {
             AddTen.Text = "+10";
         }
     }
     else if (e.Button == MouseButtons.Left)
     {
         try
         {
             if (AddTen.Text == "+10" && Control.ModifierKeys == Keys.Control)
             {
                 TimeInterpreter.addTime(-10, TimeType, TimeFormat);
             }
             else if (AddTen.Text == "+10")
             {
                 TimeInterpreter.addTime(10, TimeType, TimeFormat);
             }
             else if (AddTen.Text == "+1" && Control.ModifierKeys == Keys.Control)
             {
                 TimeInterpreter.addTime(-1, TimeType, TimeFormat);
             }
             else if (AddTen.Text == "+1")
             {
                 TimeInterpreter.addTime(1, TimeType, TimeFormat);
             }
         }
         catch (FormatException exception)
         {
             MessageBox.Show("Incorrect time format");
             Console.WriteLine(exception);
         }
     }
 }
예제 #3
0
        private void showStatusBalloon()
        {
            ShutdownType s = mainInterface1.ShutdownType;

            notifyIcon1.BalloonTipText = "Time remaining to " + s.ToString() + ": " + TimeInterpreter.TimeRemaining(shutdown.ShutdownTimer.Interval, tick);
            notifyIcon1.ShowBalloonTip(500);
        }
예제 #4
0
 private void visual_Tick(object sender, EventArgs e)
 {
     mainInterface1.statusLabel.Text = TimeInterpreter.TimeRemaining(shutdown.ShutdownTimer.Interval, tick);
     tick++;
 }