private void ButtonCreateNew_Click(object sender, RoutedEventArgs e) { Window create_window = new EmployeeRecordWindow(WaysToOpenForm.WaysToOpen.create); create_window.ShowDialog(); RefreshList(); }
private void ButtonEdit_Click(object sender, RoutedEventArgs e) { List <string> loginsToEdit = new List <string>(); foreach (DataRowView row in employeesGrid.SelectedItems) { loginsToEdit.Add(row.Row.ItemArray[0].ToString()); } if (loginsToEdit.Count > 0) { Window edit_window; //Первые окна мы открываем немодально, последнее модально, чтоб потом сразу обновились данные на форме if (loginsToEdit.Count > 1) { for (int i = 0; i < loginsToEdit.Count - 1; i++) { edit_window = new EmployeeRecordWindow(WaysToOpenForm.WaysToOpen.edit, loginsToEdit[i]); edit_window.Show(); } } //Заключительная форма edit_window = new EmployeeRecordWindow(WaysToOpenForm.WaysToOpen.edit, loginsToEdit[loginsToEdit.Count - 1]); edit_window.ShowDialog(); //Обновление списка RefreshList(); } }
private void DataGridCell_MouseDoubleClick(object sender, MouseButtonEventArgs e) { int row_index = employeesGrid.SelectedIndex; string login = ""; int current_row = 0; foreach (DataRowView row in employeesGrid.Items) { if (current_row != row_index) { current_row++; continue; } login = row.Row.ItemArray[0].ToString(); break; } Window edit_window = new EmployeeRecordWindow(WaysToOpenForm.WaysToOpen.edit, login); edit_window.ShowDialog(); RefreshList(); }