Changeset 4984 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/OptimizableView.cs
- Timestamp:
- 11/28/10 23:58:59 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/OptimizableView.cs
r4981 r4984 29 29 protected override void DeregisterContentEvents() { 30 30 Content.OptimizeChanged -= new EventHandler(Content_OptimizeChanged); 31 Content.IsOptimizableChanged -= new EventHandler(Content_IsOptimizabeChanged); 31 32 base.DeregisterContentEvents(); 32 33 } … … 34 35 protected override void RegisterContentEvents() { 35 36 base.RegisterContentEvents(); 37 Content.IsOptimizableChanged += new EventHandler(Content_IsOptimizabeChanged); 36 38 Content.OptimizeChanged += new EventHandler(Content_OptimizeChanged); 37 39 } … … 46 48 this.viewHost.ViewType = null; 47 49 if (Content is IParameterConfiguration) { 48 // this is a shortcut if only one possible ValueConfiguration is available49 //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 //}56 50 this.viewHost.Content = ((IParameterConfiguration)Content).ValueConfigurations; 57 51 } else if (Content is IValueConfiguration) { 58 52 if (Content.ConstrainedValue.ValueDataType == typeof(IntValue) || 59 Content.ConstrainedValue.ValueDataType == typeof(DoubleValue)) { 53 Content.ConstrainedValue.ValueDataType == typeof(DoubleValue) || 54 Content.ConstrainedValue.ValueDataType == typeof(PercentValue)) { 60 55 this.viewHost.Content = ((IValueConfiguration)Content).RangeConstraint; 56 } else if(Content.ConstrainedValue.ValueDataType == typeof(BoolValue)) { 57 this.viewHost.Content = null; // no configuration required 61 58 } else { 62 59 this.viewHost.Content = ((IValueConfiguration)Content).ParameterConfigurations; … … 68 65 this.viewHost.Content = Content.ConstrainedValue; 69 66 } 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(); 70 74 } 71 75 } … … 83 87 protected override void SetEnabledStateOfControls() { 84 88 base.SetEnabledStateOfControls(); 89 if (Content != null) { 90 this.optimizeCheckBox.Enabled = !this.ReadOnly && Content.IsOptimizable; 91 } 85 92 } 86 93
Note: See TracChangeset
for help on using the changeset viewer.