private void buttonEnum_Click(object sender, EventArgs e) { FormTypeSelection dlg = new FormTypeSelection(); dlg.Text = "Select enumerator type"; dlg.SetSelectionBaseType(typeof(Enum)); if (dlg.ShowDialog() == DialogResult.OK) { if (dlg.SelectedType.IsEnum) { _type = dlg.SelectedType; labelEnum.Text = _type.AssemblyQualifiedName; listBox1.Items.Clear(); string[] names = Enum.GetNames(_type); if (names != null && names.Length > 0) { for (int i = 0; i < names.Length; i++) { listBox1.Items.Add(names[i]); } } buttonOK.Enabled = true; } } }
private void btSelect_Click(object sender, EventArgs e) { FormTypeSelection dlg = new FormTypeSelection(); dlg.Text = "Select database connection type"; dlg.SetSelectionBaseType(typeof(DbConnection)); if (dlg.ShowDialog() == DialogResult.OK) { SelectedType = dlg.SelectedType; this.DialogResult = DialogResult.OK; } }
protected override void OnClick(EventArgs e) { if (SelectedIndex >= 0) { TypeData data = Items[SelectedIndex] as TypeData; if (data != null) { SelectedType = data.Type; _service.CloseDropDown(); } else { FormTypeSelection dlg = new FormTypeSelection(); dlg.Text = "Select database connection type"; dlg.SetSelectionBaseType(typeof(DbConnection)); if (dlg.ShowDialog() == DialogResult.OK) { SelectedType = dlg.SelectedType; _service.CloseDropDown(); } } } }