Commands and DelegateCommand
WPF and Universal Applications have a really handy way to handle the concept of a command: the ICommand interface (http://msdn.microsoft.com/library/system.windows.input.icommand.aspx).
Radical has its own implementation that allows to easily hook command logic using delegates. The Radical DelegateCommand adds a set of features on top of the default .Net ICommand.
Creating a command in Radical is as easy as:
1
ICommand command = DelegateCommand.Create()
2
.OnCanExecute( state =>
3
{
4
//command validation logic.
5
return true;
6
} )
7
.OnExecute( state =>
8
{
9
//command execution logic.
10
} );
Copied!
The command entry point is the DelegateCommand class, in the above sample used in a fluent interface manner.
Copy link