Changeset 9613 for trunk/sources
- Timestamp:
- 06/12/13 13:15:52 (11 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs
r9540 r9613 45 45 } 46 46 47 public ItemCollection<T> ItemCollection { 48 get { return Content as ItemCollection<T>; } 49 } 50 47 51 public bool ShowDetails { 48 52 get { return showDetailsCheckBox.Checked; } … … 232 236 if (e.KeyCode == Keys.Delete) { 233 237 if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) { 234 foreach (ListViewItem item in itemsListView.SelectedItems) 235 Content.Remove((T)item.Tag); 238 if (ItemCollection != null) ItemCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(i => (T)i.Tag)); 239 else { 240 foreach (ListViewItem item in itemsListView.SelectedItems) 241 Content.Remove((T)item.Tag); 242 } 236 243 } 237 244 } … … 304 311 items = items.Select(x => cloner.Clone(x)); 305 312 } 306 foreach (T item in items) 307 Content.Add(item); 313 if (ItemCollection != null) ItemCollection.AddRange(items); 314 else { 315 foreach (T item in items) 316 Content.Add(item); 317 } 308 318 } 309 319 } … … 325 335 protected virtual void removeButton_Click(object sender, EventArgs e) { 326 336 if (itemsListView.SelectedItems.Count > 0) { 327 foreach (ListViewItem item in itemsListView.SelectedItems) 328 Content.Remove((T)item.Tag); 337 if (ItemCollection != null) { 338 ItemCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(i => (T)i.Tag)); 339 } else { 340 foreach (ListViewItem item in itemsListView.SelectedItems) 341 Content.Remove((T)item.Tag); 342 } 329 343 itemsListView.SelectedItems.Clear(); 330 344 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionView.cs
r9456 r9613 255 255 if (e.KeyCode == Keys.Delete) { 256 256 if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) { 257 foreach (ListViewItem item in itemsListView.SelectedItems) 258 Content.Remove((IRun)item.Tag); 257 if (RunCollection != null) { 258 RunCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(i => (IRun)i.Tag)); 259 } else { 260 foreach (ListViewItem item in itemsListView.SelectedItems) 261 Content.Remove((IRun)item.Tag); 262 } 259 263 } 260 264 } … … 350 354 private void removeButton_Click(object sender, EventArgs e) { 351 355 if (itemsListView.SelectedItems.Count > 0) { 352 foreach (ListViewItem item in itemsListView.SelectedItems) 353 Content.Remove((IRun)item.Tag); 356 if (RunCollection != null) { 357 RunCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(i => (IRun)i.Tag)); 358 } else { 359 foreach (ListViewItem item in itemsListView.SelectedItems) 360 Content.Remove((IRun)item.Tag); 361 } 354 362 itemsListView.SelectedItems.Clear(); 355 363 } … … 377 385 try { 378 386 RunCollection.Modify(); 379 } finally { 387 } 388 finally { 380 389 ReadOnly = false; 381 390 }
Note: See TracChangeset
for help on using the changeset viewer.