Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/04/14 19:40:22 (10 years ago)
Author:
abeham
Message:

#2120:

  • Parameters and Results are now ObservableDictionaries
  • PropertyChanged event handler replaces the Changed event handler
  • RunCollection listens to changed events to each run's parameters and results (8 additional event handlers per run)
Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBoxPlotView.cs

    r11171 r11344  
    2222using System;
    2323using System.Collections.Generic;
     24using System.ComponentModel;
    2425using System.Linq;
    2526using System.Windows.Forms;
     
    9293    protected virtual void RegisterRunEvents(IEnumerable<IRun> runs) {
    9394      foreach (IRun run in runs)
    94         run.Changed += new EventHandler(run_Changed);
     95        run.PropertyChanged += run_PropertyChanged;
    9596    }
    9697    protected virtual void DeregisterRunEvents(IEnumerable<IRun> runs) {
    9798      foreach (IRun run in runs)
    98         run.Changed -= new EventHandler(run_Changed);
     99        run.PropertyChanged -= run_PropertyChanged;
    99100    }
    100101
     
    133134      }
    134135    }
    135     private void run_Changed(object sender, EventArgs e) {
     136    private void run_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    136137      if (InvokeRequired)
    137         this.Invoke(new EventHandler(run_Changed), sender, e);
     138        this.Invoke((Action<object, PropertyChangedEventArgs>)run_PropertyChanged, sender, e);
    138139      else if (!suppressUpdates) {
    139         UpdateDataPoints();
     140        if (e.PropertyName == "Visible")
     141          UpdateDataPoints();
    140142      }
    141143    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs

    r11171 r11344  
    2222using System;
    2323using System.Collections.Generic;
     24using System.ComponentModel;
    2425using System.Drawing;
    2526using System.Linq;
     
    116117    protected virtual void RegisterRunEvents(IEnumerable<IRun> runs) {
    117118      foreach (IRun run in runs)
    118         run.Changed += new EventHandler(run_Changed);
     119        run.PropertyChanged += run_PropertyChanged;
    119120    }
    120121    protected virtual void DeregisterRunEvents(IEnumerable<IRun> runs) {
    121122      foreach (IRun run in runs)
    122         run.Changed -= new EventHandler(run_Changed);
     123        run.PropertyChanged -= run_PropertyChanged;
    123124    }
    124125
     
    133134      RegisterRunEvents(e.Items);
    134135    }
    135     private void run_Changed(object sender, EventArgs e) {
     136    private void run_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    136137      if (suppressUpdates) return;
    137138      if (InvokeRequired)
    138         this.Invoke(new EventHandler(run_Changed), sender, e);
     139        this.Invoke((Action<object, PropertyChangedEventArgs>)run_PropertyChanged, sender, e);
    139140      else {
    140         IRun run = (IRun)sender;
    141         UpdateRun(run);
    142         UpdateCursorInterval();
    143         chart.ChartAreas[0].RecalculateAxesScale();
    144         UpdateAxisLabels();
     141        if (e.PropertyName == "Color" || e.PropertyName == "Visible") {
     142          IRun run = (IRun)sender;
     143          UpdateRun(run);
     144          UpdateCursorInterval();
     145          chart.ChartAreas[0].RecalculateAxesScale();
     146          UpdateAxisLabels();
     147        }
    145148      }
    146149    }
     
    670673      if (xAxisValue != null)
    671674        xAxis.Title = xAxisValue;
    672       if(yAxisValue != null)
    673       yAxis.Title = yAxisValue;
     675      if (yAxisValue != null)
     676        yAxis.Title = yAxisValue;
    674677    }
    675678
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionChartAggregationView.cs

    r11171 r11344  
    2222using System;
    2323using System.Collections.Generic;
     24using System.ComponentModel;
    2425using System.Linq;
    2526using System.Windows.Forms;
     
    111112
    112113    private void RegisterRunEvents(IRun run) {
    113       run.Changed += new System.EventHandler(run_Changed);
     114      run.PropertyChanged += run_PropertyChanged;
    114115    }
    115116    private void DeregisterRunEvents(IRun run) {
    116       run.Changed -= new System.EventHandler(run_Changed);
    117     }
    118     private void run_Changed(object sender, EventArgs e) {
     117      run.PropertyChanged -= run_PropertyChanged;
     118    }
     119    private void run_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    119120      if (suppressUpdates) return;
    120       var run = (IRun)sender;
    121       UpdateRuns(new IRun[] { run });
     121      if (InvokeRequired) {
     122        Invoke((Action<object, PropertyChangedEventArgs>)run_PropertyChanged, sender, e);
     123      } else {
     124        var run = (IRun)sender;
     125        if (e.PropertyName == "Color" || e.PropertyName == "Visible")
     126          UpdateRuns(new IRun[] { run });
     127      }
    122128    }
    123129    #endregion
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionTableView.cs

    r11171 r11344  
    2222using System;
    2323using System.Collections.Generic;
     24using System.ComponentModel;
    2425using System.Linq;
    2526using System.Windows.Forms;
     
    7071    private void RegisterRunEvents(IEnumerable<IRun> runs) {
    7172      foreach (IRun run in runs)
    72         run.Changed += new EventHandler(run_Changed);
     73        run.PropertyChanged += run_PropertyChanged;
    7374    }
    7475    protected override void DeregisterContentEvents() {
     
    8384    private void DeregisterRunEvents(IEnumerable<IRun> runs) {
    8485      foreach (IRun run in runs)
    85         run.Changed -= new EventHandler(run_Changed);
     86        run.PropertyChanged -= run_PropertyChanged;
    8687    }
    8788    private void Content_CollectionReset(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
     
    100101      else UpdateCaption();
    101102    }
    102     private void run_Changed(object sender, EventArgs e) {
     103    private void run_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    103104      if (suppressUpdates) return;
    104105      if (InvokeRequired)
    105         this.Invoke(new EventHandler(run_Changed), sender, e);
     106        this.Invoke((Action<object, PropertyChangedEventArgs>)run_PropertyChanged, sender, e);
    106107      else {
    107108        IRun run = (IRun)sender;
    108         UpdateRun(run);
     109        if (e.PropertyName == "Color" || e.PropertyName == "Visible")
     110          UpdateRun(run);
    109111      }
    110112    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionView.cs

    r11171 r11344  
    2323using System.Collections;
    2424using System.Collections.Generic;
     25using System.ComponentModel;
    2526using System.Drawing;
    2627using System.Linq;
     
    7980      item.ItemImageChanged -= new EventHandler(Item_ItemImageChanged);
    8081      item.ToStringChanged -= new EventHandler(Item_ToStringChanged);
    81       item.Changed -= new EventHandler(Item_Changed);
     82      item.PropertyChanged -= Item_PropertyChanged;
    8283    }
    8384    private void RegisterItemEvents(IRun item) {
    8485      item.ItemImageChanged += new EventHandler(Item_ItemImageChanged);
    8586      item.ToStringChanged += new EventHandler(Item_ToStringChanged);
    86       item.Changed += new EventHandler(Item_Changed);
     87      item.PropertyChanged += Item_PropertyChanged;
    8788    }
    8889
     
    385386      try {
    386387        RunCollection.Modify();
    387       }
    388       finally {
     388      } finally {
    389389        ReadOnly = false;
    390390      }
     
    462462      }
    463463    }
    464     private void Item_Changed(object sender, EventArgs e) {
     464    private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    465465      if (InvokeRequired)
    466         this.Invoke(new EventHandler(Item_Changed), sender, e);
     466        this.Invoke((Action<object, PropertyChangedEventArgs>)Item_PropertyChanged, sender, e);
    467467      else {
    468468        IRun run = (IRun)sender;
    469         UpdateRun(run);
     469        if (e.PropertyName == "Color" || e.PropertyName == "Visible")
     470          UpdateRun(run);
    470471      }
    471472    }
Note: See TracChangeset for help on using the changeset viewer.