Exemple #1
0
        private void buttonAddNewRule_Click(object sender, EventArgs e)
        {
            if (comboBoxRuleTypes.SelectedIndex < 0)
            {
                //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                MessageBoxForm.msgIcon = SystemIcons.Warning;                 //this is used if you want to add a system icon to the message form.
                var messageBox = new MessageBoxForm("Select a rule type first.",
                                                    "Warning", false, false);
                messageBox.ShowDialog();
                return;
            }

            INamingGenerator ng           = (INamingGenerator)comboBoxRuleTypes.SelectedItem;
            INamingGenerator newGenerator = (INamingGenerator)Activator.CreateInstance(ng.GetType());

            AddNewNamingGenerator(newGenerator);
            listViewGenerators.Items[listViewGenerators.Items.Count - 1].Selected = true;
            int index = listViewGenerators.SelectedIndices[0];

            if (textBoxNameFormat.Text.Contains("<" + (index + 1) + ">"))
            {
            }
            else
            {
                textBoxNameFormat.Text = textBoxNameFormat.Text + string.Format(" <{0}>", index + 1);
            }
            PopulateNames();
        }
Exemple #2
0
        private void buttonAddNewRule_Click(object sender, EventArgs e)
        {
            if (comboBoxRuleTypes.SelectedIndex < 0)
            {
                MessageBox.Show("Select a rule type first.");
                return;
            }

            INamingGenerator ng           = (INamingGenerator)comboBoxRuleTypes.SelectedItem;
            INamingGenerator newGenerator = (INamingGenerator)Activator.CreateInstance(ng.GetType());

            AddNewNamingGenerator(newGenerator);
            listViewGenerators.Items[listViewGenerators.Items.Count - 1].Selected = true;
            PopulateNames();
        }