/// <summary> /// Инициализация /// </summary> public TesterForm(TestFlow parTf) { InitializeComponent(); _tf = parTf; _tf.TestTick += TfTestTick; _tf.TestFinished += TfTestFinished; _q = _tf.GetNextQuestion(); if (_q.QuestionImage.Length != 0) { var ms = new MemoryStream(_q.QuestionImage); ms.Seek(0, SeekOrigin.Begin); pictureBox1.Image = System.Drawing.Image.FromStream(ms); } else { pictureBox1.Image = null; } textBox1.Text = _q.Name; for (int i = 0; i < _q.Count; i++) { Ansvers_listBox.Items.Add(_q[i]); } if (_tf.TimeConstraint().Hour == 0 && _tf.TimeConstraint().Minute == 0) { label_Time_Last.Text = "Без ограничения по времени"; } _max = _tf.Span()._minutes * 60 + _tf.Span()._hours * 60 * 60 + _tf.Span()._seconds; progressBar1.Maximum = _max; QuestCount_label.Text = _tf.QuestionCount().ToString(); }
/// <summary> /// Таймер /// </summary> void TfTestTick(EventArgs e) { label_Time_Last.Text = _tf.Span().ToString(); if (progressBar1.Value < _max) { progressBar1.Value = ++progressBar1.Value; } }