Changeset 10622
- Timestamp:
- 03/19/14 13:28:28 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataGridContentView.cs
r10621 r10622 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Drawing; 24 25 using System.Linq; 25 26 using System.Windows.Forms; 26 using HeuristicLab.Data.Views;27 27 using HeuristicLab.MainForm; 28 using System.Drawing;29 28 30 29 namespace HeuristicLab.DataPreprocessing.Views { … … 53 52 dataGridView.CellMouseClick += dataGridView_CellMouseClick; 54 53 dataGridView.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(dataGridView_CellPainting); 54 dataGridView.KeyUp += dataGridView_KeyUp; 55 55 contextMenuCell.Items.Add(ShowHideColumns); 56 } 57 58 void dataGridView_KeyUp(object sender, KeyEventArgs e) { 59 var selectedRows = dataGridView.SelectedRows; 60 if (e.KeyCode == Keys.Delete && selectedRows.Count > 0) { 61 List<int> rows = new List<int>(); 62 for (int i = 0; i < selectedRows.Count; ++i) { 63 rows.Add(selectedRows[i].Index); 64 } 65 triggersOwnEvent(() => { 66 Content.DataGridLogic.DeleteRow(rows); 67 OnContentChanged(); 68 }); 69 } 56 70 } 57 71 … … 73 87 void Content_Changed(object sender, DataPreprocessingChangedEventArgs e) { 74 88 if (notOwnEvent) { 75 dataGridView.Refresh(); 89 switch (e.Type) { 90 case DataPreprocessingChangedEventType.AddColumn: 91 case DataPreprocessingChangedEventType.AddRow: 92 case DataPreprocessingChangedEventType.DeleteColumn: 93 case DataPreprocessingChangedEventType.DeleteRow: 94 case DataPreprocessingChangedEventType.Any: 95 OnContentChanged(); 96 break; 97 case DataPreprocessingChangedEventType.ChangeColumn: 98 case DataPreprocessingChangedEventType.ChangeItem: 99 dataGridView.Refresh(); 100 break; 101 } 102 76 103 } 77 104 } … … 183 210 var selectedCells = new Dictionary<int, List<int>>(); 184 211 for (int i = 0; i < dataGridView.SelectedCells.Count; i++) { 185 var columnIndex =dataGridView.SelectedCells[i].ColumnIndex;186 if (!selectedCells.ContainsKey(columnIndex)){187 selectedCells.Add(columnIndex, new List<int>());212 var columnIndex = dataGridView.SelectedCells[i].ColumnIndex; 213 if (!selectedCells.ContainsKey(columnIndex)) { 214 selectedCells.Add(columnIndex, new List<int>()); 188 215 } 189 216 selectedCells[columnIndex].Add(dataGridView.SelectedCells[i].RowIndex); -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataGridLogic.cs
r10621 r10622 120 120 } 121 121 122 public void DeleteRow(List<int> rows) { 123 preprocessingData.InTransaction(() => { 124 foreach (int rowIndex in rows) { 125 preprocessingData.DeleteRow(rowIndex); 126 } 127 }); 128 } 129 122 130 public event DataPreprocessingChangedEventHandler Changed { 123 131 add { preprocessingData.Changed += value; } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IDataGridLogic.cs
r10621 r10622 36 36 37 37 event DataPreprocessingChangedEventHandler Changed; 38 39 void DeleteRow(List<int> rows); 38 40 } 39 41 }
Note: See TracChangeset
for help on using the changeset viewer.