コード例 #1
0
 public ModelQuestionDatabaseTab(
     ObservableCollection <XML.Question> questions,
     XML.Question question,
     ObservableCollection <Answer> answers,
     Answer answer
     )
 {
     this.questions = questions;
     this.question  = question;
     this.answers   = answers;
     this.answer    = answer;
 }
コード例 #2
0
        string ResultReport(Answer[] correctAnswers, Answer[] wrongAnswers, Answer[] allCorrectAnswers, int questionNumber, XML.Question item)
        {
            string message       = string.Empty;
            string answerHeading = "Odp: ";
            string question      = string.Concat(questionNumber.ToString(), ". ", item.Values);

            message = question;

            foreach (var answer in correctAnswers)
            {
                string correct = string.Concat(
                    answerHeading,
                    answer.Name,
                    "\t",
                    "CORRECT"
                    );

                message = string.Concat(message, "\n", correct);
            }

            foreach (var answer in wrongAnswers)
            {
                string wrong = string.Concat(
                    answerHeading,
                    answer.Name,
                    "\t",
                    "WRONG"
                    );

                message = string.Concat(message, "\n", wrong);
            }

            Answer[] isAllCorrectAnswer = allCorrectAnswers.Except(correctAnswers, new Comparer()).ToArray();

            if (isAllCorrectAnswer.Any())
            {
                message = string.Concat(message, "\n\nCorrect answers:");
                foreach (var answer in allCorrectAnswers)
                {
                    string correct = string.Concat(
                        answerHeading,
                        answer.Name
                        );

                    message = string.Concat(message, "\n", correct);
                }
            }

            return(message);
        }