Changeset 10852 for branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataGridContentView.cs
- Timestamp:
- 05/14/14 15:32:47 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataGridContentView.cs
r10844 r10852 88 88 if (Content != null) { 89 89 Content.DataGridLogic.SetSelection(GetSelectedCells()); 90 if (AreMultipleCellsSelected()) { 91 ResetHighlightedCellsBackground(); 92 HightlightedCellsBackground = GetSelectedCells(); 93 searchIterator = null; 94 } 90 95 } 91 96 } … … 120 125 } 121 126 } 127 searchIterator = null; 122 128 } 123 129 … … 164 170 findAndReplaceDialog = new SearchAndReplaceDialog(); 165 171 findAndReplaceDialog.Show(this); 166 HightlightedCellsBackground = GetSelectedCells(); 167 dataGridView.ClearSelection(); 172 if (AreMultipleCellsSelected()) { 173 HightlightedCellsBackground = GetSelectedCells(); 174 dataGridView.ClearSelection(); 175 } 168 176 findAndReplaceDialog.FindAllEvent += findAndReplaceDialog_FindAllEvent; 169 177 findAndReplaceDialog.FindNextEvent += findAndReplaceDialog_FindNextEvent; … … 171 179 findAndReplaceDialog.ReplaceNextEvent += findAndReplaceDialog_ReplaceEvent; 172 180 findAndReplaceDialog.FormClosing += findAndReplaceDialog_FormClosing; 181 searchIterator = null; 173 182 } 174 183 … … 176 185 ResetHighlightedCells(); 177 186 ResetHighlightedCellsBackground(); 187 searchIterator = null; 178 188 } 179 189 … … 193 203 currentSearchText = findAndReplaceDialog.GetSearchText(); 194 204 } 205 if (IsOneCellSelected()) { 206 var first = GetSelectedCells().First(); 207 searchIterator.SetStartCell(first.Key, first.Value[0]); 208 } 209 195 210 196 211 bool moreOccurences = false; … … 198 213 currentCell = searchIterator.GetCurrent(); 199 214 moreOccurences = searchIterator.MoveNext(); 215 if (IsOneCellSelected()) { 216 var first = GetSelectedCells().First(); 217 if (currentCell.Item1 == first.Key && currentCell.Item2 == first.Value[0]) { 218 if (!moreOccurences) { 219 searchIterator.Reset(); 220 } 221 currentCell = searchIterator.GetCurrent(); 222 moreOccurences = searchIterator.MoveNext(); 223 224 } 225 } 200 226 } while (moreOccurences && (currentCell == null || !Content.GetValue(currentCell.Item2, currentCell.Item1).Equals(currentSearchText))); 201 227 202 228 if (currentCell != null) { 203 HightlightedCells = TransformToDictionary(currentCell);204 dataGridView .FirstDisplayedCell = dataGridView[currentCell.Item1, currentCell.Item2];229 dataGridView.ClearSelection(); 230 dataGridView[currentCell.Item1, currentCell.Item2].Selected = true; 205 231 } else { 206 232 ResetHighlightedCells(); 207 233 } 208 234 209 if (!moreOccurences) { 210 searchIterator.Reset(); 211 } 235 //if (!moreOccurences) { 236 // searchIterator.Reset(); 237 // dataGridView.ClearSelection(); 238 // currentCell = searchIterator.GetCurrent(); 239 // dataGridView[currentCell.Item1, currentCell.Item2].Selected = true; 240 //} 241 } 242 243 private bool AreMultipleCellsSelected() { 244 return GetSelectedCellCount() > 1; 245 } 246 247 private bool IsOneCellSelected() { 248 return GetSelectedCellCount() == 1; 249 } 250 251 private int GetSelectedCellCount() { 252 int count = 0; 253 foreach (var column in GetSelectedCells()) { 254 count += column.Value.Count(); 255 } 256 return count; 212 257 } 213 258
Note: See TracChangeset
for help on using the changeset viewer.