Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/03/10 06:46:30 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • implemented reviewers' comments
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators.Views/3.3/AlgorithmOperatorView.cs

    r2834 r2917  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Core.Views;
     
    2829  /// The base class for visual representations of items.
    2930  /// </summary>
     31  [View("AlgorithmOperator View")]
    3032  [Content(typeof(AlgorithmOperator), true)]
    3133  public partial class AlgorithmOperatorView : NamedItemView {
     
    5052    }
    5153
     54    /// <summary>
     55    /// Removes the eventhandlers from the underlying <see cref="IOperatorGraph"/>.
     56    /// </summary>
     57    /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
     58    protected override void DeregisterContentEvents() {
     59      Content.BreakpointChanged -= new EventHandler(Content_BreakpointChanged);
     60      base.DeregisterContentEvents();
     61    }
     62
     63    /// <summary>
     64    /// Adds eventhandlers to the underlying <see cref="IOperatorGraph"/>.
     65    /// </summary>
     66    /// <remarks>Calls <see cref="ViewBase.AddItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
     67    protected override void RegisterContentEvents() {
     68      base.RegisterContentEvents();
     69      Content.BreakpointChanged += new EventHandler(Content_BreakpointChanged);
     70    }
     71
    5272    protected override void OnContentChanged() {
    5373      base.OnContentChanged();
    5474      if (Content == null) {
     75        breakpointCheckBox.Checked = false;
     76        breakpointCheckBox.Enabled = false;
    5577        parameterCollectionView.Content = null;
    5678        operatorGraphViewHost.Content = null;
    5779        tabControl.Enabled = false;
    5880      } else {
     81        breakpointCheckBox.Checked = Content.Breakpoint;
     82        breakpointCheckBox.Enabled = true;
    5983        parameterCollectionView.Content = ((IOperator)Content).Parameters;
    6084        operatorGraphViewHost.Content = Content.OperatorGraph;
     
    6286      }
    6387    }
     88
     89    protected void Content_BreakpointChanged(object sender, EventArgs e) {
     90      if (InvokeRequired)
     91        Invoke(new EventHandler(Content_DescriptionChanged), sender, e);
     92      else
     93        breakpointCheckBox.Checked = Content.Breakpoint;
     94    }
     95
     96    protected void breakpointCheckBox_CheckedChanged(object sender, System.EventArgs e) {
     97      if (Content != null) Content.Breakpoint = breakpointCheckBox.Checked;
     98    }
    6499  }
    65100}
Note: See TracChangeset for help on using the changeset viewer.