Open sandboxFocus

Method CreateBackgroundDelegateCommand

CreateBackgroundDelegateCommand<T>(Action<T, CancellationToken>, Func<T, bool>?, bool)

Creates a background command that accepts a parameter, with cancellation support. The execution is always dispatched to a background thread.

Declaration
public static AsyncDelegateCommand<T> CreateBackgroundDelegateCommand<T>(Action<T, CancellationToken> execute, Func<T, bool>? canExecute, bool supportsConcurrentExecution)
Parameters
Type Name Description
Action<T, CancellationToken> execute

The synchronous delegate to invoke on a background thread. Receives the parameter and a CancellationToken.

Func<T, bool> canExecute

An optional delegate that determines whether the command can execute for a given parameter. If null, the command can always execute.

bool supportsConcurrentExecution

If true, allows multiple concurrent executions of the command.

Returns
Type Description
AsyncDelegateCommand<T>

A new AsyncDelegateCommand<T> instance that executes on a background thread.

Type Parameters
Name Description
T

The type of the command parameter.

CreateBackgroundDelegateCommand<T>(Action<T>, Func<T, bool>?, bool)

Creates a background command that accepts a parameter, without cancellation support. The execution is always dispatched to a background thread.

Declaration
public static AsyncDelegateCommand<T> CreateBackgroundDelegateCommand<T>(Action<T> execute, Func<T, bool>? canExecute, bool supportsConcurrentExecution)
Parameters
Type Name Description
Action<T> execute

The synchronous delegate to invoke on a background thread.

Func<T, bool> canExecute

An optional delegate that determines whether the command can execute for a given parameter. If null, the command can always execute.

bool supportsConcurrentExecution

If true, allows multiple concurrent executions of the command.

Returns
Type Description
AsyncDelegateCommand<T>

A new AsyncDelegateCommand<T> instance that executes on a background thread.

Type Parameters
Name Description
T

The type of the command parameter.

CreateBackgroundDelegateCommand(Action<CancellationToken>, Func<bool>?, bool)

Creates a background command without a parameter, with cancellation support. The execution is always dispatched to a background thread.

Declaration
public static AsyncDelegateCommand CreateBackgroundDelegateCommand(Action<CancellationToken> execute, Func<bool>? canExecute, bool supportsConcurrentExecution)
Parameters
Type Name Description
Action<CancellationToken> execute

The synchronous delegate to invoke on a background thread. Receives a CancellationToken.

Func<bool> canExecute

An optional delegate that determines whether the command can execute. If null, the command can always execute.

bool supportsConcurrentExecution

If true, allows multiple concurrent executions of the command.

Returns
Type Description
AsyncDelegateCommand

A new AsyncDelegateCommand instance that executes on a background thread.

CreateBackgroundDelegateCommand(Action, Func<bool>?, bool)

Creates a background command without a parameter, without cancellation support. The execution is always dispatched to a background thread.

Declaration
public static AsyncDelegateCommand CreateBackgroundDelegateCommand(Action execute, Func<bool>? canExecute, bool supportsConcurrentExecution)
Parameters
Type Name Description
Action execute

The synchronous delegate to invoke on a background thread.

Func<bool> canExecute

An optional delegate that determines whether the command can execute. If null, the command can always execute.

bool supportsConcurrentExecution

If true, allows multiple concurrent executions of the command.

Returns
Type Description
AsyncDelegateCommand

A new AsyncDelegateCommand instance that executes on a background thread.

CreateBackgroundDelegateCommand(Action<CancellationToken>, Func<bool>, INotifyPropertyChanged, string, bool)

Creates a background command without a parameter, with cancellation support and INotifyPropertyChanged integration. The execution is always dispatched to a background thread.

Declaration
public static AsyncDelegateCommand CreateBackgroundDelegateCommand(Action<CancellationToken> execute, Func<bool> canExecute, INotifyPropertyChanged canExecuteNotifier, string canExecutePropertyName, bool supportsConcurrentExecution)
Parameters
Type Name Description
Action<CancellationToken> execute

The synchronous delegate to invoke on a background thread. Receives a CancellationToken.

