Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Data/3.3/EditKeyValueDialog.cs @ 2806

Last change on this file since 2806 was 2520, checked in by swagner, 15 years ago

Implemented first draft of MainForm support in HeuristicLab.Core/HeuristicLab.Core.Views and all other depending plugins (#770)

File size: 1.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Data;
4using System.Text;
5using System.Windows.Forms;
6using HeuristicLab.Core;
7using HeuristicLab.MainForm;
8
9namespace HeuristicLab.Data {
10  /// <summary>
11  /// A visual representation to visualize a key-value pair.
12  /// </summary>
13  public partial class EditKeyValueDialog : Form {
14    private IItem key;
15    /// <summary>
16    /// Gets the current key.
17    /// </summary>
18    public IItem Key {
19      get { return key; }
20    }
21
22    private IItem value;
23    /// <summary>
24    /// Gets the current value.
25    /// </summary>
26    public IItem Value {
27      get { return value; }
28    }
29
30    /// <summary>
31    /// Initializes a new instance of the class <see cref="EditKeyValueDialog"/> with the given types of
32    /// key and value.
33    /// </summary>
34    /// <param name="keyType">The type of the key.</param>
35    /// <param name="valueType">The type of the value.</param>
36    public EditKeyValueDialog(Type keyType, Type valueType) {
37      InitializeComponent();
38      key = (IItem) Activator.CreateInstance(keyType);
39      value = (IItem) Activator.CreateInstance(valueType);
40      keyPanel.Controls.Add((Control)MainFormManager.CreateDefaultView(key));
41      valuePanel.Controls.Add((Control)MainFormManager.CreateDefaultView(value));
42    }
43
44    private void okButton_Click(object sender, EventArgs e) {
45      this.DialogResult = DialogResult.OK;
46      this.Close();
47    }
48  }
49}
Note: See TracBrowser for help on using the repository browser.