Changeset 12694 for branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionView.cs
- Timestamp:
- 07/09/15 13:07:30 (9 years ago)
- Location:
- branches/HeuristicLab.Problems.Orienteering
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.Orienteering
- Property svn:mergeinfo changed
-
Property
svn:global-ignores
set to
*.nuget
packages
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Optimization.Views
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/HLScript/HeuristicLab.Optimization.Views merged eligible /stable/HeuristicLab.Optimization.Views merged eligible /trunk/sources/HeuristicLab.Optimization.Views merged eligible /branches/1721-RandomForestPersistence/HeuristicLab.Optimization.Views 10321-10322 /branches/Algorithms.GradientDescent/HeuristicLab.Optimization.Views 5516-5520 /branches/Benchmarking/sources/HeuristicLab.Optimization.Views 6917-7005 /branches/CloningRefactoring/HeuristicLab.Optimization.Views 4656-4721 /branches/CodeEditor/HeuristicLab.Optimization.Views 11700-11806 /branches/DataAnalysis Refactoring/HeuristicLab.Optimization.Views 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Optimization.Views 5815-6180 /branches/DataAnalysis/HeuristicLab.Optimization.Views 4458-4459,4462,4464 /branches/DataPreprocessing/HeuristicLab.Optimization.Views 10085-11101 /branches/GP.Grammar.Editor/HeuristicLab.Optimization.Views 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Optimization.Views 5060 /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Optimization.Views 11570-12508 /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Optimization.Views 6123-9799 /branches/LogResidualEvaluator/HeuristicLab.Optimization.Views 10202-10483 /branches/NET40/sources/HeuristicLab.Optimization.Views 5138-5162 /branches/NSGA-II Changes/HeuristicLab.Optimization.Views 12033-12122 /branches/ParallelEngine/HeuristicLab.Optimization.Views 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Optimization.Views 7568-7810 /branches/QAPAlgorithms/HeuristicLab.Optimization.Views 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Optimization.Views 6828 /branches/RuntimeOptimizer/HeuristicLab.Optimization.Views 8943-9078 /branches/ScatterSearch (trunk integration)/HeuristicLab.Optimization.Views 7787-8333 /branches/SlaveShutdown/HeuristicLab.Optimization.Views 8944-8956 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Optimization.Views 10204-10479 /branches/SuccessProgressAnalysis/HeuristicLab.Optimization.Views 5370-5682 /branches/TimeLimitRunOptimizer/HeuristicLab.Optimization.Views 9438-12626 /branches/Trunk/HeuristicLab.Optimization.Views 6829-6865 /branches/UnloadJobs/HeuristicLab.Optimization.Views 9168-9215 /branches/VNS/HeuristicLab.Optimization.Views 5594-5752 /branches/histogram/HeuristicLab.Optimization.Views 5959-6341
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionView.cs
r11185 r12694 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 23 23 using System.Collections; 24 24 using System.Collections.Generic; 25 using System.ComponentModel; 25 26 using System.Drawing; 26 27 using System.Linq; … … 40 41 private Dictionary<IRun, List<ListViewItem>> itemListViewItemMapping; 41 42 private bool validDragOperation; 43 private bool suppressUpdates; 42 44 43 45 public new IItemCollection<IRun> Content { … … 65 67 Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved); 66 68 Content.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 69 if (RunCollection != null) 70 RunCollection.UpdateOfRunsInProgressChanged -= new EventHandler(RunCollection_UpdateOfRunsInProgressChanged); 67 71 foreach (IRun run in itemListViewItemMapping.Keys) { 68 72 DeregisterItemEvents(run); … … 75 79 Content.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved); 76 80 Content.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 81 if (RunCollection != null) 82 RunCollection.UpdateOfRunsInProgressChanged += new EventHandler(RunCollection_UpdateOfRunsInProgressChanged); 77 83 } 78 84 private void DeregisterItemEvents(IRun item) { 79 85 item.ItemImageChanged -= new EventHandler(Item_ItemImageChanged); 80 86 item.ToStringChanged -= new EventHandler(Item_ToStringChanged); 81 item. Changed -= new EventHandler(Item_Changed);87 item.PropertyChanged -= Item_PropertyChanged; 82 88 } 83 89 private void RegisterItemEvents(IRun item) { 84 90 item.ItemImageChanged += new EventHandler(Item_ItemImageChanged); 85 91 item.ToStringChanged += new EventHandler(Item_ToStringChanged); 86 item. Changed += new EventHandler(Item_Changed);92 item.PropertyChanged += Item_PropertyChanged; 87 93 } 88 94 … … 385 391 try { 386 392 RunCollection.Modify(); 387 } 388 finally { 393 } finally { 389 394 ReadOnly = false; 390 395 } … … 394 399 #region Content Events 395 400 private void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) { 401 if (suppressUpdates) return; 396 402 if (InvokeRequired) 397 403 Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded), sender, e); … … 407 413 } 408 414 private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) { 415 if (suppressUpdates) return; 409 416 if (InvokeRequired) 410 417 Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved), sender, e); … … 422 429 } 423 430 private void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) { 431 if (suppressUpdates) return; 424 432 if (InvokeRequired) 425 433 Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset), sender, e); … … 440 448 } 441 449 } 450 private void RunCollection_UpdateOfRunsInProgressChanged(object sender, EventArgs e) { 451 if (InvokeRequired) Invoke((Action<object, EventArgs>)RunCollection_UpdateOfRunsInProgressChanged, sender, e); 452 else { 453 suppressUpdates = RunCollection.UpdateOfRunsInProgress; 454 if (!suppressUpdates) { 455 foreach (IRun item in Content) { 456 //remove only the first matching ListViewItem, because the IRun could be contained multiple times in the ItemCollection 457 ListViewItem listViewItem = GetListViewItemsForItem(item).FirstOrDefault(); 458 if (listViewItem != null) RemoveListViewItem(listViewItem); 459 } 460 RebuildImageList(); 461 foreach (IRun item in Content) 462 AddListViewItem(CreateListViewItem(item)); 463 464 AdjustListViewColumnSizes(); 465 analyzeRunsToolStripDropDownButton.Enabled = itemsListView.Items.Count > 0; 466 clearButton.Enabled = itemsListView.Items.Count > 0 && !Content.IsReadOnly && !ReadOnly; 467 runCollectionConstraintCollectionView.ReadOnly = itemsListView.Items.Count == 0; 468 } 469 } 470 } 442 471 #endregion 443 472 444 473 #region Item Events 445 474 private void Item_ItemImageChanged(object sender, EventArgs e) { 475 if (suppressUpdates) return; 446 476 if (InvokeRequired) 447 477 Invoke(new EventHandler(Item_ItemImageChanged), sender, e); … … 453 483 } 454 484 private void Item_ToStringChanged(object sender, EventArgs e) { 485 if (suppressUpdates) return; 455 486 if (InvokeRequired) 456 487 Invoke(new EventHandler(Item_ToStringChanged), sender, e); … … 462 493 } 463 494 } 464 private void Item_Changed(object sender, EventArgs e) { 495 private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e) { 496 if (suppressUpdates) return; 465 497 if (InvokeRequired) 466 this.Invoke(new EventHandler(Item_Changed), sender, e);498 Invoke((Action<object, PropertyChangedEventArgs>)Item_PropertyChanged, sender, e); 467 499 else { 468 500 IRun run = (IRun)sender; 469 UpdateRun(run); 501 if (e.PropertyName == "Color" || e.PropertyName == "Visible") 502 UpdateRun(run); 470 503 } 471 504 }
Note: See TracChangeset
for help on using the changeset viewer.