Func<bool> canExecute

A delegate that determines whether the command can execute.

INotifyPropertyChanged canExecuteNotifier

The object that raises PropertyChanged when the CanExecute property changes.

string canExecutePropertyName

The name of the property that controls CanExecute.

bool supportsConcurrentExecution

If true, allows multiple concurrent executions of the command.

Returns
Type Description
AsyncDelegateCommand

A new AsyncDelegateCommand instance that executes on a background thread and automatically raises CanExecuteChanged when the specified property changes.

CreateBackgroundDelegateCommand<T>(Action<T, CancellationToken>, Func<T, bool>, INotifyPropertyChanged, string, bool)

Creates a background command that accepts a parameter, with cancellation support and INotifyPropertyChanged integration. The execution is always dispatched to a background thread.

Declaration
public static AsyncDelegateCommand<T> CreateBackgroundDelegateCommand<T>(Action<T, CancellationToken> execute, Func<T, bool> canExecute, INotifyPropertyChanged canExecuteNotifier, string canExecutePropertyName, bool supportsConcurrentExecution)
Parameters
Type Name Description
Action<T, CancellationToken> execute

The synchronous delegate to invoke on a background thread. Receives the parameter and a CancellationToken.

Func<T, bool> canExecute

A delegate that determines whether the command can execute for a given parameter.

INotifyPropertyChanged canExecuteNotifier

The object that raises PropertyChanged when the CanExecute property changes.

string canExecutePropertyName

The name of the property that controls CanExecute.

bool supportsConcurrentExecution

If true, allows multiple concurrent executions of the command.

Returns
Type Description
AsyncDelegateCommand<T>

A new AsyncDelegateCommand<T> instance that executes on a background thread and automatically raises CanExecuteChanged when the specified property changes.

Type Parameters
Name Description
T

The type of the command parameter.

CreateBackgroundDelegateCommand(Action, Func<bool>, INotifyPropertyChanged, string, bool)

Creates a background command without a parameter, without cancellation support, with INotifyPropertyChanged integration. The execution is always dispatched to a background thread.

Declaration
public static AsyncDelegateCommand CreateBackgroundDelegateCommand(Action execute, Func<bool> canExecute, INotifyPropertyChanged canExecuteNotifier, string canExecutePropertyName, bool supportsConcurrentExecution)
Parameters
Type Name Description
Action execute

The synchronous delegate to invoke on a background thread.

Func<bool> canExecute

A delegate that determines whether the command can execute.

INotifyPropertyChanged canExecuteNotifier

The object that raises PropertyChanged when the CanExecute property changes.

string canExecutePropertyName

The name of the property that controls CanExecute.

bool supportsConcurrentExecution

If true, allows multiple concurrent executions of the command.

Returns
Type Description
AsyncDelegateCommand

A new AsyncDelegateCommand instance that executes on a background thread and automatically raises CanExecuteChanged when the specified property changes.

CreateBackgroundDelegateCommand<T>(Action<T>, Func<T, bool>, INotifyPropertyChanged, string, bool)

Creates a background command that accepts a parameter, without cancellation support, with INotifyPropertyChanged integration. The execution is always dispatched to a background thread.

Declaration
public static AsyncDelegateCommand<T> CreateBackgroundDelegateCommand<T>(Action<T> execute, Func<T, bool> canExecute, INotifyPropertyChanged canExecuteNotifier, string canExecutePropertyName, bool supportsConcurrentExecution)
Parameters
Type Name Description
Action<T> execute

The synchronous delegate to invoke on a background thread.

Func<T, bool> canExecute

A delegate that determines whether the command can execute for a given parameter.

INotifyPropertyChanged canExecuteNotifier

The object that raises PropertyChanged when the CanExecute property changes.

string canExecutePropertyName

The name of the property that controls CanExecute.

bool supportsConcurrentExecution

If true, allows multiple concurrent executions of the command.

Returns
Type Description
AsyncDelegateCommand<T>

A new AsyncDelegateCommand<T> instance that executes on a background thread and automatically raises CanExecuteChanged when the specified property changes.

Type Parameters
Name Description
T

The type of the command parameter.