/// <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;
            }
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
 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();
 }
예제 #6
0
        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();
 }
예제 #8
0
파일: Form1.cs 프로젝트: RenseVS/Rense
 private void ResultTimer_Tick(object sender, EventArgs e)
 {
     ResultTimer.Stop();
     ResetBoard();
 }
예제 #9
0
파일: Form1.cs 프로젝트: RenseVS/Rense
 private void Result(string Betawinner)
 {
     forms.Result(variusApp.resultaten(Betawinner));
     ResultTimer.Start();
 }
예제 #10
0
파일: Form1.cs 프로젝트: RenseVS/Rense
 // Programma
 private void Result()
 {
     forms.Result(variusApp.resultaten());
     ResultTimer.Start();
 }
예제 #11
0
 public void StopTimer()
 {
     ResultTimer.Stop();
 }