public QuestionEditorVM(RootVM root, object owner, Test test, Question question) : base(root, owner)
        {
            if (question == null)
            {
                question = new Question();
            }
            Question = question;
            Test     = test;
            Error    = new ErrorMessageVM();
            _answers = new List <InputAnswerVM>();

            QuestionInpit      = new InputTextVM();
            QuestionInpit.Text = Question.Queston;

            OneAnswer            = new InputAnswerVM(1);
            OneAnswer.Text       = Question.Answers[0];
            OneAnswer.IsCheceked = true;
            _answers.Add(OneAnswer);

            TwoAnswer      = new InputAnswerVM(2);
            TwoAnswer.Text = Question.Answers[1];
            _answers.Add(TwoAnswer);

            ThreeAnswer      = new InputAnswerVM(3);
            ThreeAnswer.Text = Question.Answers[2];
            _answers.Add(ThreeAnswer);

            FourAnswer      = new InputAnswerVM(4);
            FourAnswer.Text = Question.Answers[3];
            _answers.Add(FourAnswer);
        }
Esempio n. 2
0
        public EditQuestionVM(RootVM root, object owner, Question question) : base(root, owner)
        {
            Question           = question;
            OldQuestion        = (Question)question.Clone();
            QuestionInput      = new InputTextVM();
            QuestionInput.Text = Question.Queston;

            Answers = new ObservableCollection <InputAnswerVM>();
            for (int i = 0; i < question.Answers.Count; i++)
            {
                InputAnswerVM answerVM = new InputAnswerVM(i + 1);
                answerVM.Text = question.Answers[i];
                if (question.Answers[i] == question.RightAnswer)
                {
                    answerVM.IsCheceked = true;
                }
                Answers.Add(answerVM);
            }
        }