Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2956_apriori_knowledge/HeuristicLab.Data.Views/3.3/StringIntervalView.cs @ 16324

Last change on this file since 16324 was 16303, checked in by chaider, 6 years ago

#2956: Added intermediate of a-priori knowledge

File size: 2.5 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Windows.Forms;
24using HeuristicLab.Core.Views;
25using HeuristicLab.MainForm;
26using HeuristicLab.MainForm.WindowsForms;
27using HeuristicLab.Problems.DataAnalysis.Interfaces;
28
29namespace HeuristicLab.Data.Views {
30  [View("StringInterval View")]
31  [Content(typeof(IInterval), true)]
32  public partial class StringIntervalView : AsynchronousContentView {
33
34    public new IInterval Content {
35      get { return (IInterval)base.Content; }
36      set { base.Content = value; }
37    }
38
39    public StringIntervalView() {
40      InitializeComponent();
41    }
42
43    protected override void OnContentChanged() {
44      base.OnContentChanged();
45      if (Content != null) {
46        Item1View.Content = Content.Variable;
47        Item2View.Content = Content.Formulation;
48        Item3View.Content = new StringValue(Content.Name);
49      } else {
50        Item1View.Content = null;
51        Item2View.Content = null;
52        Item3View.Content = null;
53      }
54    }
55
56    protected override void SetEnabledStateOfControls() {
57      base.SetEnabledStateOfControls();
58      Item1View.Enabled = Content != null;
59      Item2View.Enabled = Content != null;
60      Item3View.Enabled = Content != null;
61    }
62
63    protected override void RegisterContentEvents() {
64      base.RegisterContentEvents();
65      Content.NameChanged += new EventHandler(Content_NameChanged);
66    }
67
68    protected virtual void Content_NameChanged(object sender, EventArgs e) {
69      if (InvokeRequired)
70        Invoke(new EventHandler(Content_NameChanged), sender, e);
71      else {
72        Caption = Item3View.Content.GetValue();
73      }
74    }
75
76    private void label1_Click(object sender, System.EventArgs e) {
77
78    }
79  }
80}
Note: See TracBrowser for help on using the repository browser.