private void Button_confirm_edit(object sender, RoutedEventArgs e) { if (sessionViewModel.SelectedItem.Date.Length != 0 && sessionViewModel.SelectedItem.Timeslot_1.Length != 0 && sessionViewModel.SelectedItem.Title.Length != 0 && sessionViewModel.SelectedItem.Speaker_1.Length != 0 && sessionViewModel.SelectedItem.Room_1.Length != 0 ) { // check if there is already a session going on the new room being edited to // check newRoom == anotherRoom timeslot and date //datePicker1 //timeslotComboBox //roomComboBox //speakerComboBox //titleTextBox Session a = sessionViewModel.SelectedItem; if (sessionViewModel.checkIfExists(sessionViewModel.SelectedItem)) { MessageBox.Show("This Room is taken on this timeslot and Date"); return; } sessionViewModel.EditSession(sessionViewModel.SelectedItem); MyDialogHost.IsOpen = false; } else { MessageBox.Show("Fields cannot be empty"); } }