C# Class NotifyMessageDemo.DelegateCommand

A command that executes delegates to determine whether the command can execute, and to execute the command.

This command implementation is useful when the command simply needs to execute a method on a view model. The delegate for determining whether the command can execute is optional. If it is not provided, the command is considered always eligible to execute.

Inheritance: ICommand
Afficher le fichier Open project: acid2000/OfficeCheevos

Méthodes publiques

Méthode Description
CanExecute ( object parameter ) : bool

Determines whether this command can execute.

If there is no delegate to determine whether the command can execute, this method will return . If a delegate was provided, this method will invoke that delegate.

DelegateCommand ( Action execute ) : System

Constructs an instance of DelegateCommand.

This constructor creates the command without a delegate for determining whether the command can execute. Therefore, the command will always be eligible for execution.

DelegateCommand ( Action execute, Predicate canExecute ) : System

Constructs an instance of DelegateCommand.

Execute ( object parameter ) : void

Executes this command.

This method invokes the provided delegate to execute the command.

Method Details

CanExecute() public méthode

Determines whether this command can execute.
If there is no delegate to determine whether the command can execute, this method will return . If a delegate was provided, this method will invoke that delegate.
public CanExecute ( object parameter ) : bool
parameter object /// The command parameter. ///
Résultat bool

DelegateCommand() public méthode

Constructs an instance of DelegateCommand.
This constructor creates the command without a delegate for determining whether the command can execute. Therefore, the command will always be eligible for execution.
public DelegateCommand ( Action execute ) : System
execute Action /// The delegate to invoke when the command is executed. ///
Résultat System

DelegateCommand() public méthode

Constructs an instance of DelegateCommand.
public DelegateCommand ( Action execute, Predicate canExecute ) : System
execute Action /// The delegate to invoke when the command is executed. ///
canExecute Predicate /// The delegate to invoke to determine whether the command can execute. ///
Résultat System

Execute() public méthode

Executes this command.
This method invokes the provided delegate to execute the command.
public Execute ( object parameter ) : void
parameter object /// The command parameter. ///
Résultat void