Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
 protected override void Reload(VMState state)
 {
     if (state != null)
     {
         SelectedDataFile = EDOUtils.Find(dataFiles, state.State1);
     }
     if (SelectedDataFile == null)
     {
         SelectedDataFile = EDOUtils.GetFirst(dataFiles);
     }
 }
Esempio n. 4
0
 protected override void Reload(VMState state)
 {
     if (state != null)
     {
         SelectedItem = EDOUtils.Find(fundingInfos, state.State1);
     }
     if (SelectedItem == null)
     {
         SelectedItem = fundingInfos.FirstOrNull();
     }
 }
Esempio n. 5
0
 protected override void Reload(VMState state)
 {
     if (state != null)
     {
         SelectedCodeScheme = EDOUtils.Find(codeSchemes, state.State1);
     }
     if (SelectedCodeScheme == null)
     {
         SelectedCodeScheme = EDOUtils.GetFirst(codeSchemes);
     }
 }
Esempio n. 6
0
 protected override void Reload(VMState state)
 {
     if (state != null)
     {
         SelectedControlConstructScheme = EDOUtils.Find(ControlConstructSchemes, state.State1);
     }
     if (SelectedControlConstructScheme == null)
     {
         SelectedControlConstructScheme = ControlConstructSchemes.FirstOrNull();
     }
 }
Esempio n. 7
0
 protected override void Reload(VMState state)
 {
     if (state != null)
     {
         selectedSamplingItem = EDOUtils.Find(Samplings, state.State1);
     }
     if (selectedSamplingItem == null)
     {
         selectedSamplingItem = Samplings.FirstOrNull();
     }
 }
Esempio n. 8
0
 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);
         }
     }
 }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
 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
     }
 }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
 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);
     }
 }
Esempio n. 14
0
 public ControlConstructSchemeVM FindControlConstructScheme(string dataSetId)
 {
     return(EDOUtils.Find(controlConstructSchemes, dataSetId));
 }
Esempio n. 15
0
 public Statement FindStatement(string id)
 {
     return(EDOUtils.Find(Statements, id));
 }
Esempio n. 16
0
 public IfThenElse FindIfThenElse(string id)
 {
     return(EDOUtils.Find(IfThenElses, id));
 }
Esempio n. 17
0
 public ConstructVM FindConstruct(string id)
 {
     return(EDOUtils.Find(ThenConstructs, id));
 }
Esempio n. 18
0
 public QuestionGroupConstruct FindQuestionGroupConstruct(string id)
 {
     return(EDOUtils.Find(QuestionGroupConstructs, id));
 }