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;
            }
        }
 public MessageItem(Grid upGrid, bool useOpacityEnter = false, bool noStartAnimation = false)
 {
     UseOpacityEnter  = useOpacityEnter;
     NoStartAnimation = noStartAnimation;
     InitializeComponent();
     UpGrid = upGrid;
     UpGrid.Children.Add(this);
     FrameTimer.Tick    += new EventHandler(Entering);
     FrameTimer.Tick    += new EventHandler(Label_ExitLabel_OpacityDynamic);
     FrameTimer.Tick    += new EventHandler(Label_ExtendInfo_ColorDynamic);
     FrameTimer.Tick    += new EventHandler(CheckFloat);
     FrameTimer.Tick    += new EventHandler(Exiting);
     FrameTimer.Interval = new TimeSpan(0, 0, 0, 0, 10);
     FrameTimer.Start();
     SecondTimer.Tick    += new EventHandler(CheckCloseTimer);
     SecondTimer.Interval = new TimeSpan(0, 0, 1);
     SecondTimer.Start();
 }
Beispiel #3
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 #4
0
        private void StartButton_Click(object sender, EventArgs e)
        {
            if (InputTicks.Text != string.Empty)
            {
                try
                {
                    // Get the number of ticks that the user wants and set the input to ""
                    NumberOfTicks   = Int16.Parse(InputTicks.Text);
                    InputTicks.Text = string.Empty;
                }
                catch (Exception s)
                {
                    MessageBox.Show("Exception: " + s.ToString());
                    InputTicks.Text += " <-FixMe";
                }

                if (NumberOfTicks > 0)
                {
                    // Set ShowTicks' text to the number of ticks and show it
                    ShowTicks.Text = NumberOfTicks.ToString();
                    ShowTicks.Show();

                    InputTicks.ReadOnly = true;

                    AlarmGo        = true;
                    Progress.Value = Progress.Maximum = NumberOfTicks;

                    // Start the timer
                    SecondTimer.Start();
                }
                else
                {
                    MessageBox.Show("Input Must be an unsigned number greater than 0!");
                }
            }
            else
            {
                MessageBox.Show("I can't count ticks you haven't given, Sherlock!");
            }
        }
Beispiel #5
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 #6
0
        private void breakTimer_Tick(object sender, EventArgs e)
        {
            int minutes = int.Parse(WorkTimeLabel.Text.Substring(0, breakChar));
            int seconds = int.Parse(WorkTimeLabel.Text.Substring(breakChar + 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
            {
                // gameForm.Close();
                MessageBox.Show("Break time is over. Get back to work!", "Timeout", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                breakTimer.Stop();
                WorkTimeLabel.Text = $"{(int)WorkNumericUpDown.Value}:00";
                WorkTimer.Start();
                SecondTimer.Start();
            }
        }
Beispiel #7
0
 private void LoadingWindow_Load(object sender, EventArgs e)
 {
     LoadingTimer.Start();
     SecondTimer.Start();
 }