Beispiel #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (AddCommandForm acf = new AddCommandForm(HandlerList.Values.ToArray()))
     {
         if (acf.ShowDialog() == DialogResult.OK)
         {
             RegisteredCommand command = acf.NewCommand;
             AddCommandToList(command);
         }
     }
 }
Beispiel #2
0
        private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (listView1.SelectedItems.Count < 1)
            {
                return;
            }
            var item    = listView1.SelectedItems[0];
            var command = (RegisteredCommand)item.Tag;

            using (AddCommandForm acf = new AddCommandForm(HandlerList.Values.ToArray(), command))
            {
                if (acf.ShowDialog() == DialogResult.OK)
                {
                    command = acf.NewCommand;
                    item.SubItems[1].Text = command.Handler.Command.Name;
                    List <string> PropertyValues = new List <string>();

                    if (command.IsModOnly)
                    {
                        PropertyValues.Add("Mod Only");
                    }
                    if (command.FlagIsRegex)
                    {
                        PropertyValues.Add("Regex");
                    }
                    if (command.FlagIsCaseSensitive)
                    {
                        PropertyValues.Add("Case sensitive");
                    }

                    string properties = string.Join(", ", PropertyValues.ToArray());
                    if (string.IsNullOrEmpty(properties))
                    {
                        properties = "None";
                    }
                    item.SubItems[2].Text = properties;
                    item.Tag = command;
                    SaveSettings();
                }
            }
        }