private void ButtonEditDepartment_Click(object sender, RoutedEventArgs e) { if (null == ListViewDepartaments.SelectedItem) { return; } Department editIt = (Department)ListViewDepartaments.SelectedItem; if (editIt.Id == 0) { SystemSounds.Hand.Play(); MessageBox.Show("Это не отдел, его нельзя редактировать!", "Ошибочка вышла...", MessageBoxButton.OK, MessageBoxImage.Warning); return; } EditDepartmentWindow editDepartment = new EditDepartmentWindow(); editDepartment.Department = editIt; editDepartment.ShowDialog(); }
// окна редактирования private void OpenEditDepartmentWindowMethod(Department department) { EditDepartmentWindow newDepartmentWindow = new EditDepartmentWindow(department); SetCenterPositionOpen(newDepartmentWindow); }
private void EditDepartmentWindow() { EditDepartmentWindow newEditDepartmentWindow = new EditDepartmentWindow(); SetCurrentPositionAndOpenWindow(newEditDepartmentWindow); }