コード例 #1
0
        public override void OnEnter()
        {
            if (Settings.IsOfflineMode)
            {
                MessageBox.Show("Dit scherm is niet beschikbaar in offline mode.");
                _router.GoBack();
                return;
            }

            TemplateQuestions.Clear();

            if (ViewBag?.Template == null)
            {
                Checklist = new Checklist();
                return;
            }

            Checklist = ViewBag.Template.GetCleanModel();

            const string regex = "\\s{1}[Vv]{1}\\d{1,}$";

            if (Regex.Match(Checklist.Name, regex).Success)
            {
                Checklist.Name = Regex.Replace(Checklist.Name, regex, string.Empty);
            }

            Checklist.Name += $" v{Checklist.Version}";

            RaisePropertyChanged(nameof(Checklist));

            _checklistQuestionRepository.GetChecklistQuestions(Checklist.Parent).ForEach(q => TemplateQuestions.Add(q.GetCleanModel()));

            _questionRepository.All().ForEach(ExistingQuestions.Add);
        }