The page has been moved to GitHub

AsyncRelayCommand

Package: MyToolkit (PCL)
Platforms: All (PCL)

Inherits from CommandBase.

An ICommand implementation to create a command with a given task-based async method. The command cannot be executed again until the running task has been finished (CanExecute is false until the task finished, then CanExecute is calculated using the given predicate).

DeletePersonCommand = new AsyncRelayCommand<Person>(
    DeletePersonAsync, person => person != null);

...

private async Task DeletePersonAsync(Person person)
{
    // TODO: Add your code
}

// or

DeletePersonCommand = new AsyncRelayCommand<Person>(async person => 
{
    // TODO: Add your code
});

Last edited Jun 3, 2015 at 10:54 PM by rsuter, version 11