using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Windows.Forms;
using HeuristicLab.Core;
using HeuristicLab.MainForm;
namespace HeuristicLab.Data {
///
/// A visual representation to visualize a key-value pair.
///
public partial class EditKeyValueDialog : Form {
private IItem key;
///
/// Gets the current key.
///
public IItem Key {
get { return key; }
}
private IItem value;
///
/// Gets the current value.
///
public IItem Value {
get { return value; }
}
///
/// Initializes a new instance of the class with the given types of
/// key and value.
///
/// The type of the key.
/// The type of the value.
public EditKeyValueDialog(Type keyType, Type valueType) {
InitializeComponent();
key = (IItem) Activator.CreateInstance(keyType);
value = (IItem) Activator.CreateInstance(valueType);
keyPanel.Controls.Add((Control)MainFormManager.CreateDefaultView(key));
valuePanel.Controls.Add((Control)MainFormManager.CreateDefaultView(value));
}
private void okButton_Click(object sender, EventArgs e) {
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}