Changeset 12692 for trunk/sources
- Timestamp:
- 07/08/15 15:59:11 (9 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionChartAggregationView.cs
r12631 r12692 242 242 dataRowComboBox.Items.Clear(); 243 243 var resultName = (string)dataTableComboBox.SelectedItem; 244 if (resultName == null) return; 245 244 246 var dataTables = from run in Content 245 247 where run.Results.ContainsKey(resultName) -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionTableView.cs
r12077 r12692 53 53 base.OnContentChanged(); 54 54 if (Content != null) { 55 runToRowMapping = Enumerable.Range(0, Content.Count).ToArray();56 55 UpdateRowAttributes(); 57 56 } … … 151 150 suppressUpdates = Content.UpdateOfRunsInProgress; 152 151 if (!suppressUpdates) { 152 UpdateData(); 153 153 UpdateRowAttributes(); 154 UpdateData();155 154 } 156 155 } … … 179 178 protected override void ClearSorting() { 180 179 base.ClearSorting(); 181 runToRowMapping = Enumerable.Range(0, Content.Count).ToArray();182 180 UpdateRowAttributes(); 183 181 } … … 198 196 i++; 199 197 } 200 UpdateRowAttributes( );198 UpdateRowAttributes(rebuild: false); 201 199 return newSortedIndex; 202 200 } 203 201 204 private void UpdateRowAttributes() { 202 private void UpdateRowAttributes(bool rebuild = true) { 203 if (rebuild) runToRowMapping = Enumerable.Range(0, Content.Count).ToArray(); 205 204 int runIndex = 0; 206 205 foreach (IRun run in Content) { -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionView.cs
r12012 r12692 41 41 private Dictionary<IRun, List<ListViewItem>> itemListViewItemMapping; 42 42 private bool validDragOperation; 43 private bool suppressUpdates; 43 44 44 45 public new IItemCollection<IRun> Content { … … 66 67 Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved); 67 68 Content.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 69 if (RunCollection != null) 70 RunCollection.UpdateOfRunsInProgressChanged -= new EventHandler(RunCollection_UpdateOfRunsInProgressChanged); 68 71 foreach (IRun run in itemListViewItemMapping.Keys) { 69 72 DeregisterItemEvents(run); … … 76 79 Content.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved); 77 80 Content.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 81 if (RunCollection != null) 82 RunCollection.UpdateOfRunsInProgressChanged += new EventHandler(RunCollection_UpdateOfRunsInProgressChanged); 78 83 } 79 84 private void DeregisterItemEvents(IRun item) { … … 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); … … 463 494 } 464 495 private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e) { 496 if (suppressUpdates) return; 465 497 if (InvokeRequired) 466 this.Invoke((Action<object, PropertyChangedEventArgs>)Item_PropertyChanged, sender, e);498 Invoke((Action<object, PropertyChangedEventArgs>)Item_PropertyChanged, sender, e); 467 499 else { 468 500 IRun run = (IRun)sender; -
trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs
r12672 r12692 483 483 #region Filtering 484 484 private void UpdateFiltering(bool reset) { 485 var oldUpateRuns = UpdateOfRunsInProgress; 485 486 UpdateOfRunsInProgress = true; 486 487 if (reset) … … 488 489 foreach (IRunCollectionConstraint constraint in this.constraints) 489 490 constraint.Check(); 490 UpdateOfRunsInProgress = false;491 UpdateOfRunsInProgress = oldUpateRuns; 491 492 } 492 493 … … 550 551 #region Modification 551 552 public void Modify() { 553 var oldUpateRuns = UpdateOfRunsInProgress; 552 554 UpdateOfRunsInProgress = true; 553 555 var runs = this.ToList(); … … 564 566 } 565 567 } 566 UpdateOfRunsInProgress = false;568 UpdateOfRunsInProgress = oldUpateRuns; 567 569 } 568 570
Note: See TracChangeset
for help on using the changeset viewer.