private void NuevoEmpleado_Click(object sender, RoutedEventArgs e) { Employee emp = new Employee(); EditorEmpleado editor = new EditorEmpleado(emp); editor.Show(); editor.Closed += (o, ev) => { if (!editor.NotSaved) { Employee.GetEmployees().Add(editor.EmpleadoGuardado); } else { MessageBox.Show("No se guardó el Empleado!"); } }; }
private void MiEditarTextGrid_Click(object sender, RoutedEventArgs e) { Employee emp = dataGrid.SelectedItem as Employee; if (emp != null) { Employee copia = new Employee(emp); EditorEmpleado editor = new EditorEmpleado(copia); editor.Show(); editor.Closed += (o, ev) => { if (!editor.NotSaved) { emp.UpdateValuesFromEmployee(copia); } }; } else { MessageBox.Show("El registro era nulo"); } }