private UserControl AnswerViewGenerator(Type type, IAnswer model = null) { if (type == typeof(AnswerLotofTextModel)) { if (model == null) { model = Model.LanguageFactory.DefaultAnswerLotofTextModel(); } UserControl v = new View.AnswerTextUserControl(); ViewModel.AnswerLotofTextViewModel dc = new ViewModel.AnswerLotofTextViewModel( (AnswerLotofTextModel)model ); v.DataContext = dc; return(v); } if (type == typeof(AnswerExactTextModel)) { if (model == null) { model = Model.LanguageFactory.DefaultAnswerExactTextModel(); } UserControl v = new View.AnswerTextUserControl(); ViewModel.AnswerExactTextViewModel dc = new ViewModel.AnswerExactTextViewModel( (AnswerExactTextModel)model ); v.DataContext = dc; return(v); } if (type == typeof(AnswerTippMixModel)) { if (model == null) { model = new AnswerTippMixModel(); } UserControl v = new View.CreateAnswerTippMixUserControl(); ViewModel.AnswerTippMixViewModel dc = new ViewModel.AnswerTippMixViewModel( (AnswerTippMixModel)model ); v.DataContext = dc; return(v); } return(null); }
private IAnswer UserAnswerGenerator(IAnswer answer) { Type type = answer.GetAnswerType(); if (type == typeof(AnswerExactTextModel)) { return((IAnswer) new AnswerExactTextModel(GlobalLanguage.Instance.GetDict()["YourAnswerComesHere"])); } if (type == typeof(AnswerLotofTextModel)) { return((IAnswer) new AnswerLotofTextModel(GlobalLanguage.Instance.GetDict()["YourAnswerComesHere"])); } if (type == typeof(AnswerTippMixModel)) { AnswerTippMixModel oldAnswer = (AnswerTippMixModel)answer; AnswerTippMixModel newAnswer = new AnswerTippMixModel(); foreach (TippMix item in oldAnswer.TippMixList) { newAnswer.AddEmptyTipp(item); } return((IAnswer)newAnswer); } return(null); }
public AnswerTippMixViewModel(AnswerTippMixModel answerTippMixModel) : base(answerTippMixModel) { this.aModel = answerTippMixModel; this.Command_AddNewTipp = new DelegateCommand(x => this.Execute_AddNewTipp()); }