예제 #1
0
        protected BaseQuestionViewModel(Question question)
        {
            Question = question;

            Answers = new ObservableCollection<AnswerTuple>();

            while (Answers.Count != Question.Answers.Count)
            {
                var newAnswerIndex = rand.Next(Question.Answers.Count);
                while (Answers.Select(tuple => tuple.AnswerIndex).Contains(newAnswerIndex))
                    newAnswerIndex = rand.Next(Question.Answers.Count);

                Answers.Add(new AnswerTuple() {
                    AnswerText = Question.Answers[newAnswerIndex].Text,
                    AnswerIndex = newAnswerIndex,
                    IsChecked = false});
            }
        }
 public SingleChoiceQuestionViewModel(Question question)
     : base(question)
 {
 }
 public MultiChoiceQuestionViewModel(Question question)
     : base(question)
 {
 }