Exemple #1
0
        private void CommandBinding_SaveAsVariant_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            var diagnosis = GetCurrent();

            if (diagnosis == null)
            {
                return;
            }
            var diagnosisGroup = diagnosis.DiagnosisGroup;
            var name           = TextBoxController.TextGet(NameTextBox);

            if (string.IsNullOrEmpty(name) ||
                DiagnosisCollection.Any(d => d.Name == TextBoxController.TextGet(NameTextBox)))
            {
                TextBoxController.AppendText("Please enter variant name", NameTextBox);
                return;
            }

            var text = PreviewBox.Text;

            if (string.IsNullOrEmpty(text))
            {
                PreviewBox.Text = "Please enter report text";
                return;
            }

            NameTextBox.Focus();
            NameTextBox.SelectAll();
            DiagnosisCollection.Add(new Diagnosis(name, text, diagnosisGroup));
            Repository.SaveCollection(DiagnosisCollection);
        }
Exemple #2
0
        public void PrintDiagnosis(Diagnosis diagnosis)
        {
            TextBoxController.ReplaceTextBox(diagnosis.Text, PreviewBox);
            TextBoxController.TextAdd(diagnosis.Text, EditBox);
            NameTextBox.Text = diagnosis.Name;
            diagnosis.IncrementUseCount();
            var diagnosisView = CollectionViewSource.GetDefaultView(DiagnosisCollection);

            diagnosisView.MoveCurrentTo(diagnosis);
            diagnosisView.Refresh();
            FilterController.ClearFilter();
        }
Exemple #3
0
        public void CommandBinding_SaveAsNewDiagnosisCommand(object sender, RoutedEventArgs e)
        {
            var name = TextBoxController.TextGet(NameTextBox);

            if (string.IsNullOrEmpty(name) ||
                DiagnosisCollection.Any(d => d.Name == name))
            {
                TextBoxController.ReplaceTextBox("Please enter new name", NameTextBox);
                return;
            }

            var text = TextBoxController.TextGet(EditBox);

            if (string.IsNullOrEmpty(text))
            {
                TextBoxController.ReplaceTextBox("Please enter report text", EditBox);
                return;
            }

            NameTextBox.Focus();
            NameTextBox.SelectAll();
            DiagnosisCollection.Add(new Diagnosis(name, text));
            Repository.SaveCollection(DiagnosisCollection);
        }