//when the user clicks the add doctor button + private void addDoctorButton_Click(object sender, RoutedEventArgs e) { NewDoctorWindow newDocWindow = new NewDoctorWindow(false); //false-> clear edit mode newDocWindow.Owner = this; newDocWindow.Show(); }
//when the user clicks the edit doctor button private void editDoctorButton_Click(object sender, RoutedEventArgs e) { if (docListGrid.SelectedItem != null) { Doctor doc = (Doctor)docListGrid.SelectedItem; NewDoctorWindow newDocWindow = new NewDoctorWindow(doc.Name, doc.Days, doc.Hours, true); //true -> set edit mode newDocWindow.Owner = this; newDocWindow.Show(); } }