Generated by DocFX

Class AsyncRelayCommand<T>

A generic _command that provides a more specific version of AsyncRelayCommand.

Inheritance
System.Object
AsyncRelayCommand<T>
Implements
IAsyncRelayCommand<T>
IAsyncRelayCommand
INotifyPropertyChanged
IRelayCommand<T>
IRelayCommand
ICommand
IDisposable
Namespace: ISynergy.Framework.Mvvm.Commands
Assembly: ISynergy.Framework.Mvvm.dll
Syntax
public sealed class AsyncRelayCommand<T> : object, IAsyncRelayCommand<T>, IAsyncRelayCommand, IRelayCommand<T>, IRelayCommand
Type Parameters
Name Description
T

The type of parameter being passed as input to the callbacks.

Constructors

View Source

AsyncRelayCommand(Func<T, CancellationToken, Task>)

Initializes a new instance of the AsyncRelayCommand<T> class.

Declaration
public AsyncRelayCommand(Func<T, CancellationToken, Task> cancelableExecute)
Parameters
Type Name Description
Func<T, CancellationToken, Task> cancelableExecute

The cancelable execution logic.

Remarks

See notes in RelayCommand(Action<T>).

View Source

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

Initializes a new instance of the AsyncRelayCommand<T> class.

Declaration
public AsyncRelayCommand(Func<T, CancellationToken, Task> cancelableExecute, AsyncRelayCommandOptions options)
Parameters
Type Name Description
Func<T, CancellationToken, Task> cancelableExecute

The cancelable execution logic.

AsyncRelayCommandOptions options

The _options to use to configure the async _command.

Remarks

See notes in RelayCommand(Action<T>).

View Source

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

Initializes a new instance of the AsyncRelayCommand<T> class.

Declaration
public AsyncRelayCommand(Func<T, CancellationToken, Task> cancelableExecute, Predicate<T> canExecute)
Parameters
Type Name Description
Func<T, CancellationToken, Task> cancelableExecute

The cancelable execution logic.

Predicate<T> canExecute

The execution status logic.

Remarks

See notes in RelayCommand(Action<T>).

View Source

AsyncRelayCommand(Func<T, CancellationToken, Task>, Predicate<T>, AsyncRelayCommandOptions)

Initializes a new instance of the AsyncRelayCommand<T> class.

Declaration
public AsyncRelayCommand(Func<T, CancellationToken, Task> cancelableExecute, Predicate<T> canExecute, AsyncRelayCommandOptions options)
Parameters
Type Name Description
Func<T, CancellationToken, Task> cancelableExecute

The cancelable execution logic.

Predicate<T> canExecute

The execution status logic.

AsyncRelayCommandOptions options

The _options to use to configure the async _command.

Remarks

See notes in RelayCommand(Action<T>).

View Source

AsyncRelayCommand(Func<T, Task>)

Initializes a new instance of the AsyncRelayCommand<T> class.

Declaration
public AsyncRelayCommand(Func<T, Task> execute)
Parameters
Type Name Description
Func<T, Task> execute

The execution logic.

Remarks

See notes in RelayCommand(Action<T>).

View Source

AsyncRelayCommand(Func<T, Task>, AsyncRelayCommandOptions)

Initializes a new instance of the AsyncRelayCommand<T> class.

Declaration
public AsyncRelayCommand(Func<T, Task> execute, AsyncRelayCommandOptions options)
Parameters
Type Name Description
Func<T, Task> execute

The execution logic.

AsyncRelayCommandOptions options

The _options to use to configure the async _command.

Remarks

See notes in RelayCommand(Action<T>).

View Source

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

Initializes a new instance of the AsyncRelayCommand<T> class.

Declaration
public AsyncRelayCommand(Func<T, Task> execute, Predicate<T> canExecute)
Parameters
Type Name Description
Func<T, Task> execute

The execution logic.

Predicate<T> canExecute

The execution status logic.

Remarks

See notes in RelayCommand(Action<T>).

View Source

AsyncRelayCommand(Func<T, Task>, Predicate<T>, AsyncRelayCommandOptions)

Initializes a new instance of the AsyncRelayCommand<T> class.

Declaration
public AsyncRelayCommand(Func<T, Task> execute, Predicate<T> canExecute, AsyncRelayCommandOptions options)
Parameters
Type Name Description
Func<T, Task> execute

The execution logic.

Predicate<T> canExecute

The execution status logic.

AsyncRelayCommandOptions options

The _options to use to configure the async _command.

Remarks

See notes in RelayCommand(Action<T>).

Properties

View Source

CanBeCanceled

Gets a value indicating whether a running operation for this command can currently be canceled.

Declaration
public bool CanBeCanceled { get; }
Property Value
Type Description
System.Boolean
Remarks

