Search Results for

    Show / Hide Table of Contents

    Class AsyncRelayCommand<TParam>

    A reusable command that encapsulates the implementation of ICommand with support for async/await command delegates.
    Enables instant creation of an ICommand without implementing the ICommand interface for each command. The AsyncRelayCommand<TParam> accepts asynchronous command handlers and supports data bindng to properties like IsExecuting by implementing INotifyPropertyChanged.
    Call and await the ExecuteAsync() method or one of its overloads to execute the command explicitly asynchronously. ICommand

    Inheritance
    Object
    AsyncRelayCommandCommon
    AsyncRelayCommandCommon<TParam>
    AsyncRelayCommand<TParam>
    Implements
    IAsyncRelayCommand<TParam>
    IAsyncRelayCommandCommon<TParam>
    IAsyncRelayCommand
    IAsyncRelayCommandCommon
    ICommand
    INotifyPropertyChanged
    Inherited Members
    AsyncRelayCommandCommon<TParam>.ExecuteAsyncDelegate
    AsyncRelayCommandCommon<TParam>.ExecuteCancellableAsyncDelegate
    AsyncRelayCommandCommon<TParam>.ExecuteDelegate
    AsyncRelayCommandCommon<TParam>.ExecuteCancellableDelegate
    AsyncRelayCommandCommon<TParam>.CanExecuteDelegate
    AsyncRelayCommandCommon<TParam>.CanExecute()
    AsyncRelayCommandCommon<TParam>.CanExecute(TParam)
    AsyncRelayCommandCommon<TParam>.ExecuteAsync(TimeSpan, CancellationToken)
    AsyncRelayCommandCommon<TParam>.ExecuteAsync(TParam)
    AsyncRelayCommandCommon<TParam>.ExecuteAsync(TParam, TimeSpan)
    AsyncRelayCommandCommon<TParam>.ExecuteAsync(TParam, CancellationToken)
    AsyncRelayCommandCommon<TParam>.ExecuteAsync(TParam, TimeSpan, CancellationToken)
    AsyncRelayCommandCommon<TParam>.ICommand.CanExecute(Object)
    AsyncRelayCommandCommon<TParam>.ICommand.Execute(Object)
    AsyncRelayCommandCommon.MaxThreads
    AsyncRelayCommandCommon.IsExecuting
    AsyncRelayCommandCommon.IsPendingCancelled
    AsyncRelayCommandCommon.IsCancelled
    AsyncRelayCommandCommon.HasPending
    AsyncRelayCommandCommon.PendingCount
    AsyncRelayCommandCommon.CanBeCanceled
    AsyncRelayCommandCommon.CurrentCancellationToken
    AsyncRelayCommandCommon.PropertyChanged
    AsyncRelayCommandCommon.ExecuteAsyncNoParamDelegate
    AsyncRelayCommandCommon.ExecuteCancellableAsyncNoParamDelegate
    AsyncRelayCommandCommon.ExecuteNoParamDelegate
    AsyncRelayCommandCommon.ExecuteCancellableNoParamDelegate
    AsyncRelayCommandCommon.CanExecuteNoParamDelegate
    AsyncRelayCommandCommon.ExecuteAsync()
    AsyncRelayCommandCommon.ExecuteAsync(CancellationToken)
    AsyncRelayCommandCommon.ExecuteAsync(TimeSpan)
    AsyncRelayCommandCommon.TryExecuteNoParamCommand()
    AsyncRelayCommandCommon.CancelExecuting()
    AsyncRelayCommandCommon.CancelExecuting(Boolean)
    AsyncRelayCommandCommon.CancelPending()
    AsyncRelayCommandCommon.CancelPending(Boolean)
    AsyncRelayCommandCommon.CancelAll()
    AsyncRelayCommandCommon.CancelAll(Boolean)
    AsyncRelayCommandCommon.InvalidateCommand()
    AsyncRelayCommandCommon.OnCanExecuteChanged()
    AsyncRelayCommandCommon.OnPropertyChanged(String)
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: BionicCode.Utilities.Net
    Assembly: BionicCode.Utilities.Net.Wpf.dll
    Syntax
    public class AsyncRelayCommand<TParam> : AsyncRelayCommandCommon<TParam>, IAsyncRelayCommand<TParam>, IAsyncRelayCommandCommon<TParam>, IAsyncRelayCommand, IAsyncRelayCommandCommon, ICommand, INotifyPropertyChanged
    Type Parameters
    Name Description
    TParam
    Remarks

    AsyncRelayCommandCommon implements ICommand. In case the AsyncRelayCommand<TParam> is executed explicitly, especially with an asynchronous command handler registered, it is highly recommended to invoke the awaitable ExecuteAsync() or its overloads instead.

    Constructors

    | Improve this Doc View Source

    AsyncRelayCommand()

    Declaration
    protected AsyncRelayCommand()
    | Improve this Doc View Source

    AsyncRelayCommand(Action)

    Declaration
    public AsyncRelayCommand(Action executeNoParam)
    Parameters
    Type Name Description
    Action executeNoParam
    | Improve this Doc View Source

    AsyncRelayCommand(Action, Func<Boolean>)

    Declaration
    public AsyncRelayCommand(Action executeNoParam, Func<bool> canExecuteNoParam)
    Parameters
    Type Name Description
    Action executeNoParam
    Func<Boolean> canExecuteNoParam
    | Improve this Doc View Source

    AsyncRelayCommand(Action<TParam, CancellationToken>)

    Declaration
    public AsyncRelayCommand(Action<TParam, CancellationToken> execute)
    Parameters
    Type Name Description
    Action<TParam, CancellationToken> execute
    | Improve this Doc View Source

    AsyncRelayCommand(Action<TParam, CancellationToken>, Predicate<TParam>)

    Declaration
    public AsyncRelayCommand(Action<TParam, CancellationToken> executeAsync, Predicate<TParam> canExecute)
    Parameters
    Type Name Description
    Action<TParam, CancellationToken> executeAsync
    Predicate<TParam> canExecute
    | Improve this Doc View Source

    AsyncRelayCommand(Action<TParam>)

    Declaration
    public AsyncRelayCommand(Action<TParam> execute)
    Parameters
    Type Name Description
    Action<TParam> execute
    | Improve this Doc View Source

    AsyncRelayCommand(Action<TParam>, Predicate<TParam>)

    Declaration
    public AsyncRelayCommand(Action<TParam> execute, Predicate<TParam> canExecute)
    Parameters
    Type Name Description
    Action<TParam> execute
    Predicate<TParam> canExecute
    | Improve this Doc View Source

    AsyncRelayCommand(Action<CancellationToken>)

    Declaration
    public AsyncRelayCommand(Action<CancellationToken> executeNoParam)
    Parameters
    Type Name Description
    Action<CancellationToken> executeNoParam
    | Improve this Doc View Source

    AsyncRelayCommand(Action<CancellationToken>, Func<Boolean>)

    Declaration
    public AsyncRelayCommand(Action<CancellationToken> executeAsync, Func<bool> canExecute)
    Parameters
    Type Name Description
    Action<CancellationToken> executeAsync
    Func<Boolean> canExecute
    | Improve this Doc View Source

    AsyncRelayCommand(Func<TParam, CancellationToken, Task>)

    Declaration
    public AsyncRelayCommand(Func<TParam, CancellationToken, Task> executeAsync)
    Parameters
    Type Name Description
    Func<TParam, CancellationToken, Task> executeAsync
    | Improve this Doc View Source

    AsyncRelayCommand(Func<TParam, CancellationToken, Task>, Predicate<TParam>)

    Declaration
    public AsyncRelayCommand(Func<TParam, CancellationToken, Task> executeAsync, Predicate<TParam> canExecute)
    Parameters
    Type Name Description
    Func<TParam, CancellationToken, Task> executeAsync
    Predicate<TParam> canExecute
    | Improve this Doc View Source

    AsyncRelayCommand(Func<TParam, Task>)

    Declaration
    public AsyncRelayCommand(Func<TParam, Task> executeAsync)
    Parameters
    Type Name Description
    Func<TParam, Task> executeAsync
    | Improve this Doc View Source

    AsyncRelayCommand(Func<TParam, Task>, Predicate<TParam>)

    Declaration
    public AsyncRelayCommand(Func<TParam, Task> executeAsync, Predicate<TParam> canExecute)
    Parameters
    Type Name Description
    Func<TParam, Task> executeAsync
    Predicate<TParam> canExecute
    | Improve this Doc View Source

    AsyncRelayCommand(Func<CancellationToken, Task>)

    Declaration
    public AsyncRelayCommand(Func<CancellationToken, Task> executeAsyncNoParam)
    Parameters
    Type Name Description
    Func<CancellationToken, Task> executeAsyncNoParam
    | Improve this Doc View Source

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

    Declaration
    public AsyncRelayCommand(Func<CancellationToken, Task> executeAsync, Func<bool> canExecute)
    Parameters
    Type Name Description
    Func<CancellationToken, Task> executeAsync
    Func<Boolean> canExecute
    | Improve this Doc View Source

    AsyncRelayCommand(Func<Task>)

    Declaration
    public AsyncRelayCommand(Func<Task> executeAsyncNoParam)
    Parameters
    Type Name Description
    Func<Task> executeAsyncNoParam
    | Improve this Doc View Source

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

    Declaration
    public AsyncRelayCommand(Func<Task> executeAsyncNoParam, Func<bool> canExecuteNoParam)
    Parameters
    Type Name Description
    Func<Task> executeAsyncNoParam
    Func<Boolean> canExecuteNoParam

    Properties

    | Improve this Doc View Source

    IsCommandManagerRequerySuggestedEnabled

    Controls whether the command's CanExecuteChanged is attached to the RequerySuggested event.

    Declaration
    public bool IsCommandManagerRequerySuggestedEnabled { get; set; }
    Property Value
    Type Description
    Boolean

    true to attach the CanExecuteChanged is attached to the RequerySuggested event.
    The default is true.

    Remarks

    If the IsCommandManagerRequerySuggestedEnabled property is set to true, calling the InvalidateRequerySuggested() method will also raise the CanExecuteChanged event.
    This is the default behavior. InvalidateRequerySuggested() is regularly invoked by the framework to keep UI elemnts, that implement ICommandSource (like the Button control) and listen to the CanExecuteChanged event, updated.
    When the IsCommandManagerRequerySuggestedEnabled property ios set to false, the CanExecuteChanged must be raised explicitly by calling the InvalidateCommand() method.

    Events

    | Improve this Doc View Source

    CanExecuteChanged

    Declaration
    public event EventHandler CanExecuteChanged
    Event Type
    Type Description
    EventHandler

    Implements

    IAsyncRelayCommand<TParam>
    IAsyncRelayCommandCommon<TParam>
    IAsyncRelayCommand
    IAsyncRelayCommandCommon
    ICommand
    INotifyPropertyChanged

    Extension Methods

    HelperExtensionsCommon.ToDictionary(Object)
    HelperExtensionsCommon.ToFlatDictionary(Object)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX