Factory class that creates instances of DelegateCommand, DelegateCommand<T>, AsyncDelegateCommand, and AsyncDelegateCommand<T>. This class is used internally by the CommandAttribute aspect to generate command properties.
Namespace: Metalama.Patterns.Wpf
Assembly: Metalama.Patterns.Wpf.dll
Syntax
public static class DelegateCommandFactoryRemarks
This factory provides methods for creating commands with various configurations:
- Synchronous commands: Created via CreateDelegateCommand methods.
- Asynchronous commands: Created via CreateAsyncDelegateCommand methods for Task-returning methods.
- Background commands: Created via CreateBackgroundDelegateCommand methods, which dispatch execution to a background thread.
Each method has overloads for commands with or without parameters, with or without INotifyPropertyChanged integration.
Methods
| Name | Description |
|---|---|
| CreateAsyncDelegateCommand(Func<CancellationToken, Task>, Func<bool>?, bool, bool) | Creates an asynchronous command without a parameter, with cancellation support. |
| CreateAsyncDelegateCommand(Func<CancellationToken, Task>, Func<bool>, INotifyPropertyChanged, string, bool, bool) | Creates an asynchronous command without a parameter, with cancellation support and INotifyPropertyChanged integration. |
| CreateAsyncDelegateCommand(Func<Task>, Func<bool>?, bool, bool) | Creates an asynchronous command without a parameter, without cancellation support. |
| CreateAsyncDelegateCommand(Func<Task>, Func<bool>, INotifyPropertyChanged, string, bool, bool) | Creates an asynchronous command without a parameter, without cancellation support, with INotifyPropertyChanged integration. |
| CreateAsyncDelegateCommand<T>(Func<T, CancellationToken, Task>, Func<T, bool>, bool, bool) | Creates an asynchronous command that accepts a parameter, with cancellation support. |
| CreateAsyncDelegateCommand<T>(Func<T, CancellationToken, Task>, Func<T, bool>, INotifyPropertyChanged, string, bool, bool) | Creates an asynchronous command that accepts a parameter, with cancellation support and INotifyPropertyChanged integration. |
| CreateAsyncDelegateCommand<T>(Func<T, Task>, Func<T, bool>, bool, bool) | Creates an asynchronous command that accepts a parameter, without cancellation support. |
| CreateBackgroundDelegateCommand(Action, Func<bool>?, bool) | Creates a background command without a parameter, without cancellation support. The execution is always dispatched to a background thread. |
| CreateBackgroundDelegateCommand(Action, Func<bool>, INotifyPropertyChanged, string, bool) | Creates a background command without a parameter, without cancellation support, with INotifyPropertyChanged integration. The execution is always dispatched to a background thread. |
| CreateBackgroundDelegateCommand(Action<CancellationToken>, Func<bool>?, bool) | Creates a background command without a parameter, with cancellation support. The execution is always dispatched to a background thread. |
| CreateBackgroundDelegateCommand(Action<CancellationToken>, Func<bool>, INotifyPropertyChanged, string, bool) | Creates a background command without a parameter, with cancellation support and INotifyPropertyChanged integration. The execution is always dispatched to a background thread. |
| CreateBackgroundDelegateCommand<T>(Action<T, CancellationToken>, Func<T, bool>?, bool) | Creates a background command that accepts a parameter, with cancellation support. The execution is always dispatched to a background thread. |
| CreateBackgroundDelegateCommand<T>(Action<T, CancellationToken>, Func<T, bool>, INotifyPropertyChanged, string, bool) | Creates a background command that accepts a parameter, with cancellation support and INotifyPropertyChanged integration. The execution is always dispatched to a background thread. |
| CreateBackgroundDelegateCommand<T>(Action<T>, Func<T, bool>?, bool) | Creates a background command that accepts a parameter, without cancellation support. The execution is always dispatched to a background thread. |
| CreateBackgroundDelegateCommand<T>(Action<T>, Func<T, bool>, INotifyPropertyChanged, string, bool) | Creates a background command that accepts a parameter, without cancellation support, with INotifyPropertyChanged integration. The execution is always dispatched to a background thread. |
| CreateDelegateCommand(Action, Func<bool>?) | Creates a synchronous command without a parameter. |
| CreateDelegateCommand(Action, Func<bool>, INotifyPropertyChanged, string) | Creates a synchronous command without a parameter, with INotifyPropertyChanged integration for the |
| CreateDelegateCommand<T>(Action<T>, Func<T, bool>?) | Creates a synchronous command that accepts a parameter. |
| CreateDelegateCommand<T>(Action<T>, Func<T, bool>, INotifyPropertyChanged, string) | Creates a synchronous command that accepts a parameter, with INotifyPropertyChanged integration for the |
| CreateParametricAsyncDelegateCommand<T>(Func<T, CancellationToken, Task>, Func<T, bool>?, bool, bool, bool) | Creates an asynchronous command that accepts a parameter, with configurable cancellation support. |
| CreateParametricAsyncDelegateCommand<T>(Func<T, Task>, Func<T, bool>?, bool, bool, bool) | Creates an asynchronous command that accepts a parameter, without cancellation token in the delegate, with configurable cancellation support. |