Class DelegateCommand
An ICommand whose delegates do not take any parameters for Execute() and CanExecute().
Namespace: Sartorius.SAF.Presentation.Commands
Assembly: Sartorius.SAF.Presentation.dll
Syntax
public class DelegateCommand : DelegateCommandBase, ICommand, IActiveAware
Constructors
View SourceDelegateCommand(Action)
Creates a new instance of DelegateCommand with the Action to invoke on execution.
Declaration
public DelegateCommand(Action executeMethod)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | executeMethod | The Action to invoke when Execute(object) is called. |
DelegateCommand(Action, Func<bool>)
Creates a new instance of DelegateCommand with the Action to invoke on execution
and a Func to query for determining if the command can execute.
Declaration
public DelegateCommand(Action executeMethod, Func<bool> canExecuteMethod)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | executeMethod | The Action to invoke when Execute(object) is called. |
| Func<bool> | canExecuteMethod | The Func<TResult> to invoke when CanExecute(object) is called |
Methods
View SourceCanExecute()
Determines if the command can be executed.
Declaration
public bool CanExecute()
Returns
| Type | Description |
|---|---|
| bool | Returns true if the command can execute,otherwise returns false. |
Execute()
Executes the command.
Declaration
public void Execute()