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