Class AsyncDelegateCommand<T>
Implements IAsyncDelegateCommand<T>
Namespace: Sartorius.SAF.Presentation.Commands
Assembly: Sartorius.SAF.Presentation.dll
Syntax
public sealed class AsyncDelegateCommand<T> : AsyncDelegateCommandBase, IAsyncDelegateCommand<T>, ICommand
Type Parameters
| Name | Description |
|---|---|
| T | The type of the command parameter. |
Examples
The following example shows how to use the AsyncDelegateCommand<T>.
Constructors
View SourceAsyncDelegateCommand(Func<T, Task>)
Creates a new instance of the AsyncDelegateCommand<T> class.
Declaration
public AsyncDelegateCommand(Func<T, Task> executeFunc)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<T, Task> | executeFunc | The Function executed when Execute(object) or Execute(T) is called. |
AsyncDelegateCommand(Func<T, Task>, Func<T, bool>)
Creates a new instance of the AsyncDelegateCommand<T> class.
Declaration
public AsyncDelegateCommand(Func<T, Task> executeFunc, Func<T, bool> canExecute)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<T, Task> | executeFunc | The Function executed when Execute(object) or Execute(T) is called. |
| Func<T, bool> | canExecute | The Function that verifies whether or not AsyncCommand should execute. |
Methods
View SourceCanExecute(T)
Determines whether the command can execute in its current state
Declaration
public bool CanExecute(T parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| T | parameter | Data used by the command. |
Returns
| Type | Description |
|---|---|
| bool |
|
Execute(T)
Defines the method to be called when the command is invoked.
Declaration
public Task Execute(T parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| T | parameter | Data used by the command. |
Returns
| Type | Description |
|---|---|
| Task | The task object representing the asynchronous operation. |