Interface IAsyncRelayCommand
An interface expanding IRelayCommand to support asynchronous operations.
Inherited Members
Namespace: ISynergy.Framework.Mvvm.Abstractions.Commands
Assembly: ISynergy.Framework.Mvvm.dll
Syntax
public interface IAsyncRelayCommand : IRelayCommand
Properties
View SourceCanBeCanceled
Gets a value indicating whether a running operation for this command can currently be canceled.
Declaration
bool CanBeCanceled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The exact sequence of events that types implementing this interface should raise is as follows:
- The command is initially not running: IsRunning, CanBeCanceled and IsCancellationRequested are false.
- The command starts running: IsRunning and CanBeCanceled switch to true. IsCancellationRequested is set to false.
- If the operation is canceled: CanBeCanceled switches to false and IsCancellationRequested switches to true.
- The operation completes: IsRunning and CanBeCanceled switch to false. The state of IsCancellationRequested is undefined.
ExecutionTask
Gets the last scheduled
Declaration
Task? ExecutionTask { get; }
Property Value
Type | Description |
---|---|
System.Nullable<Task> |
IsCancellationRequested
Gets a value indicating whether a cancelation request has been issued for the current operation.
Declaration
bool IsCancellationRequested { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRunning
Gets a value indicating whether the command currently has a pending operation being executed.
Declaration
bool IsRunning { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
View SourceCancel()
Communicates a request for cancelation.
Declaration
void Cancel()
Remarks
If the underlying command is not running, or if it does not support cancelation, this method will perform no action. Note that even with a successful cancelation, the completion of the current operation might not be immediate.
ExecuteAsync(Nullable<Object>)
Provides a more specific version of
Declaration
Task ExecuteAsync(object? parameter)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Object> | parameter | The input parameter. |
Returns
Type | Description |
---|---|
Task | The |