Example #1
0
        private void ShowStatisticForSelection()
        {
            int count = dgv.SelectedRows.Count;

            if (count > 0)
            {
                double   speedSum = 0;
                double   speed;
                double   errorspercentSum = 0;
                int      rhythmicitySum   = 0;
                int      passedCharsSum   = 0;
                int      passedChars;
                TimeSpan timeSum = TimeSpan.Zero;
                foreach (DataGridViewRow row in dgv.SelectedRows)
                {
                    speed             = (double)row.Cells["speedDataGridViewTextBoxColumn"].Value;
                    passedChars       = (int)row.Cells["passedCharsDataGridViewTextBoxColumn"].Value;
                    speedSum         += speed;
                    errorspercentSum += (double)row.Cells["errorsPercentDataGridViewTextBoxColumn"].Value;
                    rhythmicitySum   += (int)row.Cells["rhythmicityDataGridViewTextBoxColumn"].Value;
                    passedCharsSum   += passedChars;
                    timeSum          += TimeSpan.FromMinutes(passedChars / speed);
                }
                textBoxCount.Text       = count.ToString();
                textBoxAvSpeed.Text     = (speedSum / count).ToString("F2") + " зн/мин";
                textBoxErrors.Text      = (errorspercentSum / count).ToString("F2") + " %";
                textBoxRhithmicity.Text = (rhythmicitySum / count).ToString() + " %";
                textBoxTime.Text        = ResultForm.FormatTimeSpan(timeSum);
            }
        }
Example #2
0
 private void timerUpdateWidgets_Tick(object sender, EventArgs e)
 {
     labelTime.Text       = ResultForm.FormatTimeSpan(exercise.PastTime);
     labelRemainTime.Text = '-' + ResultForm.FormatTimeSpan(exercise.ExpectedRemainTime);
     progressBar.Value    = (int)(exercise.TextProgress * progressBar.Maximum);
     labelVelocity.Text   = exercise.Speed.ToString("F");
     labelErrors.Text     = exercise.Errors.ToString();
 }