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); }
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(); }
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); }