source: stable/HeuristicLab.Data.Views/3.3/StringConvertibleValueTupleView.cs @ 14186

Last change on this file since 14186 was 14186, checked in by swagner, 5 years ago

#2526: Updated year of copyrights in license headers

File size: 2.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2016 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.Windows.Forms;
23using HeuristicLab.MainForm;
24using HeuristicLab.MainForm.WindowsForms;
25
26namespace HeuristicLab.Data.Views {
27  [View("StringConvertibleValueTuple View")]
28  [Content(typeof(IStringConvertibleValueTuple), false)]
29  public partial class StringConvertibleValueTupleView : AsynchronousContentView {
30
31    public new IStringConvertibleValueTuple Content {
32      get { return (IStringConvertibleValueTuple)base.Content; }
33      set { base.Content = value; }
34    }
35
36    public override bool ReadOnly {
37      get {
38        if ((Content != null) && Content.ReadOnly) return true;
39        return base.ReadOnly;
40      }
41      set { base.ReadOnly = value; }
42    }
43
44    public StringConvertibleValueTupleView() {
45      InitializeComponent();
46    }
47
48    protected override void OnContentChanged() {
49      base.OnContentChanged();
50      if (Content != null) {
51        Item1View.Content = Content.Item1;
52        Item2View.Content = Content.Item2;
53      } else {
54        Item1View.Content = null;
55        Item2View.Content = null;
56      }
57    }
58
59    protected override void SetEnabledStateOfControls() {
60      base.SetEnabledStateOfControls();
61      Item1View.Enabled = Content != null;
62      Item2View.Enabled = Content != null;
63    }
64  }
65}
Note: See TracBrowser for help on using the repository browser.