Skip to content
Florent Falcy edited this page Jan 11, 2016 · 1 revision

Code example

Example 1

IChainCommand cmd = new YourCustomChainCommand();

//Add a callback to the end of command execution 
cmd.OnExecuteDone(delegate ()
{
    //do some stuff when cmd execution is done
});
//Execute command
cmd.Execute();

Chained command

IChainCommand cmd1 = new YourCustomChainCommand();
IChainCommand cmd2 = new YourCustomChainCommand2();
cmd1.Chain(cmd2);

cmd1.OnExecuteDone(delegate ()
{
    //do some stuff when cmd1 AND cmd 2 execution is done
});

cmd2.OnExecuteDone(delegate ()
{
    //do some stuff when cmd 2 execution is done
});


//Execute "macro" command cmd1
cmd1.Execute();

Clone this wiki locally