/// <summary> /// handles the user right clicking and choosing "edit" on the staff grid. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuItemEdit_Click(object sender, RoutedEventArgs e) { writeDebug("Editing staff member"); //Get the MenuItem var menuItem = (MenuItem)sender; //Get the ContextMenu to which the menuItem belongs var contextMenu = (ContextMenu)menuItem.Parent; //Find the item that was right clicked. var item = (DataGrid)contextMenu.PlacementTarget; //get the cells (the row) that was selected. Staff staffToEdit = (Staff)item.SelectedCells[0].Item; //call a new employee popup with the staff member data. var newEmployeePopup = new NewEmployeePopup(this, staffToEdit); newEmployeePopup.Show(); }
/// <summary> /// The user clicks the "add employee" button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddEmployeeBtn_Click(object sender, RoutedEventArgs e) { var newEmployeePopup = new NewEmployeePopup(this); newEmployeePopup.Show(); }