The exact sequence of events that types implementing this interface should raise is as follows:

  • The command is initially not running: IsRunning, CanBeCanceled and IsCancellationRequested are false.
  • The command starts running: IsRunning and CanBeCanceled switch to true. IsCancellationRequested is set to false.
  • If the operation is canceled: CanBeCanceled switches to false and IsCancellationRequested switches to true.
  • The operation completes: IsRunning and CanBeCanceled switch to false. The state of IsCancellationRequested is undefined.
This only applies if the underlying logic for the command actually supports cancelation. If that is not the case, then CanBeCanceled and IsCancellationRequested will always remain false regardless of the current state of the command.
View Source

ExecutionTask

Gets the last scheduled , if available. This property notifies a change when the completes.

Declaration
public Task? ExecutionTask { get; }
Property Value
Type Description
System.Nullable<Task>
View Source

IsCancellationRequested

Gets a value indicating whether a cancelation request has been issued for the current operation.

Declaration
public bool IsCancellationRequested { get; }
Property Value
Type Description
System.Boolean
View Source

IsRunning

Gets a value indicating whether the command currently has a pending operation being executed.

Declaration
public bool IsRunning { get; }
Property Value
Type Description
System.Boolean

Methods

View Source

Cancel()

Communicates a request for cancelation.

Declaration
public void Cancel()
Remarks

If the underlying command is not running, or if it does not support cancelation, this method will perform no action. Note that even with a successful cancelation, the completion of the current operation might not be immediate.

View Source

CanExecute(T)

Provides a strongly-typed variant of .

Declaration
public bool CanExecute(T parameter)
Parameters
Type Name Description
T parameter

The input parameter.

Returns
Type Description
System.Boolean

Whether or not the current command can be executed.

Remarks

Use this overload to avoid boxing, if T is a value type.

View Source

CanExecute(Nullable<Object>)

Declaration
public bool CanExecute(object? parameter)
Parameters
Type Name Description
System.Nullable<System.Object> parameter
Returns
Type Description
System.Boolean
View Source

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()
View Source

Execute(T)

Provides a strongly-typed variant of .

Declaration
public void Execute(T parameter)
Parameters
Type Name Description
T parameter

The input parameter.

Remarks

Use this overload to avoid boxing, if T is a value type.

View Source

Execute(Nullable<Object>)

Declaration
public void Execute(object? parameter)
Parameters
Type Name Description
System.Nullable<System.Object> parameter
View Source

ExecuteAsync(T)

Provides a strongly-typed variant of ExecuteAsync(Nullable<Object>).

Declaration
public async Task ExecuteAsync(T parameter)
Parameters
Type Name Description
T parameter

The input parameter.

Returns
Type Description
Task

The representing the async operation being executed.

View Source

ExecuteAsync(Nullable<Object>)

Provides a more specific version of , also returning the representing the async operation being executed.

Declaration
public Task ExecuteAsync(object? parameter)
Parameters
Type Name Description
System.Nullable<System.Object> parameter

The input parameter.

Returns
Type Description
Task

The representing the async operation being executed.

View Source

NotifyCanExecuteChanged()

Notifies that the property has changed.

Declaration
public void NotifyCanExecuteChanged()

Events

View Source

CanExecuteChanged

Declaration
public event EventHandler? CanExecuteChanged
Event Type
Type Description
System.Nullable<EventHandler>
View Source

PropertyChanged

Declaration
public event PropertyChangedEventHandler? PropertyChanged
Event Type
Type Description
System.Nullable<PropertyChangedEventHandler>

Implements

IAsyncRelayCommand<T>
IAsyncRelayCommand
INotifyPropertyChanged
IRelayCommand<T>
IRelayCommand
ICommand
IDisposable

Extension Methods

Matrix.Replace<T>(T, Object, Object)
Matrix.IsEqual(Object, Object, Decimal, Decimal)
EntityBaseExtensions.HasProperty(Object, String)
ArrayExtensions.Concatenate<T>(T, T[])
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>, Func<TSource, Boolean>)
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>)
ObjectExtensions.Clone<T>(T)
ObjectExtensions.To<T>(Object)
ObjectExtensions.To(Object, Type)
ObjectExtensions.HasMethod(Object, String)
ObjectExtensions.AddressOf<T>(T)
ReflectionExtensions.GetIdentityValue<T>(T)
ReflectionExtensions.GetIdentityValue<T, TResult>(T)
ReflectionExtensions.GetIdentityProperty<T>(T)
ReflectionExtensions.HasIdentityProperty<T>(T)
ReflectionExtensions.GetPropertyValue<T, TResult>(T, String, TResult)
ReflectionExtensions.GetPropertyInfo<T, TValue>(T, Expression<Func<T, TValue>>)
ReflectionExtensions.GetTitleValue<T>(T)
ReflectionExtensions.HasParentIdentityProperty<T>(T)
ReflectionExtensions.GetParentIdentityProperty<T>(T)
ReflectionExtensions.IsFreeApplication<T>(T)