Table of Contents

Class AsyncExceptionHandlingRelayCommand

Namespace
Loehnert.Lisrt.Framework
Assembly
Loehnert.Lisrt.dll

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
PropertyChangedBase
AsyncExceptionHandlingRelayCommand
Implements
INotifyPropertyChangedEx
Inherited Members
PropertyChangedBase.Refresh()
PropertyChangedBase.IsNotifying
PropertyChangedBase.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 TaskCreationOptions

A 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 TaskCreationOptions

A 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

bool

Methods

CanExecute(object)

Defines the method that determines whether the command can execute in its current state.

public bool CanExecute(object parameter)

Parameters

parameter object

Data 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 object

Data used by the command.

ExecuteAsync(object)

Execute the set action asynchronous.

public Task ExecuteAsync(object parameter)

Parameters

parameter object

Data 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

EventHandler

ExecutingCompleted

Occurs when the command executing completed.

public event EventHandler ExecutingCompleted

Event Type

EventHandler