Example #1
0
 public CodeFormVM(StudyUnitVM studyUnit) : base(studyUnit)
 {
     codeSchemes = new ObservableCollection <CodeSchemeVM>();
     foreach (CodeScheme codeSchemeModel in studyUnit.CodeSchemeModels)
     {
         CodeSchemeVM codeScheme = CreateCodeScheme(codeSchemeModel);
         codeSchemes.Add(codeScheme);
     }
     modelSyncher = new ModelSyncher <CodeSchemeVM, CodeScheme>(this, codeSchemes, studyUnit.CodeSchemeModels);
 }
Example #2
0
 public ResponseVM(Response response, CodeSchemeVM codeScheme)
 {
     this.response = response;
     this.isQuestionDesignMode = true;
     if (codeScheme == null)
     {
         codeScheme = new CodeSchemeVM();
         codeScheme.OwnerResponse = this;
     }
     books = new ObservableCollection<BookVM>();
     Init(response.DetailTypeCode, response.Min, response.Max, codeScheme, new List<MissingValue>(response.MissingValues), response.Layout);
 }
Example #3
0
        private CodeSchemeVM CreateCodeScheme(CodeScheme codeSchemeModel)
        {
            ObservableCollection <CodeVM> codes = new ObservableCollection <CodeVM>();

            foreach (Code codeModel in codeSchemeModel.Codes)
            {
                CategoryVM category = StudyUnit.FindCategory(codeModel.CategoryId);
                CodeVM     code     = new CodeVM(codeModel, category);
                codes.Add(code);
            }
            CodeSchemeVM codeScheme = new CodeSchemeVM(codeSchemeModel, codes)
            {
                Parent = this
            };

            return(codeScheme);
        }
Example #4
0
        public void AddCodeScheme()
        {
            InputDialog dlg = new InputDialog();

            dlg.Title = Resources.InputCodeSchemeName; // Input the name of Code Scheme
            dlg.Info  = Resources.CodeFormHelpMessage; //**After creating the code group, please assign the code by clicking "Add From Category Scheme" or "Add From Category"
            dlg.Owner = Application.Current.MainWindow;
            dlg.ShowDialog();
            if (dlg.DialogResult == true)
            {
                CodeScheme codeSchemeModel = new CodeScheme()
                {
                    Title = dlg.textBox.Text
                };
                CodeSchemeVM newCodeScheme = new CodeSchemeVM(codeSchemeModel);
                codeSchemes.Add(newCodeScheme);
                if (SelectedCodeScheme == null)
                {
                    SelectedCodeScheme = newCodeScheme;
                }
                Memorize();
            }
        }
Example #5
0
 public CodeVM FindCode(string codeId)
 {
     return(CodeSchemeVM.FindCode(codeSchemes, codeId));
 }
Example #6
0
 public CodeVM FindCodeByCategoryId(string categoryId)
 {
     return(CodeSchemeVM.FindCodeByCategoryId(codeSchemes, categoryId));
 }
Example #7
0
 public bool Contains(CodeSchemeVM codeScheme)
 {
     return(CodeSchemes.Contains(codeScheme));
 }
Example #8
0
 public void RemoveCodeSchemeFromResponse(CodeSchemeVM codeScheme)
 {
     //コードスキームは複数の回答から参照されることがある。
     //さらに質問設計・変数設計どちらからも参照されることがあるので、
     //1:多の関係になる。
     List<ResponseVM> responses = FindResponses(codeScheme);
     foreach (ResponseVM response in responses)
     {
         //回答方法を選択肢のままにしておくと「無題の選択肢郡」がCompleteVariableなどで生成されてしまう。
         //回答方法をUnknownにもどす。
         response.TypeCode = Options.RESPONSE_TYPE_UNKNOWN.Code;
     }
 }
Example #9
0
 public List<ResponseVM> FindResponses(CodeSchemeVM codeScheme)
 {
     List<ResponseVM> questionResponses = questionForm.FindResponses(codeScheme);
     List<ResponseVM> variableResponses = variableForm.FindResponses(codeScheme);
     List<ResponseVM> allResponses = new List<ResponseVM>();
     allResponses.AddRange(questionResponses);
     allResponses.AddRange(variableResponses);
     return allResponses;
 }
