/// <summary> /// This is the TimerTick event that stops the ProgressBar in each BMI level /// There are four levels os BMI /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ResultTimer_Tick(object sender, EventArgs e) { ResultProgressBar.Increment(1); switch (_bmiLevel) { case 1: if (ResultProgressBar.Value == 25) { ResultTimer.Stop(); } break; case 2: if (ResultProgressBar.Value == 50) { ResultTimer.Stop(); } break; case 3: if (ResultProgressBar.Value == 75) { ResultTimer.Stop(); } break; case 4: if (ResultProgressBar.Value == 100) { ResultTimer.Stop(); } break; } }
private void buttonRun_Click(object sender, EventArgs e) { if (!Running) { if (!Worker.IsBusy) { Worker.RunWorkerAsync(); buttonRun.Text = "Stop"; Running = true; } ResultTimer.Interval = 20000; ResultTimer.Start(); } else { if (Worker.IsBusy) { Running = false; Worker.CancelAsync(); buttonRun.Text = "Run"; } ResultTimer.Stop(); } }
protected override void AppendToGrid(List <Artifact> Results, int nResIndex) { base.AppendToGrid(Results, nResIndex); if (!checkBoxSliceData.Checked && Results.Count > 0) { ResultTimer.Stop(); } }
/// <summary> /// This is the Event Handler for the CalculateButton click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CalculateButton_Click(object sender, EventArgs e) { try { _BMI = CalculateBMI(_Height, _Weight); ResultTimer.Start(); ResultTextBox.Text = _BMI.ToString("F1"); ResultProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; if (_BMI <= 18.5) { _bmiLevel = 1; ResultProgressBar.ForeColor = Color.Gold; ScaleTextBox.Text = "Underweight"; ScaleTextBox.BackColor = Color.Gold; ScaleTextBox.ForeColor = Color.White; ScaleTextBox.Font = new Font(this.Font, FontStyle.Bold); } else if (_BMI <= 24.9) { _bmiLevel = 2; ResultProgressBar.ForeColor = Color.LimeGreen; ScaleTextBox.Text = "Normal"; ScaleTextBox.BackColor = Color.LimeGreen; ScaleTextBox.ForeColor = Color.White; ScaleTextBox.Font = new Font(this.Font, FontStyle.Bold); } else if (_BMI <= 29.9) { _bmiLevel = 3; ResultProgressBar.ForeColor = Color.DarkOrange; ScaleTextBox.Text = "Overweight"; ScaleTextBox.BackColor = Color.DarkOrange; ScaleTextBox.ForeColor = Color.White; ScaleTextBox.Font = new Font(this.Font, FontStyle.Bold); } else if (_BMI >= 30) { _bmiLevel = 4; ResultProgressBar.ForeColor = Color.DarkRed; ScaleTextBox.Text = "Obese"; ScaleTextBox.BackColor = Color.DarkRed; ScaleTextBox.ForeColor = Color.White; ScaleTextBox.Font = new Font(this.Font, FontStyle.Bold); } ResultProgressBar.Value = 0; } catch { MessageBox.Show("You must provide Height and Weight to \ncalculate your BMI - Body Mass Index"); } }
/// <summary> /// This method clear fields and set Imperial unit /// </summary> private void ClearForm() { ImperialRadioButton.Checked = true; MetricRadioButton.Checked = false; HeightUnitLabel.Text = "Inches"; WeightUnitLabel.Text = "Pounds"; HeightTextBox.Text = string.Empty; WeightTextBox.Text = string.Empty; ResultTextBox.Text = string.Empty; ScaleTextBox.Text = string.Empty; ScaleTextBox.BackColor = Color.LightGray; ResultProgressBar.Value = 0; ResultTimer.Stop(); }
void ResultTimer_Tick(object sender, EventArgs e) { if (!Worker.IsBusy && !ResultsWorker.IsBusy) { ResultTimer.Stop(); } if (ResultTimerToStop) { ResultTimer.Stop(); } if (!ResultsWorker.IsBusy) { ResultsWorker.RunWorkerAsync(); } else { return; } }
public static void Initialize() { m_ResultQueue = new Queue(); m_ClaimedOrders = new ArrayList(); CommandSystem.Register("ClaimDonations", AccessLevel.Player, new CommandEventHandler(ClaimDonations_OnCommand)); CommandSystem.Register("SetDonations", AccessLevel.Administrator, new CommandEventHandler(SetDonations_OnCommand)); Load(); result = new ResultTimer(); result.Start(); }
private void ResultTimer_Tick(object sender, EventArgs e) { ResultTimer.Stop(); ResetBoard(); }
private void Result(string Betawinner) { forms.Result(variusApp.resultaten(Betawinner)); ResultTimer.Start(); }
// Programma private void Result() { forms.Result(variusApp.resultaten()); ResultTimer.Start(); }
public void StopTimer() { ResultTimer.Stop(); }