Ejemplo n.º 1
0
 public static QuestionViewModel GetViewModelForQuestion(Question question)
 {
     Func<Question, QuestionViewModel> viewModelInstanceFactory = null;
     if (maps.TryGetValue(question.GetType(), out viewModelInstanceFactory))
     {
         return viewModelInstanceFactory(question);
     }
     else
     {
         throw new ArgumentOutOfRangeException("Could not locate a view model for question type");
     }
 }
Ejemplo n.º 2
0
        private QuestionViewModel CreateQuestionViewModel(Question question)
        {
            QuestionViewModel vm = QuestionViewModelFactory.GetViewModelForQuestion(question);
            vm.ResponseChanged += this.OnQuestionResponseChanged;

            return vm;
        }