예제 #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();
        }
예제 #2
0
        /// <summary>
        /// Кнопка ответа
        /// </summary>
        private void AnsverButtonClick(object sender, EventArgs e)
        {
            int current = Convert.ToInt32(QuestCount_label.Text);

            current--;
            QuestCount_label.Text = current.ToString();
            var    res = new ResultRecord();
            string s   = "";
            int    ida = 0;

            // Если ответ выбран
            if (Ansvers_listBox.SelectedItem != null)
            {
                s = (string)Ansvers_listBox.SelectedItem;
                foreach (var r in _q.Ansvers)
                {
                    if (s == r.Text)
                    {
                        ida = r.ID;
                    }
                }

                // заполнение результата
                res.TestID = _tf.ID;
                res.Ans    = ida;
                res.Trues  = _q.TrueAnsverID;
                res.Quest  = _q.ID;
                res.UserID = DataBase.UserId;
                _results.Add(res);

                // Следующий вопрос
                _q = _tf.GetNextQuestion();

                if (_q.QuestionImage != null && _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;
                Ansvers_listBox.Items.Clear();
                for (int i = 0; i < _q.Count; i++)
                {
                    Ansvers_listBox.Items.Add(_q[i]);
                }
            }
        }
예제 #3
0
        // NEXT
        private void button2_Click(object sender, EventArgs e)
        {
            if (_tf.QuestionCount() > _tf.Current + 1)
            {
                ms = new MemoryStream(_q.Image);
                ms.Seek(0, SeekOrigin.Begin);
                pictureBox1.Image = System.Drawing.Image.FromStream(ms);

                currentQuest          = _tf.Current + 2;
                QuestCount_label.Text = currentQuest.ToString();
                _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;
                }

                foreach (var tr in _q.Ansvers)
                {
                    if (tr.ID == _q.TrueAnsverID)
                    {
                        label5.Text = tr.Text;
                    }
                }

                textBox1.Text = _q.Name;
                Ansvers_listBox.Items.Clear();
                for (int i = 0; i < _q.Count; i++)
                {
                    Ansvers_listBox.Items.Add(_q[i]);
                }
            }
        }
예제 #4
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;
                }
            }
        }