public CreateBranchWindowVM(ControlConstructSchemeVM controlConstructScheme, IfThenElse ifThenElse) { this.controlConstructScheme = controlConstructScheme; questionConstructs = new ObservableCollection <QuestionConstructVM>(); questionConstructs.AddRange(controlConstructScheme.QuestionConstructs); thenConstructs = new ObservableCollection <ConstructVM>(); thenConstructs.AddRange(controlConstructScheme.ThenConstructs); if (ifThenElse == null) { //In the case of TargetQuestionConstruct = controlConstructScheme.SelectedConstruct as QuestionConstructVM; branches = new ObservableCollection <BranchVM>(); //Add IF ~ THEN BranchVM ifBranch = new BranchVM(BranchVM.TYPE_IF_CODE) { Parent = this, No = 1, }; ifBranch.Init(); branches.Add(ifBranch); } else { // Inthe case of edit TargetQuestionConstruct = EDOUtils.Find(controlConstructScheme.QuestionConstructs, ifThenElse.IfCondition.QuestionId); branches = SequenceUtils.CreateBranches(ifThenElse, this); } }
protected override void Reload(VMState state) { if (state != null) { SelectedVariableItem = EDOUtils.Find(variables, state.State1); } if (SelectedVariableItem == null || !Variables.Contains(SelectedVariable)) { SelectedVariableItem = EDOUtils.GetFirst <VariableVM>(variables); } }
protected override void Reload(VMState state) { if (state != null) { SelectedDataFile = EDOUtils.Find(dataFiles, state.State1); } if (SelectedDataFile == null) { SelectedDataFile = EDOUtils.GetFirst(dataFiles); } }
protected override void Reload(VMState state) { if (state != null) { SelectedItem = EDOUtils.Find(fundingInfos, state.State1); } if (SelectedItem == null) { SelectedItem = fundingInfos.FirstOrNull(); } }
protected override void Reload(VMState state) { if (state != null) { SelectedCodeScheme = EDOUtils.Find(codeSchemes, state.State1); } if (SelectedCodeScheme == null) { SelectedCodeScheme = EDOUtils.GetFirst(codeSchemes); } }
protected override void Reload(VMState state) { if (state != null) { SelectedControlConstructScheme = EDOUtils.Find(ControlConstructSchemes, state.State1); } if (SelectedControlConstructScheme == null) { SelectedControlConstructScheme = ControlConstructSchemes.FirstOrNull(); } }
protected override void Reload(VMState state) { if (state != null) { selectedSamplingItem = EDOUtils.Find(Samplings, state.State1); } if (selectedSamplingItem == null) { selectedSamplingItem = Samplings.FirstOrNull(); } }
public QuestionGroupVM(QuestionGroup questionGroup, ObservableCollection <QuestionVM> allQuestions) { this.questionGroup = questionGroup; this.questions = new ObservableCollection <QuestionVM>(); foreach (string questionId in questionGroup.QuestionIds) { QuestionVM question = EDOUtils.Find(allQuestions, questionId); if (question != null) //Don't modify Parent because VM which is not under control is diverted { questions.Add(question); } } }
private static BranchVM CreateIfBranch(IfThenElse ifThenElse, CreateBranchWindowVM window) { BranchVM branch = new BranchVM(BranchVM.TYPE_IF_CODE) { Parent = window }; branch.Init(); branch.CondGroups.Clear(); IfCondition ifCondition = ifThenElse.IfCondition; CreateCondGroups(ifCondition.Code, branch, window.QuestionConstructs); branch.ThenConstruct = EDOUtils.Find(window.ThenConstructs, ifThenElse.ThenConstructId); return(branch); }
private static BranchVM CreateElseBranch(IfThenElse ifThenElse, CreateBranchWindowVM window) { if (ifThenElse.ElseConstructId == null) { return(null); } BranchVM branch = new BranchVM(BranchVM.TYPE_ELSE_CODE) { Parent = window }; branch.Init(); branch.CondGroups.Clear(); branch.ThenConstruct = EDOUtils.Find(window.ThenConstructs, ifThenElse.ElseConstructId); return(branch); }
protected override void Reload(VMState state) { CreateVariableInfos(); CreateStatisticsInfos(); if (state != null) { if (state.State1 != null) { SelectedVariableInfoItem = EDOUtils.Find(variableInfos, (string)state.State1); } } if (SelectedVariableInfoItem == null) { SelectedVariableInfoItem = EDOUtils.FindOrFirst(variableInfos, selectedVariableId); // keep selectedIndex when page changes } }
private static List <BranchVM> CreateElseIfBranches(IfThenElse ifThenElse, CreateBranchWindowVM window) { List <BranchVM> branches = new List <BranchVM>(); List <ElseIf> elseIfs = ifThenElse.ElseIfs; foreach (ElseIf elseIf in elseIfs) { BranchVM branch = new BranchVM(BranchVM.TYPE_ELSE_IF_CODE) { Parent = window }; branch.Init(); branch.CondGroups.Clear(); CreateCondGroups(elseIf.IfCondition.Code, branch, window.QuestionConstructs); branch.ThenConstruct = EDOUtils.Find(window.ThenConstructs, elseIf.ThenConstructId); branches.Add(branch); } return(branches); }
protected override void Reload(VMState state) { UpdateConcepts(); if (state != null) { SelectedConcept = EDOUtils.Find(Concepts, state.State1); if (SelectedConcept != null) { SelectedQuestionItem = EDOUtils.Find(SelectedQuestions, state.State2); if (selectedQuestionItem != null) { SelectedQuestion.Response.SelectedIndex = Convert.ToInt32(state.State3); } } } if (SelectedConcept == null) { SelectedConcept = EDOUtils.GetFirst <ConceptVM>(Concepts); } }
public ControlConstructSchemeVM FindControlConstructScheme(string dataSetId) { return(EDOUtils.Find(controlConstructSchemes, dataSetId)); }
public Statement FindStatement(string id) { return(EDOUtils.Find(Statements, id)); }
public IfThenElse FindIfThenElse(string id) { return(EDOUtils.Find(IfThenElses, id)); }
public ConstructVM FindConstruct(string id) { return(EDOUtils.Find(ThenConstructs, id)); }
public QuestionGroupConstruct FindQuestionGroupConstruct(string id) { return(EDOUtils.Find(QuestionGroupConstructs, id)); }