コード例 #1
0
        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;
                }
            }
        }
コード例 #2
0
        private void buttonGac_Click(object sender, EventArgs e)
        {
            Type t = FormTypeSelection.SelectType(this);

            if (t != null)
            {
                listBox1.Items.Add(t);
            }
        }
コード例 #3
0
        private void btADO_Click(object sender, EventArgs e)
        {
            Type t = FormTypeSelection.SelectType(this, "MySql.Data", "MySql.Data.MySqlClient.MySqlConnection");

            if (t != null)
            {
                ConnectionType = t;
                lblADO.Text    = t.FullName;
            }
        }
コード例 #4
0
        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;
            }
        }
コード例 #5
0
 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();
             }
         }
     }
 }