C# Class AsyncAwaitBestPractices.MVVM.AsyncCommand

An implmentation of IAsyncCommand. Allows Commands to safely be used asynchronously with Task.
Inheritance: IAsyncCommand
Mostrar archivo Open project: shendongnian/code

Public Methods

Method Description
AsyncCommand ( Func execute, Func canExecute = null, Action onException = null, bool continueOnCapturedContext = true ) : System

Initializes a new instance of the T:TaskExtensions.MVVM.AsyncCommand`1 class.

Method Details

AsyncCommand() public method

Initializes a new instance of the T:TaskExtensions.MVVM.AsyncCommand`1 class.
public AsyncCommand ( Func execute, Func canExecute = null, Action onException = null, bool continueOnCapturedContext = true ) : System
execute Func The Function executed when Execute or ExecuteAysnc is called. This does not check canExecute before executing and will execute even if canExecute is false
canExecute Func The Function that verifies whether or not AsyncCommand should execute.
onException Action If an exception is thrown in the Task, onException will execute. If onException is null, the exception will be re-thrown
continueOnCapturedContext bool 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
return System