Command Macro Editor

CommandMacroEditor is a utility class in WinForms Controls inspired by "Edit Pre-Build" and "Edit Post-Build" dialog in Visual Studio with macro insertion feature.

The dialog is create to assist user to edit input field with macro insertion which will be replace with dynamic variable defined in application during run time. On top of that, "Add Folder" and "Add File" button is included for insert directory and file path to edit field.

Please be remind that this dialog only serve as editor. Parsing the command string in run time had to be taken care by developer of each application.



Implementation Example:

    using (CommandMacroEditor editor = 
           new CommandMacroEditor("Dialog Title..."))
    {

        //Define string to be inserted between Macro name.
        editor.MacroPrefix = "{";
        editor.MacroPostfix = "}";

        editor.Command = txtCommand.Text; //Get Current Command


        //Define Macro Pairs
        editor.AddMacroPair("CMD1", "Command Value 1");
        editor.AddMacroPair("CMD2", "Command Value 2");
        editor.AddMacroPair("CMD3", "Command Value 3");


        //Show Dialog
        if(editor.ShowDialog() == DialogResult.OK)

        {
            //Update Command
            txtCommand.Text = editor.Command;
        }
    }

 

Popular posts from this blog

C# DSP Simulation - DSP Lab

Personal Finance Planner Spreadsheet