Example #10
0
        private void Init(string detailTypeCode, decimal? min, decimal? max, CodeSchemeVM codeScheme, List<MissingValue> missingValueModels, ResponseLayout layoutModel)
        {
            DetailTypeCode = detailTypeCode;
            Min = min;
            Max = max;
            CodeScheme = codeScheme;

            DetailTypes = new ObservableCollection<Option>();
            if (response.IsTypeChoices)
            {
            } else if (response.IsTypeDateTime)
            {
                DetailTypes = Options.DateTimeTypes;
            }
            else if (response.IsTypeFree)
            {
            }
            else if (response.IsTypeNumber)
            {
                DetailTypes = Options.NumberTypes;
            }

            missingValues = new ObservableCollection<MissingValueVM>();
            foreach (MissingValue mv in missingValueModels)
            {
                MissingValueVM missingValue = new MissingValueVM(mv) { Parent = this };
                missingValues.Add(missingValue);
            }
            modelSyncher = new ModelSyncher<MissingValueVM, MissingValue>(this, missingValues, response.MissingValues);

            ResponseLayout newLayoutModel = layoutModel;

            layout = CreateLayout(response, layoutModel);
            response.Layout = layout.Layout;
        }
Example #11
0
 private void Clear()
 {
     codeScheme = null;
     Min = null;
     Max = null;
     DetailTypes.Clear();
 }
Example #12
0
 private CodeSchemeVM CreateCodeScheme(CodeScheme codeSchemeModel)
 {
     ObservableCollection<CodeVM> codes = new ObservableCollection<CodeVM>();
     foreach (Code codeModel in codeSchemeModel.Codes)
     {
         CategoryVM category = StudyUnit.FindCategory(codeModel.CategoryId);
         CodeVM code = new CodeVM(codeModel, category);
         codes.Add(code);
     }
     CodeSchemeVM codeScheme = new CodeSchemeVM(codeSchemeModel, codes)
     {
         Parent = this
     };
     return codeScheme;
 }
Example #13
0
 public bool Contains(CodeSchemeVM codeScheme)
 {
     return CodeSchemes.Contains(codeScheme);
 }
Example #14
0
 public void AddCodeScheme()
 {
     InputDialog dlg = new InputDialog();
     dlg.Title = Resources.InputCodeSchemeName; // コード群の名前を入力してください;
     dlg.Info = Resources.CodeFormHelpMessage; //※コード群作成後は、「選択肢群から追加」、「選択肢を追加」ボタンを押してコードを割り当ててください。;
     dlg.Owner = Application.Current.MainWindow;
     dlg.ShowDialog();
     if (dlg.DialogResult == true)
     {
         CodeScheme codeSchemeModel = new CodeScheme() {Title = dlg.textBox.Text};
         CodeSchemeVM newCodeScheme = new CodeSchemeVM(codeSchemeModel);
         codeSchemes.Add(newCodeScheme);
         if (SelectedCodeScheme == null)
         {
             SelectedCodeScheme = newCodeScheme;
         }
         Memorize();
     }
 }
Example #15
0
 public List<ResponseVM> FindResponses(CodeSchemeVM codeScheme)
 {
     List<ResponseVM> responses = new List<ResponseVM>();
     List<ResponseVM> allResponses = AllResponses;
     foreach (ResponseVM response in allResponses)
     {
         if (response.CodeScheme == codeScheme)
         {
             responses.Add(response);
         }
     }
     return responses;
 }
Example #16
0
 public List<ResponseVM> FindResponses(CodeSchemeVM codeScheme)
 {
     List<ResponseVM> responses = new List<ResponseVM>();
     foreach (VariableVM variable in Variables)
     {
         ResponseVM response = variable.Response;
         if (response.IsTypeChoices && response.CodeScheme == codeScheme)
         {
             responses.Add(response);
         }
     }
     return responses;
 }