Interface IAsyncRelayCommandCommon<TParam>
An interface to define a reusable command that encapsulates the implementation of ICommand with support for async/await command delegates and data binding (implements INotifyPropertyChanged).
Enables instant creation of an ICommand without implementing the ICommand interface for each command.
Inherited Members
Namespace: BionicCode.Utilities.Net
Assembly: BionicCode.Utilities.Net.Common.dll
Syntax
public interface IAsyncRelayCommandCommon<TParam> : IAsyncRelayCommandCommon, ICommand, INotifyPropertyChanged
Type Parameters
| Name | Description |
|---|---|
| TParam |
Methods
| Improve this Doc View SourceCanExecute(TParam)
Checks if the ICommand can execute based on the command parameter.
Declaration
bool CanExecute(TParam parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| TParam | parameter | The command parameter. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
ExecuteAsync(TParam)
Executes the AsyncRelayCommand on the current command target asynchronously.
Declaration
Task ExecuteAsync(TParam parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| TParam | parameter | Data used by the command. If the command does not require data to be passed, this object can be set to null. |
Returns
| Type | Description |
|---|---|
| Task |
Remarks
If the registered command handler is asynchronous (awaitable), then the execution is asynchronous otherwise the delegate is executed synchronously.
Exceptions
| Type | Condition |
|---|---|
| OperationCanceledException | If the executing command delegate was cancelled. |
ExecuteAsync(TParam, CancellationToken)
Executes the AsyncRelayCommand on the current command target asynchronously.
Declaration
Task ExecuteAsync(TParam parameter, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| TParam | parameter | Data used by the command. If the command does not require data to be passed, this object can be set to null. |
| CancellationToken | cancellationToken | An instance of CancellationToken to cancel the executing command delegate. |
Returns
| Type | Description |
|---|---|
| Task |
Remarks
If the registered command handler is asynchronous (awaitable), then the execution is asynchronous otherwise the delegate is executed synchronously.
Exceptions
| Type | Condition |
|---|---|
| OperationCanceledException | If the executing command delegate was cancelled. |
ExecuteAsync(TParam, TimeSpan)
Executes the AsyncRelayCommand on the current command target asynchronously.
Declaration
Task ExecuteAsync(TParam parameter, TimeSpan timeout)
Parameters
| Type | Name | Description |
|---|---|---|
| TParam | parameter | Data used by the command. If the command does not require data to be passed, this object can be set to null. |
| TimeSpan | timeout | A TimeSpan to specify the timeout of the operation.
|
Returns
| Type | Description |
|---|---|
| Task |
Remarks
If the registered command handler is asynchronous (awaitable), then the execution is asynchronous otherwise the delegate is executed synchronously.
Exceptions
| Type | Condition |
|---|---|
| OperationCanceledException | If the executing command delegate was cancelled. |
| ArgumentOutOfRangeException |
|
ExecuteAsync(TParam, TimeSpan, CancellationToken)
Executes the AsyncRelayCommand on the current command target asynchronously.
Declaration
Task ExecuteAsync(TParam parameter, TimeSpan timeout, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| TParam | parameter | Data used by the command. If the command does not require data to be passed, this object can be set to null. |
| TimeSpan | timeout | A TimeSpan to specify the timeout of the operation.
|
| CancellationToken | cancellationToken | An instance of CancellationToken to cancel the executing command delegate. |
Returns
| Type | Description |
|---|---|
| Task |
Remarks
If the registered command handler is asynchronous (awaitable), then the execution is asynchronous otherwise the delegate is executed synchronously.
Exceptions
| Type | Condition |
|---|---|
| OperationCanceledException | If the executing command delegate was cancelled. |
| ArgumentOutOfRangeException |
|