Beispiel #1
0
        private void CheckResult()
        {
            List <string> answers = new List <string>();
            int           i       = 1;

            foreach (var item in userAnswers.Keys)
            {
                UserAnswer val = (UserAnswer)userAnswers[item];
                string     ans = string.Empty;
                ans += (string.Format("Pytanie {0} ({1}) ", i, item));
                if (Equals(val.RealAnswer, val.UserAns))
                {
                    ans += "OK!";
                }
                else
                {
                    ans += string.Format("ERROR! Powinno być {0}, Ty wybrałeś {1}", val.RealAnswer, val.UserAns);
                }
                answers.Add(ans);
                i++;
            }
            TestResult rsltForm = new TestResult(answers);

            rsltForm.Show();
        }
Beispiel #2
0
 private void AddUserAnswer(Answer answer)
 {
     if (!userAnswers.ContainsKey(actualQuestionId))
     {
         sumOfAllAnsweredQuestions += 1;
         userAnswers.Add(actualQuestionId, new UserAnswer(answer, GetAnswerFromRandom()));
     }
     else
     {
         userAnswers[actualQuestionId] = new UserAnswer(answer, GetAnswerFromRandom());
     }
 }