{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Class AsyncRelayCommand | App UI | 0.5.5
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class AsyncRelayCommand

    A command that mirrors the functionality of RelayCommand, with the addition of accepting a Func<TResult> returning a Task as the execute action, and providing an executionTask property that notifies changes when ExecuteAsync(object?) is invoked and when the returned Task completes.

    Inheritance
    object
    AsyncRelayCommand
    Implements
    IAsyncRelayCommand
    IRelayCommand
    ICommand
    INotifyPropertyChanged
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.AppUI.MVVM
    Assembly: solution.dll
    Syntax
    public class AsyncRelayCommand : IAsyncRelayCommand, IRelayCommand, ICommand, INotifyPropertyChanged

    Constructors

    Name Description
    AsyncRelayCommand(Func<CancellationToken, Task>)

    Initializes a new instance of the AsyncRelayCommand class.

    AsyncRelayCommand(Func<CancellationToken, Task>, Func<bool>)

    Initializes a new instance of the AsyncRelayCommand class.

    AsyncRelayCommand(Func<CancellationToken, Task>, Func<bool>, AsyncRelayCommandOptions)

    Initializes a new instance of the AsyncRelayCommand class.

    AsyncRelayCommand(Func<CancellationToken, Task>, AsyncRelayCommandOptions)

    Initializes a new instance of the AsyncRelayCommand class.

    AsyncRelayCommand(Func<Task>)

    Initializes a new instance of the AsyncRelayCommand class.

    AsyncRelayCommand(Func<Task>, Func<bool>)

    Initializes a new instance of the AsyncRelayCommand class.

    AsyncRelayCommand(Func<Task>, Func<bool>, AsyncRelayCommandOptions)

    Initializes a new instance of the AsyncRelayCommand class.

    AsyncRelayCommand(Func<Task>, AsyncRelayCommandOptions)

    Initializes a new instance of the AsyncRelayCommand class.

    Fields

    Name Description
    CanBeCanceledChangedEventArgs

    The arguments for the PropertyChanged event raised by the canBeCancelled property.

    ExecutionTaskChangedEventArgs

    The arguments for the PropertyChanged event raised by the executionTask property.

    IsCancellationRequestedChangedEventArgs

    The arguments for the PropertyChanged event raised by the isCancellationRequested property.

    IsRunningChangedEventArgs

    The arguments for the PropertyChanged event raised by the isRunning property.

    Properties

    Name Description
    canBeCancelled

    Gets the CancellationTokenSource that can be used to cancel the asynchronous operation.

    executionTask

    Gets the Task that represents the asynchronous operation.

    isCancellationRequested

    Gets the CancellationTokenSource that can be used to cancel the asynchronous operation.

    isRunning

    Gets the CancellationTokenSource that can be used to cancel the asynchronous operation.

    Methods

    Name Description
    CanExecute()

    Determines whether this AsyncRelayCommand can execute in its current state.

    CanExecute(object?)

    Determines whether this AsyncRelayCommand can execute in its current state.

    Cancel()

    Cancels the AsyncRelayCommand on the current command target.

    Execute()

    Executes the AsyncRelayCommand on the current command target.

    Execute(object?)

    Executes the AsyncRelayCommand on the current command target.

    ExecuteAsync(object?)

    Executes the AsyncRelayCommand on the current command target.

    NotifyCanExecuteChanged()

    Raises the CanExecuteChanged event.

    Events

    Name Description
    CanExecuteChanged

    Event that is raised when changes occur that affect whether or not the AsyncRelayCommand should execute.

    PropertyChanged

    Event that is raised when the executionTask property changes.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)