コード例 #1
0
ファイル: MainWindow.cs プロジェクト: BahNahNah/ModuleBot-2
        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();
                }
            }
        }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: BahNahNah/ModuleBot-2
 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);
         }
     }
 }