Class RelayCommandBase
- Namespace
- EasySoftware.MvvmMini
- Assembly
- EasySoftware.MvvmMini.dll
Base class for asynchronous relay commands. While a command is running, CanExecute(object) returns false.
public abstract class RelayCommandBase : IRelayCommand, ICommand
- Inheritance
-
RelayCommandBase
- Implements
- Derived
- Inherited Members
Properties
IsRunning
Gets a value indicating whether the command is currently executing.
public bool IsRunning { get; protected set; }
Property Value
UseCommandManager
Gets a value indicating whether CanExecuteChanged is driven by RequerySuggested instead of explicit calls to RaiseCanExecuteChanged().
public bool UseCommandManager { get; protected set; }
Property Value
Methods
CanExecute(object)
Determines whether the command can execute in its current state.
public abstract bool CanExecute(object parameter)
Parameters
parameterobjectThe command parameter.
Returns
Execute(object)
Executes the command without waiting for it to finish. Use ExecuteAsync(object) to await it.
public abstract void Execute(object parameter)
Parameters
parameterobjectThe command parameter.
ExecuteAsync(object)
Executes the command and returns a task that completes when the work is done.
public abstract Task ExecuteAsync(object parameter)
Parameters
parameterobjectThe command parameter.
Returns
- Task
A task that represents the execution.
RaiseCanExecuteChanged()
Notifies bound controls that the result of CanExecute(object) may have changed.
public void RaiseCanExecuteChanged()
Events
CanExecuteChanged
Occurs when the result of CanExecute(object) may have changed. When UseCommandManager is true, handlers are attached to RequerySuggested.
public event EventHandler CanExecuteChanged