Example #1
0
        /// <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();
        }
Example #2
0
        private void ButtonStartTestClick(object sender, EventArgs e)
        {
            GetTestID();
            DataBase.ClearResults(DataBase.UserId, TestID);

            _tf = DataBase.FillTest(TestID);
            switch (comboBox1.SelectedIndex)
            {
            case 0:
            {
                var learnForm = new LearnForm(_tf);
                Hide();
                _tf.Start();
                if (learnForm.ShowDialog() == DialogResult.Cancel)
                {
                    Show();
                }
                break;
            }

            case 1:
            {
                var testreForm = new TesterForm(_tf);
                Hide();
                _tf.Start();
                if (testreForm.ShowDialog() == DialogResult.Cancel)
                {
                    Show();
                }
                break;
            }

            case -1: { MessageBox.Show("Выберите режим"); break; }
            }
        }
Example #3
0
        public LearnForm(TestFlow parTf)
        {
            InitializeComponent();

            _tf = parTf;
            _q  = _tf.GetNextQuestion();
            ms  = new MemoryStream(_q.Image);
            ms.Seek(0, SeekOrigin.Begin);
            pictureBox1.Image = System.Drawing.Image.FromStream(ms);

            if (_q.QuestionImage.Length != 0)
            {
                ms = new MemoryStream(_q.QuestionImage);
                ms.Seek(0, SeekOrigin.Begin);
                pictureBox2.Image = System.Drawing.Image.FromStream(ms);
            }
            else
            {
                pictureBox2.Image = null;
            }


            textBox1.Text = _q.Name;
            for (int i = 0; i < _q.Count; i++)
            {
                Ansvers_listBox.Items.Add(_q[i]);
            }
            QuestCount_label.Text = currentQuest.ToString();
            label3.Text           = _tf.QuestionCount().ToString();
            foreach (var tr in _q.Ansvers)
            {
                if (tr.ID == _q.TrueAnsverID)
                {
                    label5.Text = tr.Text;
                }
            }
        }