C# 클래스 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.

상속: ICommand
파일 보기 프로젝트 열기: acid2000/OfficeCheevos

공개 메소드들

메소드 설명
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.

메소드 상세

CanExecute() 공개 메소드

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. ///
리턴 bool

DelegateCommand() 공개 메소드

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. ///
리턴 System

DelegateCommand() 공개 메소드

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. ///
리턴 System

Execute() 공개 메소드

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