Class Command<TParam>
- Namespace
- CarinaStudio.Windows.Input
- Assembly
- CarinaStudio.AppBase.Application.dll
Implementation of ICommand.
public class Command<TParam> : BaseCommand, ICommand
Type Parameters
TParam
- Inheritance
-
Command<TParam>
- Implements
- Inherited Members
- Extension Methods
Constructors
Command(Action<TParam>, IObservable<bool>?)
Initialize new Command instance.
public Command(Action<TParam> execute, IObservable<bool>? canExecute = null)
Parameters
executeAction<TParam>Action to execute command.
canExecuteIObservable<bool>IObservable<T> to indicate whether command can be executed or not.
Command(Func<TParam, Task>, IObservable<bool>?)
Initialize new Command instance.
public Command(Func<TParam, Task> asyncExecute, IObservable<bool>? canExecute = null)
Parameters
asyncExecuteFunc<TParam, Task>Asynchronous action to execute command.
canExecuteIObservable<bool>IObservable<T> to indicate whether command can be executed or not.
Methods
CanExecute(object?)
Check whether command can be executed or not.
public override bool CanExecute(object? parameter)
Parameters
parameterobjectParameter.
Returns
Execute(object?)
Execute command.
public override void Execute(object? parameter)
Parameters
parameterobjectParameter.