private void PatientClick(object sender, RoutedEventArgs e) { if (mainModel.SelectedPatient != null) { DatientDataViewModel model = new DatientDataViewModel { Patient = mainModel.SelectedPatient }; DatientData window = new DatientData { DataContext = model }; window.ShowDialog(); } }
private void NewPatientClick(object sender, RoutedEventArgs e) { mainModel.SelectedPatient = new Patient { Birthday = DateTime.Now }; DatientDataViewModel model = new DatientDataViewModel { Patient = mainModel.SelectedPatient }; DatientData window = new DatientData { DataContext = model }; window.ShowDialog(); if (window.DialogResult == true) { mainModel.PatientList.Add(mainModel.SelectedPatient); } }