private void btnEditBoat_Click(object sender, RoutedEventArgs e) { var boat = (Boat)dgBoatInventory.SelectedItem; var addEditForm = new frmBoatAddEdit(boat, _boatManager); var result = addEditForm.ShowDialog(); if (result == true) { // refresh _boatInventory and dgBoatInventory.Items } else { MessageBox.Show("Edit operation aborted."); } //if(dgBoatInventory.SelectedIndex.Equals(-1)) //{ // MessageBox.Show("Please select a boat to edit!"); //} }
private void btnAddBoat_Click(object sender, RoutedEventArgs e) { var addEditForm = new frmBoatAddEdit(_boatManager); addEditForm.ShowDialog(); }