Share via


AsyncCommand<TExecute,TCanExecute> Class

Definition

An implementation of IAsyncCommand. Allows Commands to safely be used asynchronously with Task.

public class AsyncCommand<TExecute,TCanExecute> : Xamarin.CommunityToolkit.ObjectModel.Internals.BaseAsyncCommand<TExecute,TCanExecute>, System.Windows.Input.ICommand, Xamarin.CommunityToolkit.ObjectModel.IAsyncCommand<TExecute,TCanExecute>, Xamarin.CommunityToolkit.ObjectModel.IAsyncCommand<TExecute>

Type Parameters

TExecute
TCanExecute
Inheritance
System.Object
AsyncCommand<TExecute,TCanExecute>
Implements
System.Windows.Input.ICommand IAsyncCommand<TExecute,TCanExecute> IAsyncCommand<TExecute>

Constructors

AsyncCommand<TExecute,TCanExecute>(Func<TExecute,Task>, Func<TCanExecute,Boolean>, Action<Exception>, Boolean, Boolean)

Initializes a new instance of the AsyncCommand

Properties

AllowsMultipleExecutions

Returns true if the Command allows simultaneous executions

(Inherited from BaseCommand<TCanExecute>)
ExecutionCount (Inherited from BaseCommand<TCanExecute>)
IsExecuting

Returns true when the Command is currently executing. Returns false when the Command is not executing

(Inherited from BaseCommand<TCanExecute>)

Methods

CanExecute(TCanExecute)

Determines whether the command can execute in its current state

(Inherited from BaseCommand<TCanExecute>)
ChangeCanExecute()

Raises the ICommand.CanExecuteChanged event. Recommend using RaiseCanExecuteChanged() instead.

(Inherited from BaseCommand<TCanExecute>)
ExecuteAsync(TExecute)

Executes the Command as a Task

RaiseCanExecuteChanged()

Raises the ICommand.CanExecuteChanged event.

(Inherited from BaseCommand<TCanExecute>)

Events

CanExecuteChanged

Occurs when changes occur that affect whether or not the command should execute

(Inherited from BaseCommand<TCanExecute>)

Explicit Interface Implementations

ICommand.CanExecute(Object) (Inherited from BaseAsyncCommand<TExecute,TCanExecute>)
ICommand.Execute(Object) (Inherited from BaseAsyncCommand<TExecute,TCanExecute>)

Applies to