Class AsyncExceptionHandlingRelayCommand
Represents an asynchronous relay command, which swallows all exceptions and logs them using the ShowException(Exception, ILogger) method.
public class AsyncExceptionHandlingRelayCommand : PropertyChangedBase, INotifyPropertyChangedEx, INotifyPropertyChanged, IAsyncCommand, ICommand
- Inheritance
-
PropertyChangedBaseAsyncExceptionHandlingRelayCommand
- Implements
-
INotifyPropertyChangedEx
- Inherited Members
-
PropertyChangedBase.Refresh()PropertyChangedBase.IsNotifyingPropertyChangedBase.PropertyChanged
Constructors
AsyncExceptionHandlingRelayCommand(Action<object>, Predicate<object>, TaskCreationOptions)
Initializes a new instance of the AsyncExceptionHandlingRelayCommand class.
public AsyncExceptionHandlingRelayCommand(Action<object> execute, Predicate<object> canExecute, TaskCreationOptions creationOption = TaskCreationOptions.None)
Parameters
execute
Action<object>The action to execute asynchronous.
canExecute
Predicate<object>The predicate that determines whether the command can be executed.
creationOption
TaskCreationOptionsA value that controls the behavior of the created Task.
AsyncExceptionHandlingRelayCommand(Action<object>, TaskCreationOptions)
Initializes a new instance of the AsyncExceptionHandlingRelayCommand class.
public AsyncExceptionHandlingRelayCommand(Action<object> execute, TaskCreationOptions creationOption = TaskCreationOptions.None)
Parameters
execute
Action<object>The action to execute.
creationOption
TaskCreationOptionsA value that controls the behavior of the created Task.
Properties
IsBusy
Gets a value indicating whether the command is busy.
public bool IsBusy { get; }
Property Value
Methods
CanExecute(object)
Defines the method that determines whether the command can execute in its current state.
public bool CanExecute(object parameter)
Parameters
parameter
objectData used by the command. If the command does not require data to be passed, this object can be set to null.
Returns
- bool
True if this command can be executed; otherwise, false.
Execute(object)
Executes the Execute(object).
public void Execute(object parameter)
Parameters
parameter
objectData used by the command.
ExecuteAsync(object)
Execute the set action asynchronous.
public Task ExecuteAsync(object parameter)
Parameters
parameter
objectData used by the command.
Returns
- Task
Returns the task that executes the execute action.
Remarks
This will be executed by Execute(object).
Events
CanExecuteChanged
Occurs when changes occur that affect whether or not the command can be executed.
public event EventHandler CanExecuteChanged
Event Type
ExecutingCompleted
Occurs when the command executing completed.
public event EventHandler ExecutingCompleted