Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/28/10 23:58:59 (14 years ago)
Author:
cneumuel
Message:

#1215 worked on metaoptimization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/OptimizableView.cs

    r4981 r4984  
    2929    protected override void DeregisterContentEvents() {
    3030      Content.OptimizeChanged -= new EventHandler(Content_OptimizeChanged);
     31      Content.IsOptimizableChanged -= new EventHandler(Content_IsOptimizabeChanged);
    3132      base.DeregisterContentEvents();
    3233    }
     
    3435    protected override void RegisterContentEvents() {
    3536      base.RegisterContentEvents();
     37      Content.IsOptimizableChanged += new EventHandler(Content_IsOptimizabeChanged);
    3638      Content.OptimizeChanged += new EventHandler(Content_OptimizeChanged);
    3739    }
     
    4648          this.viewHost.ViewType = null;
    4749          if (Content is IParameterConfiguration) {
    48             // this is a shortcut if only one possible ValueConfiguration is available
    49             //if (((IParameterConfiguration)Content).ValueConfigurations.Count == 1) {
    50             //  IValueConfiguration vc = ((IParameterConfiguration)Content).ValueConfigurations.First();
    51             //  vc.Optimize = true;
    52             //  this.viewHost.Content = vc;
    53             //} else {
    54             //  this.viewHost.Content = ((IParameterConfiguration)Content).ValueConfigurations;
    55             //}
    5650            this.viewHost.Content = ((IParameterConfiguration)Content).ValueConfigurations;
    5751          } else if (Content is IValueConfiguration) {
    5852            if (Content.ConstrainedValue.ValueDataType == typeof(IntValue) ||
    59                 Content.ConstrainedValue.ValueDataType == typeof(DoubleValue)) {
     53                Content.ConstrainedValue.ValueDataType == typeof(DoubleValue) ||
     54                Content.ConstrainedValue.ValueDataType == typeof(PercentValue)) {
    6055              this.viewHost.Content = ((IValueConfiguration)Content).RangeConstraint;
     56            } else if(Content.ConstrainedValue.ValueDataType == typeof(BoolValue)) {
     57              this.viewHost.Content = null; // no configuration required
    6158            } else {
    6259              this.viewHost.Content = ((IValueConfiguration)Content).ParameterConfigurations;
     
    6865          this.viewHost.Content = Content.ConstrainedValue;
    6966        }
     67      }
     68    }
     69    void Content_IsOptimizabeChanged(object sender, EventArgs e) {
     70      if (InvokeRequired) {
     71        Invoke(new EventHandler(Content_IsOptimizabeChanged), sender, e);
     72      } else {
     73        SetEnabledStateOfControls();
    7074      }
    7175    }
     
    8387    protected override void SetEnabledStateOfControls() {
    8488      base.SetEnabledStateOfControls();
     89      if (Content != null) {
     90        this.optimizeCheckBox.Enabled = !this.ReadOnly && Content.IsOptimizable;
     91      }
    8592    }
    8693
Note: See TracChangeset for help on using the changeset viewer.