Show / Hide Table of Contents

Class AsyncDelegateCommand

The AsyncDelegateCommand allows use the ICommand interface with asynchronous functionality. While the underlying asynchronous functionality is running CanExecute(object) always returns false and CanExecuteChanged is automatically called when execution starts and ends.

potential exceptions occurring during execution are automatically dispatched into the UI thread.

Inheritance
object
AsyncDelegateCommandBase
AsyncDelegateCommand
Implements
IAsyncDelegateCommand
ICommand
AsyncDelegateCommandBase.CanExecuteChanged
AsyncDelegateCommandBase.RaiseCanExecuteChanged()
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Sartorius.SAF.Presentation.Commands
Assembly: Sartorius.SAF.Presentation.dll
Syntax
public sealed class AsyncDelegateCommand : AsyncDelegateCommandBase, IAsyncDelegateCommand, ICommand
Examples

The following example shows how to use the AsyncDelegateCommand.

Constructors

View Source

AsyncDelegateCommand(Func<Task>)

Creates a new instance of the AsyncDelegateCommand class with the specified async execution function.

Declaration
public AsyncDelegateCommand(Func<Task> executeFunc)
Parameters
Type Name Description
Func<Task> executeFunc

The asynchronous function that this command should execute.

View Source

AsyncDelegateCommand(Func<Task>, Func<bool>)

Creates a new instance of the AsyncDelegateCommand class with the specified async execution function and can execute function.

Declaration
public AsyncDelegateCommand(Func<Task> executeFunc, Func<bool> canExecute)
Parameters
Type Name Description
Func<Task> executeFunc

The asynchronous function that this command should execute.

Func<bool> canExecute

The function that verifies whether the command can execute in its current state.

Methods

View Source

CanExecute()

Defines the method that determines whether the command can execute in its current state.

Declaration
public bool CanExecute()
Returns
Type Description
bool

true, if this command can be executed; otherwise, false.

View Source

Execute()

Defines the method to be called when the command is invoked.

Declaration
public Task Execute()
Returns
Type Description
Task

The task object representing the asynchronous operation.

Implements

IAsyncDelegateCommand
ICommand

Extension Methods

CollectionExtensions.AddRange<T, TCollection>(TCollection, IEnumerable<T>)
SerializableObjectCloneExtension.Clone<T>(T)

See Also

IAsyncDelegateCommand
  • View Source
Back to top Generated by DocFX