Exemplo n.º 1
0
 public void OnRemoveConcept(ConceptVM concept)
 {
     if (SelectedConcept == concept)
     {
         SelectedConcept = null;
     }
 }
Exemplo n.º 2
0
        public void bookDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGrid dataGrid = sender as DataGrid;

            if (dataGrid == null || dataGrid.Name != "bookDataGrid")
            {
                return;
            }
            AbstractFormVM abstractForm = dataGrid.DataContext as AbstractFormVM;

            if (abstractForm != null)
            {
                abstractForm.EditBook();
                return;
            }
            ConceptVM concept = dataGrid.DataContext as ConceptVM;

            if (concept != null)
            {
                concept.EditBook();
                return;
            }
            ResponseVM response = dataGrid.DataContext as ResponseVM;

            if (response != null)
            {
                response.EditBook();
                return;
            }
        }
Exemplo n.º 3
0
 public void CreateDataSets(ObservableCollection <VariableVM> variables)
 {
     foreach (DataSetVM dataSet in dataSets)
     {
         foreach (VariableVM variable in variables)
         {
             DataSetVariableVM v       = null;
             bool shouldCreateVariable = (dataSet.Id == StudyUnit.DefaultDataSetId) &&
                                         !variable.IsCreatedDataSet && !dataSet.IsExistVariable(variable.Id);
             if (shouldCreateVariable)
             {
                 v    = new DataSetVariableVM();
                 v.Id = variable.Id;
                 variable.IsCreatedDataSet = true;
                 dataSet.Variables.Add(v);
             }
             else
             {
                 v = dataSet.FindVariable(variable.Id);
             }
             if (v != null)
             {
                 ConceptVM concept = StudyUnit.FindConcept(variable.ConceptId);
                 v.Title        = variable.Title;
                 v.Label        = variable.Label;
                 v.ConceptTitle = concept == null ? null : concept.Title;
             }
         }
     }
 }
Exemplo n.º 4
0
        private void CreateVariableInfos()
        {
            variableInfos.Clear();
            ObservableCollection <VariableVM> variables = StudyUnit.Variables;

            foreach (VariableVM variable in variables)
            {
                VariableInfoVM variableInfo = new VariableInfoVM(variable.Variable);
                variableInfos.Add(variableInfo);
                ConceptVM concept = StudyUnit.FindConcept(variable.ConceptId);
                if (concept != null)
                {
                    variableInfo.ConceptTitle = concept.Title;
                }
                QuestionVM question = StudyUnit.FindQuestion(variable.QuestionId);
                if (question != null)
                {
                    variableInfo.QuestionTitle = question.Content;
                }
                UniverseVM universe = StudyUnit.FindUniverse(variable.UniverseId);
                if (universe != null)
                {
                    variableInfo.UniverseTitle = universe.Title;
                }
                variableInfo.VariableType = Options.FindResponseTypeLabel(variable.ResponseTypeCode);
            }
            selectedVariableInfoItem = null;
        }
Exemplo n.º 5
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            ConceptVM concept = (ConceptVM)value;

            if (value == null)
            {
                return("");
            }
            return(string.Format(Resources.QuestionForMeasure, concept.Title)); //Question item for ...
        }
Exemplo n.º 6
0
        public void RemoveConcept(ConceptVM concept)
        {
            ConceptSchemeVM conceptScheme = conceptForm.FindConceptScheme(concept);

            if (conceptScheme == null)
            {
                return;
            }
            conceptScheme.RemoveConceptExternal(concept);
        }
Exemplo n.º 7
0
 public void OnRemoveConcept(ConceptVM concept)
 {
     foreach (VariableVM variable in variables)
     {
         if (variable.ConceptId == concept.Id)
         {
             variable.ConceptId = null;
             variable.Concept   = null;
         }
     }
 }
Exemplo n.º 8
0
 public void RemoveQuestion()
 {
     using (UndoTransaction tx = new UndoTransaction(UndoManager))
     {
         StudyUnit.OnRemoveQuestion(SelectedQuestion);
         SelectedQuestions.Remove(SelectedQuestion);
         SelectedQuestionItem = null;
         ConceptVM concept = SelectedConcept;
         UpdateModel(false);
         SelectedConcept = concept;
         tx.Commit();
     }
 }
Exemplo n.º 9
0
        private DataSetVariableVM createDataSetVariable(VariableVM variable)
        {
            ConceptVM concept = StudyUnit.FindConcept(variable.ConceptId);
            //if (concept == null)
            //{
            //    return null;
            //}
            DataSetVariableVM v = new DataSetVariableVM();

            v.Id           = variable.Variable.Id;
            v.Title        = variable.Title;
            v.Label        = variable.Label;
            v.ConceptTitle = concept == null ? null : concept.Title;
            return(v);
        }
Exemplo n.º 10
0
        public void ChangeImage()
        {
            Debug.WriteLine("Change Image");
            ConceptVM  selectedConcept          = SelectedConcept;
            QuestionVM selectedQuestion         = SelectedQuestion;
            SelectObjectWindowVM <ConceptVM> vm = new SelectObjectWindowVM <ConceptVM>(Concepts);
            ConceptVM newConcept = SelectObjectWindow.Select(Resources.SelectImage, vm) as ConceptVM;

            if (newConcept != null && newConcept != selectedConcept)
            {
                SelectedQuestions.Remove(selectedQuestion);
                SelectedQuestionItem = null;

                ObservableCollection <QuestionVM> questions = RelatedQuestions(newConcept.Id);
                questions.Add(selectedQuestion);
                selectedQuestion.Question.ConceptId = newConcept.Id;

                UpdateModel(true);
            }
        }
Exemplo n.º 11
0
        public string FindConceptTitle(string conceptId)
        {
            ConceptVM concept = FindConcept(conceptId);

            return(concept != null ? concept.Title : "");
        }
Exemplo n.º 12
0
 public ObservableCollection <QuestionVM> QuestionsFor(ConceptVM concept)
 {
     return(questionForm.QuestionsFor(concept));
 }
Exemplo n.º 13
0
 public void OnRemoveConcept(ConceptVM concept)
 {
     questionForm.OnRemoveConcept(concept);
     variableForm.OnRemoveConcept(concept);
     bookForm.OnRemoveConcept(concept);
 }
Exemplo n.º 14
0
        public bool CanRemoveConcept(ConceptVM conceptVM)
        {
            ObservableCollection <QuestionVM> questions = questionForm.QuestionsFor(conceptVM);

            return(questions.Count == 0);
        }
Exemplo n.º 15
0
 public void RemoveQuestion(ConceptVM concept)
 {
     RemoveBookRelationOfMetaData(concept.Id);
 }
Exemplo n.º 16
0
 public void OnRemoveConcept(ConceptVM concept)
 {
     RemoveBookRelationOfMetaData(concept.Id);
 }
Exemplo n.º 17
0
 public ObservableCollection <QuestionVM> QuestionsFor(ConceptVM concept)
 {
     return(RelatedQuestions(concept.Id));
 }