Example #1
0
        private void openUserFunctionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UdfEditor ude = new UdfEditor();

            ude.FormClosed   += (a, b) => LoadFunctions();
            ude.StartPosition = FormStartPosition.CenterParent;
            ude.ShowDialog(this);
        }
Example #2
0
        private static bool ShowingUdfEditor(string[] args)
        {
            if (args.Length > 0 &&
                (args[0].Equals("--udfeditor", StringComparison.CurrentCultureIgnoreCase) ||
                 args[0].Equals("--udf", StringComparison.CurrentCultureIgnoreCase)))
            {
                clippy.UdfEditor editorForm = new clippy.UdfEditor();
                editorForm.ShowDialog();
                return(true);
            }

            return(false);
        }
Example #3
0
        static void Main(string[] args)
        {
            EditorManager manager = new EditorManager();
            if (args.Length > 0 && (args[0].Equals("help", StringComparison.CurrentCultureIgnoreCase) || args[0].Equals("/?", StringComparison.CurrentCultureIgnoreCase)))
            {
                Console.WriteLine(manager.Help(args));
                Console.ReadLine();
            }
            else if(args.Length > 0 &&
                    (args[0].Equals("--udfeditor", StringComparison.CurrentCultureIgnoreCase)
                     || args[0].Equals("--udf", StringComparison.CurrentCultureIgnoreCase)))
            {
                UdfEditor editorForm = new UdfEditor();
                editorForm.ShowDialog();
            }
            else
            {
                if (args.Length == 0)
                {
                    Console.WriteLine(manager.Help(args));
                    Console.WriteLine("Awaiting command");
                    args = manager.GetArgumentsFromString(Console.ReadLine());
                }
                manager.GetClipEditor(args[0]);
                manager.ClipEditor.EditorResponse += HandleResponseFromClippy;
                manager.ClipEditor.PersistentEditorResponse += HandleResponseFromClippy;

                SetParameters(manager, args);

                // if you've supplied at least one parameter, then set the rest, otherwise prompt
                if(args.Length > 1)
                {
                    foreach (Parameter parmWithDefault in (from Parameter p in manager.ClipEditor.ParameterList
                                                           where !p.IsValued && p.DefaultValue != null
                                                           select p))
                    {
                        parmWithDefault.Value = parmWithDefault.DefaultValue;
                    }
                }

                while (!manager.ClipEditor.HasAllParameters)
                {
                    Parameter nextOne = manager.ClipEditor.GetNextParameter();
                    Console.WriteLine(String.Concat(nextOne.ParameterName, " [",nextOne.Expecting,"]:"));

                    try
                    {
                        manager.ClipEditor.SetNextParameter(Console.ReadLine());
                    }
                    catch (InvalidParameterException ipe)
                    {
                        Console.WriteLine(ipe.ParameterMessage);
                        continue;
                    }
                }
                manager.ClipEditor.GetClipboardContent();
                manager.ClipEditor.Edit();
                manager.ClipEditor.SetClipboardContent();
                manager.ClipEditor.EditorResponse -= HandleResponseFromClippy;
                manager.ClipEditor.PersistentEditorResponse -= HandleResponseFromClippy;

                SaveThisCommand(args[0], manager.ClipEditor);
            }
        }
Example #4
0
 private void openUserFunctionsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     UdfEditor ude = new UdfEditor();
     ude.FormClosed += (a, b) => LoadFunctions();
     ude.StartPosition = FormStartPosition.CenterParent;
     ude.ShowDialog(this);
 }