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.Core.Views; using HeuristicLab.MainForm; using HeuristicLab.Core; using HeuristicLab.Parameters.Views; using HeuristicLab.PluginInfrastructure; namespace HeuristicLab.Problems.MetaOptimization.Views { [View("Value View")] [Content(typeof(IValueConfiguration), false)] public partial class ValueView : ItemView { public new IValueConfiguration Content { get { return (IValueConfiguration)base.Content; } set { base.Content = value; } } public ValueView() { InitializeComponent(); } protected override void OnContentChanged() { base.OnContentChanged(); if (Content != null) { valueViewHost.Content = Content.Value; } else { valueViewHost.Content = null; } } private void setValueButton_Click(object sender, EventArgs e) { var typeSelectorDialog = new TypeSelectorDialog(); typeSelectorDialog.Caption = "Select Value"; typeSelectorDialog.TypeSelector.Configure(Content.ValueDataType, false, true); if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { try { Content.Value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); valueViewHost.Content = Content.Value; } catch (Exception ex) { ErrorHandling.ShowErrorDialog(this, ex); } } } private void clearValueButton_Click(object sender, EventArgs e) { Content.Value = null; valueViewHost.Content = null; } } }