Share via


AsyncValueCommand<TExecute,TCanExecute> Constructor

Definition

Initializes a new instance of AsyncValueCommand

public AsyncValueCommand(Func<TExecute,System.Threading.Tasks.ValueTask>? execute, Func<TCanExecute,bool> canExecute = default, Action<Exception>? onException = default, bool continueOnCapturedContext = false, bool allowsMultipleExecutions = true);

Parameters

execute
System.Func<TExecute,System.Threading.Tasks.ValueTask>

The Function executed when Execute or ExecuteAsync is called. This does not check canExecute before executing and will execute even if canExecute is false

canExecute
System.Func<TCanExecute,System.Boolean>

The Function that verifies whether or not AsyncCommand should execute.

onException
System.Action<System.Exception>

If an exception is thrown in the Task, onException will execute. If onException is null, the exception will be re-thrown

continueOnCapturedContext
System.Boolean

If set to true continue on captured context; this will ensure that the Synchronization Context returns to the calling thread. If set to false continue on a different context; this will allow the Synchronization Context to continue on a different thread

allowsMultipleExecutions
System.Boolean

Applies to