59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace PluginCommon
|
|
{
|
|
public partial class ChooseInListDialog : Form
|
|
{
|
|
public ChooseInListDialog(string _windowTitle, string _label)
|
|
{
|
|
InitializeComponent();
|
|
StartPosition = FormStartPosition.Manual;
|
|
|
|
Text = _windowTitle;
|
|
chooseLabel.Text = _label;
|
|
}
|
|
|
|
public void AddElement(object _element)
|
|
{
|
|
comboBox.Items.Add(_element);
|
|
}
|
|
|
|
public void AddRange(object[] _elements)
|
|
{
|
|
comboBox.Items.AddRange(_elements);
|
|
}
|
|
|
|
public void SelectIndex(int _index)
|
|
{
|
|
comboBox.SelectedIndex = _index;
|
|
}
|
|
|
|
public void SelectElement(object _element)
|
|
{
|
|
comboBox.SelectedIndex = comboBox.Items.IndexOf(_element);
|
|
}
|
|
|
|
public object GetResult()
|
|
{
|
|
return comboBox.SelectedItem;
|
|
}
|
|
|
|
private void okButton_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult = DialogResult.OK;
|
|
Close();
|
|
}
|
|
|
|
private void ChooseInListDialog_Load(object sender, EventArgs e)
|
|
{
|
|
Location = new Point(Owner.Location.X + (Owner.Width - Width) / 2, Owner.Location.Y + (Owner.Height - Height) / 2);
|
|
}
|
|
}
|
|
}
|