Esempio n. 1
0
        private void ScriptCommandList_DoubleClick(object sender, EventArgs e)
        {
            AddScriptCmdForm form = new AddScriptCmdForm();

            form.Name       = ScriptCommandList.SelectedItems[0].SubItems[0].Text;
            form.Help       = ScriptCommandList.SelectedItems[0].SubItems[1].Text;
            form.SourceCode = ScriptCommandList.SelectedItems[0].SubItems[2].Text;

            DialogResult dr = form.ShowDialog();

            if (dr == DialogResult.OK)
            {
                ScriptCommandList.SelectedItems[0].SubItems[0].Text = form.Name;
                ScriptCommandList.SelectedItems[0].SubItems[1].Text = form.Help;
                ScriptCommandList.SelectedItems[0].SubItems[2].Text = form.SourceCode;
            }
        }
Esempio n. 2
0
        private void AddCmdBtn_Click(object sender, EventArgs e)
        {
            AddScriptCmdForm form = new AddScriptCmdForm();

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("using System;");
            sb.AppendLine("using System.Collections.Generic;");
            sb.AppendLine("using System.Linq;");
            sb.AppendLine("using System.Text;");
            sb.AppendLine("using System.Threading.Tasks;");
            sb.AppendLine("");
            sb.AppendLine("public class Script");
            sb.AppendLine("{");
            sb.AppendLine("    public bool Execute(string[] args, string clipboardText, out string resultText)");
            sb.AppendLine("    {");
            sb.AppendLine("        resultText = \"I changed the clipboard.  + clipboardText;");
            sb.AppendLine("        return true;");
            sb.AppendLine("    }");
            sb.AppendLine("}");

            form.Name       = "My New Command";
            form.Help       = "<h3>My New Command</h3><p>Desription of My New Command</p>";
            form.SourceCode = sb.ToString();



            DialogResult dr = form.ShowDialog();

            if (dr == DialogResult.OK)
            {
                string[] arr = new string[3];
                arr[0] = form.Name;
                arr[1] = form.Help;
                arr[2] = form.SourceCode;
                ListViewItem itm = new ListViewItem(arr);
                ScriptCommandList.Items.Add(itm);
            }
        }