Open sandboxFocus

Class AsyncDelegateCommand

An asynchronous implementation of ICommand that uses delegates for the execute and can-execute logic, without accepting a command parameter. This class is typically generated by the CommandAttribute aspect for methods returning Task or when Background is true.

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

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

By default, the command cannot be executed concurrently. This can be changed via SupportsConcurrentExecution.

Properties

Name Description
CanExecute

Gets a value indicating whether the command can be executed. Returns false if the command is already running and concurrent execution is not supported, or if the CanExecute delegate returns false.

Methods

Name Description
Execute()

Executes the command asynchronously and returns a DelegateCommandExecution that can be used to track and cancel the execution.

Extension Methods

See Also