Beispiel #1
0
        partial void btnStart(NSObject sender)
        {
            int result;


            if (!Int32.TryParse(this.txtminutes.StringValue, out result))
            {
                NSAlert alert = new NSAlert();
                // Set the style and message text
                alert.AlertStyle  = NSAlertStyle.Informational;
                alert.MessageText = "please input number";
                // Display the NSAlert from the current view
                alert.BeginSheet(View.Window);
            }
            else
            {
                this.TimeLeft      = result * 60;
                this.orignTimeLeft = this.TimeLeft;
            }


            if (SecondTimer.Enabled)
            {
                SecondTimer.Stop();
                mybtnstart.Title   = "Start";
                txtminutes.Enabled = true;
            }
            else
            {
                SecondTimer.Start();
                mybtnstart.Title   = "Stop";
                txtminutes.Enabled = false;
            }
        }
Beispiel #2
0
 private void StopButton_Click(object sender, EventArgs e)
 {
     InputTicks.ReadOnly = false;
     SecondTimer.Stop();
     ShowTicks.Text = string.Empty;
     ShowTicks.Hide();
     Progress.Value = 0;
     Song.Stop();
     MessageBox.Show("Phew... I'm glad you stopped that...\nIt was really starting to tick me off.");
 }
Beispiel #3
0
        private void SecondTimer_Tick(object sender, EventArgs e)
        {
            int minutes = int.Parse(WorkTimeLabel.Text.Substring(0, minChar));
            int seconds = int.Parse(WorkTimeLabel.Text.Substring(minChar + 1));

            if (minutes != 0 || seconds != 0)
            {
                if (seconds != 0)
                {
                    seconds -= 1;
                    if (seconds < 10)
                    {
                        WorkTimeLabel.Text = $"{minutes}:0{seconds}";
                    }
                    else
                    {
                        WorkTimeLabel.Text = $"{minutes}:{seconds}";
                    }
                }
                else
                {
                    seconds            = 59;
                    minutes           -= 1;
                    WorkTimeLabel.Text = $"{minutes}:{seconds}";
                }
            }
            else
            {
                MessageBox.Show("You have completed your work session! For your hard work, have a little break.", "Timeout", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                WorkTimer.Stop();
                SecondTimer.Stop();

                int breakmins = (int)BreakNumericUpDown.Value;
                if (breakmins < 10)
                {
                    breakChar          = 1;
                    WorkTimeLabel.Text = $"{breakmins}:00";
                    breakTimer.Start();
                    //  gameForm.Show();
                }
                else if (breakmins > 10 && breakmins < 99)
                {
                    breakChar          = 2;
                    WorkTimeLabel.Text = $"{breakmins}:00";
                    breakTimer.Start();
                    //gameForm.Show();
                }
                else
                {
                    MessageBox.Show("Stop being lazy! Dont take such a long break.");
                }
            }
        }
Beispiel #4
0
 private void SecondTimer_Tick(object sender, EventArgs e)
 {
     if (NumberOfTicks > 0)
     {
         // Decrease the number of ticks and change the value in ShowTicks
         ShowTicks.Text = (--NumberOfTicks).ToString();
         Progress.Value = NumberOfTicks;
     }
     else
     {
         NumberOfTicks = 0;
         SecondTimer.Stop();
         if (AlarmGo)
         {
             Song.PlayLooping();
         }
         AlarmGo = false;
     }
 }
Beispiel #5
0
        private void startButton_Click(object sender, EventArgs e) //Starts the app.
        {
            if (ProcessesListBox.SelectedItem != null)
            {
                int minutes = (int)WorkNumericUpDown.Value;

                if (minutes < 10)
                {
                    minChar = 1;
                }
                else if (minutes > 10 && minutes < 99)
                {
                    minChar = 2;
                }
                else if (minutes > 99)
                {
                    minChar = 3;
                }

                if (startButton.Text.Contains("Start"))
                {
                    WorkTimer.Start();
                    SecondTimer.Start();
                    startButton.Text      = "Stop Working";
                    refreshButton.Enabled = false;
                }
                else
                {
                    WorkTimer.Stop();
                    SecondTimer.Stop();
                    breakTimer.Stop();
                    startButton.Text      = "Start Working";
                    refreshButton.Enabled = true;
                }

                WorkTimeLabel.Text = $"{minutes}:00";
            }
            else
            {
                MessageBox.Show("You must select the window you will be working on.");
            }
        }
Beispiel #6
0
        async Task Run()
        {
            int MoveDelay = (int)MoveDelayNumericUpDown.Value;

            for (int i = 5; i > 0; i--)
            {
                StatusLabel.Text = "Starting in " + i + " sec";
                await Task.Delay(1000);
            }
            StatusLabel.Text = "Running, press shift to stop";
            SecondTimer.Start();
            while (Continue)
            {
                foreach (string Key in MoveSet)
                {
                    if (Control.ModifierKeys == Keys.Shift)
                    {
                        StatisticLabel.Text = "Moves: " + MovesSinceStart + " Time elapsed: " + SecondsSinceStart + " sec Moves/sec: " + MovesPrSec;
                        Continue            = false;
                        break;
                    }
                    SendKeys.Send(Key);
                    MovesSinceStart++;
                    MovesPrSecCounter++;
                    if (MoveDelay != 0)
                    {
                        await Task.Delay(MoveDelay);
                    }
                    else
                    {
                        Application.DoEvents();
                    }
                }
            }
            SecondTimer.Stop();
            SecondsSinceStart = 0;
            MovesSinceStart   = 0;
            StatusLabel.Text  = "Stoped";
        }
Beispiel #7
0
 private void SecondTimer_Tick(object sender, EventArgs e)
 {
     i++;
     if (i == 0)
     {
         LoadingPoint.Text = ".";
     }
     else if (i == 1)
     {
         LoadingPoint.Text = "..";
     }
     else if (i == 2)
     {
         LoadingPoint.Text = "...";
     }
     else if (i == 3)
     {
         LoadingPoint.Text = ".";
     }
     else if (i == 4)
     {
         LoadingPoint.Text = "..";
     }
     else if (i == 5)
     {
         LoadingPoint.Text = "...";
     }
     else if (i == 6)
     {
         LoadingPoint.Text = ".";
         SecondTimer.Stop();
         this.Hide();
         MainWindow.form.Width  = 353;
         MainWindow.form.Height = 473;
         FormsList.forms["UserLogin"].Show();
     }
 }