#region License Information /* HeuristicLab * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Windows.Forms; using HeuristicLab.Core.Views; using HeuristicLab.MainForm; using HeuristicLab.MainForm.WindowsForms; using HeuristicLab.Problems.DataAnalysis.Interfaces; namespace HeuristicLab.Data.Views { [View("StringInterval View")] [Content(typeof(IInterval), true)] public partial class StringIntervalView : AsynchronousContentView { public new IInterval Content { get { return (IInterval)base.Content; } set { base.Content = value; } } public StringIntervalView() { InitializeComponent(); } protected override void OnContentChanged() { base.OnContentChanged(); if (Content != null) { Item1View.Content = Content.Variable; Item2View.Content = Content.Formulation; Item3View.Content = new StringValue(Content.Name); } else { Item1View.Content = null; Item2View.Content = null; Item3View.Content = null; } } protected override void SetEnabledStateOfControls() { base.SetEnabledStateOfControls(); Item1View.Enabled = Content != null; Item2View.Enabled = Content != null; Item3View.Enabled = Content != null; } protected override void RegisterContentEvents() { base.RegisterContentEvents(); Content.NameChanged += new EventHandler(Content_NameChanged); } protected virtual void Content_NameChanged(object sender, EventArgs e) { if (InvokeRequired) Invoke(new EventHandler(Content_NameChanged), sender, e); else { Caption = Item3View.Content.GetValue(); } } private void label1_Click(object sender, System.EventArgs e) { } } }