Changeset 4203 for trunk/sources
- Timestamp:
- 08/12/10 11:57:28 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs
r4099 r4203 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using System.Windows.Forms; 25 26 using HeuristicLab.Collections; … … 271 272 else { 272 273 foreach (T item in e.Items) { 273 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) {274 RemoveListViewItem(listViewItem);275 break;276 }274 //remove only the first matching ListViewItem, because the IItem could be contained multiple times in the ItemCollection 275 ListViewItem listviewItem = GetListViewItemsForItem(item).FirstOrDefault(); 276 if (listviewItem != null) 277 RemoveListViewItem(listviewItem); 277 278 } 278 279 } … … 283 284 else { 284 285 foreach (T item in e.OldItems) { 285 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) {286 RemoveListViewItem(listViewItem);287 break;288 }286 //remove only the first matching ListViewItem, because the IItem could be contained multiple times in the ItemCollection 287 ListViewItem listviewItem = GetListViewItemsForItem(item).FirstOrDefault(); 288 if (listviewItem != null) 289 RemoveListViewItem(listviewItem); 289 290 } 290 291 foreach (T item in e.Items) -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs
r4200 r4203 316 316 DeregisterRunEvents(e.Items); 317 317 foreach (IRun item in e.Items) { 318 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) {319 RemoveListViewItem(listViewItem);320 break;321 }318 //remove only the first matching ListViewItem, because the IRun could be contained multiple times in the ItemCollection 319 ListViewItem listviewItem = GetListViewItemsForItem(item).FirstOrDefault(); 320 if (listviewItem != null) 321 RemoveListViewItem(listviewItem); 322 322 } 323 323 analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0; … … 332 332 DeregisterRunEvents(e.OldItems); 333 333 foreach (IRun item in e.OldItems) { 334 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) {335 RemoveListViewItem(listViewItem);336 break;337 }334 //remove only the first matching ListViewItem, because the IRun could be contained multiple times in the ItemCollection 335 ListViewItem listviewItem = GetListViewItemsForItem(item).FirstOrDefault(); 336 if (listviewItem != null) 337 RemoveListViewItem(listviewItem); 338 338 } 339 339 RegisterRunEvents(e.Items);
Note: See TracChangeset
for help on using the changeset viewer.