Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/20/10 20:04:08 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on parameterized items
File:
1 edited

Legend:

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

    r2805 r2845  
    2323using HeuristicLab.Core.Views;
    2424using HeuristicLab.MainForm;
     25using System;
    2526
    2627namespace HeuristicLab.Operators.Views {
     
    3031  [Content(typeof(Operator), true)]
    3132  [Content(typeof(IOperator), false)]
    32   public partial class OperatorView : NamedItemView {
     33  public partial class OperatorView : ParameterizedNamedItemView {
    3334    public new IOperator Content {
    3435      get { return (IOperator)base.Content; }
     
    5152    }
    5253
     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
    5372    protected override void OnContentChanged() {
    5473      base.OnContentChanged();
    5574      if (Content == null) {
    56         parameterCollectionView.Content = null;
     75        breakpointCheckBox.Checked = false;
     76        breakpointCheckBox.Enabled = false;
    5777      } else {
    58         parameterCollectionView.Content = ((IOperator)Content).Parameters;
     78        breakpointCheckBox.Checked = Content.Breakpoint;
    5979      }
     80    }
     81
     82    private void Content_BreakpointChanged(object sender, EventArgs e) {
     83      if (InvokeRequired)
     84        Invoke(new EventHandler(Content_DescriptionChanged), sender, e);
     85      else
     86        breakpointCheckBox.Checked = Content.Breakpoint;
     87    }
     88
     89    private void breakpointCheckBox_CheckedChanged(object sender, System.EventArgs e) {
     90      if (Content != null) Content.Breakpoint = breakpointCheckBox.Checked;
    6091    }
    6192  }
Note: See TracChangeset for help on using the changeset viewer.