Beispiel #1
0
        private void BtnNext_Click(object sender, EventArgs e)
        {
            WriteChoosenAnswer();
            HideAnswers();
            Question currentQuestion = _test.Questions[_questionIndex];

            if (_answerIndex == currentQuestion.Answers.Count)
            {
                _questionIndex++;
                if (_questionIndex == _test.Questions.Count)
                {
                    int score = _logicModel.CompleteTest(_test, _answers);
                    MessageBox.Show($"Ваш результат: {score}/{_test.GetScore()}");
                    this.Close();
                }
                else
                {
                    currentQuestion        = _test.Questions[_questionIndex];
                    _answerIndex           = 0;
                    lblQuestionNumber.Text = "Номер вопроса: " + (_questionIndex + 1);
                    lblTestsNameValue.Text = currentQuestion.Task;
                }
            }
            else
            {
                for (int i = 1; i < 5; i++)
                {
                    _answerIndex++;
                    if (_answerIndex == currentQuestion.Answers.Count)
                    {
                        break;
                    }
                    else
                    {
                        SetAnswers(i);
                    }
                }
            }
        }