The recording of the first ever ReactiveUI virtual conference is available on our YouTube Channel.

ReactiveCommand.

CreateFromTask<TParam, TResult>(Func<TParam, CancellationToken, Task<TResult>>, IObservable<bool>, IScheduler?) Method

Summary

Creates a ReactiveCommand<TParam, TResult> with asynchronous, cancellable execution logic that takes a parameter of type TParam.
Namespace
ReactiveUI
Containing Type
ReactiveCommand

Syntax

public static ReactiveCommand<TParam, TResult> CreateFromTask<TParam, TResult>(Func<TParam, CancellationToken, Task<TResult>> execute, IObservable<bool> canExecute = null, IScheduler? outputScheduler = null)

Type Parameters

Name Description
TParam The type of the parameter passed through to command execution.
TResult The type of the command's result.

Parameters

Name Type Description
execute Func<TParam, CancellationToken, Task<TResult>> Provides a Task representing the command's asynchronous execution logic.
canExecute IObservable<bool> An optional observable that dictates the availability of the command for execution.
outputScheduler IScheduler? An optional scheduler that is used to surface events. Defaults to RxApp.MainThreadScheduler.

Return Value

Type Description
ReactiveCommand<TParam, TResult> The ReactiveCommand instance.