Overview

A command is any action that can be executed. Commands may be execute primitive logic such as a key press, or they may execute more complex logic such as stating up your media player application. If you can write the code for it, it can be a command.

Included Commands

Extending Commands

Commands can be created by inheriting from the Command abstract class and implementing it's execute method. Quantified commands must also implement the IQuantifiedCommand interface, and accept values from a loosely typed string dictionary. Command properties that can be set by a user through the gui must have the UserPropertyAttribute applied. If the value of a command property is not represented by a primitive type a property converter must be created.

Sample

public class KeyPressCommand : Command
{
    [UserProperty]
    public Keys Key { get; set; }

    [UserProperty]
    public Keys Modifier1 { get; set; }

    [UserProperty]
    public Keys Modifier2 { get; set; }

    public override void Execute()
    {
        if (Modifier1 != Keys.None)
            KeyboardSimulator.KeyDown(Modifier1);

        if (Modifier2 != Keys.None)
            KeyboardSimulator.KeyDown(Modifier2);

        KeyboardSimulator.KeyPress(Key);

        if (Modifier1 != Keys.None)
            KeyboardSimulator.KeyUp(Modifier1);

        if (Modifier2 != Keys.None)
            KeyboardSimulator.KeyUp(Modifier2);
    }
}