Exemple #1
0
    protected void NextQuestion(object sender, EventArgs e)
    {
        // Get user selected answers
        var userAnswers = new List <TestAnswer>();

        for (int i = 0; i < answers.Length; ++i)
        {
            if (answers [i].Active)
            {
                userAnswers.Add(question.Current.Answers [i]);
            }
        }
        results.ForgetAnswer(question.Current);
        results.Answer(question.Current, userAnswers);

        // Show next question
        if (question.MoveNext())
        {
            ShowQuestion(question.Current);
        }
        // If all questions has been answered, then show test results
        else
        {
            ShowResults();
        }
    }