using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HeuristicLab.MainForm;
using HeuristicLab.Core.Views;
using HeuristicLab.Core;
using HeuristicLab.Collections;
namespace HeuristicLab.Problems.MetaOptimization.Views {
///
/// The visual representation of a .
///
[View("ParameterConfiguration View")]
[Content(typeof(IParameterConfiguration), false)]
[Content(typeof(ParameterConfiguration), true)]
public partial class ParameterConfigurationView : ItemView {
///
/// Gets or sets the variable to represent visually.
///
/// Uses property of base class .
/// No own data storage present.
public new IParameterConfiguration Content {
get { return (IParameterConfiguration)base.Content; }
set { base.Content = value; }
}
public ParameterConfigurationView() {
InitializeComponent();
}
protected override void OnContentChanged() {
base.OnContentChanged();
if (Content != null) {
this.optimizeCheckBox.Checked = Content.OptimizationEnabled;
}
SetEnabledStateOfControls();
}
protected override void RegisterContentEvents() {
base.RegisterContentEvents();
Content.OptimizationEnabledChanged += new EventHandler(Content_OptimizationEnabledChanged);
}
protected override void DeregisterContentEvents() {
Content.OptimizationEnabledChanged -= new EventHandler(Content_OptimizationEnabledChanged);
base.DeregisterContentEvents();
}
protected override void SetEnabledStateOfControls() {
base.SetEnabledStateOfControls();
if (Content != null) {
if (Content.OptimizationEnabled) {
viewHost.ViewType = null;
viewHost.Content = Content.ValueConfigurations;
} else {
viewHost.ViewType = typeof(ValueView);
viewHost.Content = Content.ActualValueConfiguration;
}
} else {
viewHost.Content = null;
}
}
void Content_OptimizationEnabledChanged(object sender, EventArgs e) {
optimizeCheckBox.Checked = Content.OptimizationEnabled;
SetEnabledStateOfControls();
}
private void optimizeCheckBox_CheckedChanged(object sender, EventArgs e) {
Content.OptimizationEnabled = optimizeCheckBox.Checked;
SetEnabledStateOfControls();
}
}
}