Open sandboxFocus

Class BaseAsyncDelegateCommand

Base class for all asynchronous delegate-based implementations of ICommand in this package. Extends BaseDelegateCommand with support for task tracking, cancellation, and concurrent execution control.

Inheritance
BaseAsyncDelegateCommand
Namespace: Metalama.Patterns.Wpf
Assembly: Metalama.Patterns.Wpf.dll
Syntax
public abstract class BaseAsyncDelegateCommand : BaseDelegateCommand, IAsyncCommand, ICommand, INotifyPropertyChanged
Remarks

This class implements IAsyncCommand and INotifyPropertyChanged, exposing properties to monitor command execution state: IsRunning, CanCancel, IsCancellationRequested, and ExecutionTask.

Each execution generates a DelegateCommandExecution that allows tracking and canceling individual command invocations. Subscribe to the Executed event to receive these tokens for concurrent execution scenarios.

Properties

Name Description
CanCancel

Gets a value indicating whether the current command can be cancelled. Returns true if the command supports cancellation (e.g. has a parameter of type CancellationToken) and is currently running.

ExecutionTask

Gets the Task representing the last execution of the command.

IsCancellationRequested

Gets a value indicating whether the Cancel() method was called for the last task.

IsRunning

Gets a value indicating whether the last execution task (i.e., ExecutionTask) is still running.

Methods

Name Description
Cancel()

Cancels all currently pending executions.

Events

Name Description
Executed

Event raised when the command begins executing. The DelegateCommandExecution provides access to the execution's Task and allows cancellation of that specific invocation.

PropertyChanged

Extension Methods

See Also