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