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; } }
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."); }
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."); } } }
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(); }
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; } }
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."); } }
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!"); } }
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"; }
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(); } }
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(); } }
private void LoadingWindow_Load(object sender, EventArgs e) { LoadingTimer.Start(); SecondTimer.Start(); }