Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4888


Ignore:
Timestamp:
11/22/10 01:26:55 (14 years ago)
Author:
swagner
Message:

Trivial changes due to review of r4883 (#1284)

Location:
trunk/sources
Files:
4 edited

Legend:

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

    r4883 r4888  
    7171      Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    7272      Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    73       Content.UpdateOfRunsInProgress += new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress);
     73      Content.UpdateOfRunsInProgressChanged += new EventHandler(Content_UpdateOfRunsInProgressChanged);
    7474      RegisterRunEvents(Content);
    7575    }
     
    8181      Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    8282      Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    83       Content.UpdateOfRunsInProgress -= new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress);
     83      Content.UpdateOfRunsInProgressChanged -= new EventHandler(Content_UpdateOfRunsInProgressChanged);
    8484      DeregisterRunEvents(Content);
    8585    }
     
    104104      RegisterRunEvents(e.Items);
    105105    }
    106     private void Content_UpdateOfRunsInProgress(object sender, EventArgs<bool> e) {
     106    private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) {
    107107      if (InvokeRequired)
    108         Invoke(new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress), sender, e);
     108        Invoke(new EventHandler(Content_UpdateOfRunsInProgressChanged), sender, e);
    109109      else {
    110         suppressUpdates = e.Value;
     110        suppressUpdates = Content.UpdateOfRunsInProgress;
    111111        if (!suppressUpdates) UpdateDataPoints();
    112112      }
     
    339339      if (this.chart.Series.Count > 0) {
    340340        noRunsLabel.Visible = false;
     341        showStatisticsCheckBox.Enabled = true;
    341342        splitContainer.Panel2Collapsed = !showStatisticsCheckBox.Checked;
    342343      } else {
    343344        noRunsLabel.Visible = true;
     345        showStatisticsCheckBox.Enabled = false;
    344346        splitContainer.Panel2Collapsed = true;
    345347      }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r4883 r4888  
    8989      Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    9090      Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    91       Content.UpdateOfRunsInProgress += new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress);
     91      Content.UpdateOfRunsInProgressChanged += new EventHandler(Content_UpdateOfRunsInProgressChanged);
    9292      RegisterRunEvents(Content);
    9393    }
     
    9999      Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    100100      Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    101       Content.UpdateOfRunsInProgress -= new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress);
     101      Content.UpdateOfRunsInProgressChanged -= new EventHandler(Content_UpdateOfRunsInProgressChanged);
    102102      DeregisterRunEvents(Content);
    103103    }
     
    205205
    206206
    207     private void Content_UpdateOfRunsInProgress(object sender, EventArgs<bool> e) {
     207    private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) {
    208208      if (InvokeRequired)
    209         Invoke(new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress), sender, e);
     209        Invoke(new EventHandler(Content_UpdateOfRunsInProgressChanged), sender, e);
    210210      else {
    211         suppressUpdates = e.Value;
     211        suppressUpdates = Content.UpdateOfRunsInProgress;
    212212        if (!suppressUpdates) UpdateDataPoints();
    213213      }
     
    377377    }
    378378
    379     #region drag and drop and tooltip
     379    #region Drag & drop and tooltip
    380380    private IRun draggedRun;
    381381    private void chart_MouseDown(object sender, MouseEventArgs e) {
     
    398398    private void chart_MouseUp(object sender, MouseEventArgs e) {
    399399      if (isSelecting) {
     400        Content.UpdateOfRunsInProgress = true;
    400401        System.Windows.Forms.DataVisualization.Charting.Cursor xCursor = chart.ChartAreas[0].CursorX;
    401402        System.Windows.Forms.DataVisualization.Charting.Cursor yCursor = chart.ChartAreas[0].CursorY;
     
    429430        this.chart.ChartAreas[0].CursorX.SelectionStart = this.chart.ChartAreas[0].CursorX.SelectionEnd;
    430431        this.chart.ChartAreas[0].CursorY.SelectionStart = this.chart.ChartAreas[0].CursorY.SelectionEnd;
     432        Content.UpdateOfRunsInProgress = false;
    431433      }
    432434    }
     
    602604    #endregion
    603605
    604     #region automatic coloring
     606    #region Automatic coloring
    605607    private void colorXAxisButton_Click(object sender, EventArgs e) {
    606608      ColorRuns(xAxisValue);
     
    612614
    613615    private void ColorRuns(string axisValue) {
    614       Content.OnUpdateOfRunsInProgress(true);
     616      Content.UpdateOfRunsInProgress = true;
    615617      var runs = Content.Select(r => new { Run = r, Value = GetValue(r, axisValue) }).Where(r => r.Value.HasValue);
    616618      double minValue = runs.Min(r => r.Value.Value);
     
    623625        r.Run.Color = ColorGradient.Colors[colorIndex];
    624626      }
    625       Content.OnUpdateOfRunsInProgress(false);
     627      Content.UpdateOfRunsInProgress = false;
    626628    }
    627629    #endregion
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionTabularView.cs

    r4883 r4888  
    2424using System.Linq;
    2525using System.Windows.Forms;
    26 using HeuristicLab.Common;
     26using HeuristicLab.Core;
    2727using HeuristicLab.Data.Views;
    2828using HeuristicLab.MainForm;
    29 using HeuristicLab.Core;
    3029
    3130namespace HeuristicLab.Optimization.Views {
     
    6463      Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    6564      Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    66       Content.UpdateOfRunsInProgress += new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress);
     65      Content.UpdateOfRunsInProgressChanged += new EventHandler(Content_UpdateOfRunsInProgressChanged);
    6766      RegisterRunEvents(Content);
    6867    }
     
    7675      Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    7776      Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    78       Content.UpdateOfRunsInProgress -= new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress);
     77      Content.UpdateOfRunsInProgressChanged -= new EventHandler(Content_UpdateOfRunsInProgressChanged);
    7978      DeregisterRunEvents(Content);
    8079    }
     
    126125
    127126
    128     private void Content_UpdateOfRunsInProgress(object sender, Common.EventArgs<bool> e) {
     127    private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) {
    129128      if (InvokeRequired)
    130         Invoke(new EventHandler<EventArgs<bool>>(Content_UpdateOfRunsInProgress), sender, e);
     129        Invoke(new EventHandler(Content_UpdateOfRunsInProgressChanged), sender, e);
    131130      else {
    132         suppressUpdates = e.Value;
     131        suppressUpdates = Content.UpdateOfRunsInProgress;
    133132        if (!suppressUpdates) UpdateRowAttributes();
    134133      }
  • trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs

    r4883 r4888  
    3737
    3838    [StorableConstructor]
    39     protected RunCollection(bool deserializing) : base(deserializing) { }
    40 
     39    protected RunCollection(bool deserializing)
     40      : base(deserializing) {
     41      updateOfRunsInProgress = false;
     42    }
    4143    protected RunCollection(RunCollection original, Cloner cloner)
    4244      : base(original, cloner) {
     45      updateOfRunsInProgress = false;
    4346      resultNames = new List<string>(original.resultNames);
    4447      parameterNames = new List<string>(original.parameterNames);
     
    5558      UpdateFiltering(true);
    5659    }
    57     public override IDeepCloneable Clone(Cloner cloner) {
    58       return new RunCollection(this, cloner);
    59     }
    6060    public RunCollection() : base() { Initialize(); }
    6161    public RunCollection(int capacity) : base(capacity) { Initialize(); }
    6262    public RunCollection(IEnumerable<IRun> collection) : base(collection) { Initialize(); this.OnItemsAdded(collection); }
    6363    private void Initialize() {
     64      updateOfRunsInProgress = false;
    6465      parameterNames = new List<string>();
    6566      resultNames = new List<string>();
     
    8182    public RunCollectionConstraintCollection Constraints {
    8283      get { return constraints; }
     84    }
     85
     86    private bool updateOfRunsInProgress;
     87    public bool UpdateOfRunsInProgress {
     88      get { return updateOfRunsInProgress; }
     89      set {
     90        if (updateOfRunsInProgress != value) {
     91          updateOfRunsInProgress = value;
     92          OnUpdateOfRunsInProgressChanged();
     93        }
     94      }
     95    }
     96
     97    [StorableHook(HookType.AfterDeserialization)]
     98    private void AfterDeserialization() {
     99      if (constraints == null) constraints = new RunCollectionConstraintCollection();
     100      RegisterConstraintsEvents();
     101      RegisterConstraintEvents(constraints);
     102      UpdateFiltering(true);
     103    }
     104
     105    public override IDeepCloneable Clone(Cloner cloner) {
     106      return new RunCollection(this, cloner);
     107    }
     108
     109    public event EventHandler UpdateOfRunsInProgressChanged;
     110    protected virtual void OnUpdateOfRunsInProgressChanged() {
     111      var handler = UpdateOfRunsInProgressChanged;
     112      if (handler != null) handler(this, EventArgs.Empty);
    83113    }
    84114
     
    188218        value = run.Results[columnName];
    189219      return value;
    190     }
    191 
    192     [StorableHook(HookType.AfterDeserialization)]
    193     private void AfterDeserialization() {
    194       if (constraints == null) constraints = new RunCollectionConstraintCollection();
    195       RegisterConstraintsEvents();
    196       RegisterConstraintEvents(constraints);
    197       UpdateFiltering(true);
    198220    }
    199221
     
    285307    #endregion
    286308
    287     #region
    288     public event EventHandler<EventArgs<bool>> UpdateOfRunsInProgress;
    289     public void OnUpdateOfRunsInProgress(bool inProgress) {
    290       var handler = UpdateOfRunsInProgress;
    291       if (handler != null) handler(this, new EventArgs<bool>(inProgress));
    292     }
    293     #endregion
    294 
    295     #region filtering
     309    #region Filtering
    296310    private void UpdateFiltering(bool reset) {
    297       OnUpdateOfRunsInProgress(true);
     311      UpdateOfRunsInProgress = true;
    298312      if (reset)
    299313        list.ForEach(r => r.Visible = true);
    300314      foreach (IRunCollectionConstraint constraint in this.constraints)
    301315        constraint.Check();
    302       OnUpdateOfRunsInProgress(false);
     316      UpdateOfRunsInProgress = false;
    303317    }
    304318
Note: See TracChangeset for help on using the changeset viewer.