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