Example #1
0
 private void EditPatientButton_Click(object sender, RoutedEventArgs e)
 {
     if (_vm.SelectPatient != null)
     {
         PatientFormViewModel vm          = new PatientFormViewModel(_vm.SelectPatient);
         PatientFormView      patientForm = new PatientFormView {
             DataContext = vm
         };
         patientForm.ShowDialog();
     }
 }
Example #2
0
        private void NewPatientButton_Click(object sender, RoutedEventArgs e)
        {
            PatientFormViewModel vm = new PatientFormViewModel(new Patient())
            {
                IsNew = true
            };
            PatientFormView patientForm = new PatientFormView {
                DataContext = vm
            };

            patientForm.ShowDialog();
            var patientList = _vm.PatientList;

            if (patientForm.DialogResult == true)
            {
                patientList.Add(vm.Patient);
                vm.Save();
            }
        }