Class SimpleCommand
Describes a simplified command that can be used in a ViewModelBase.
Implements
Inherited Members
Namespace: TheXDS.MCART.Component
Assembly: MCART.Mvvm.dll
Syntax
public class SimpleCommand : CommandBase, ICommand
Constructors
| Edit this page View SourceSimpleCommand(Action)
Initializes a new instance of the SimpleCommand class.
Declaration
public SimpleCommand(Action action)
Parameters
Type | Name | Description |
---|---|---|
Action | action | Action to be executed. |
SimpleCommand(Action, bool)
Initializes a new instance of the SimpleCommand class.
Declaration
public SimpleCommand(Action action, bool canExecute)
Parameters
Type | Name | Description |
---|---|---|
Action | action | Action to be executed. |
bool | canExecute | Indicates if the command will be executable by default. |
SimpleCommand(Action<object?>)
Initializes a new instance of the SimpleCommand class.
Declaration
public SimpleCommand(Action<object?> action)
Parameters
Type | Name | Description |
---|---|---|
Action<object> | action | Action to be executed. |
SimpleCommand(Action<object?>, bool)
Describes a simplified command that can be used in a ViewModelBase.
Declaration
public SimpleCommand(Action<object?> action, bool canExecute)
Parameters
Type | Name | Description |
---|---|---|
Action<object> | action | Action to execute. |
bool | canExecute | Indicates if the command will be executable by default. |
SimpleCommand(Func<object?, Task>)
Initializes a new instance of the SimpleCommand class.
Declaration
public SimpleCommand(Func<object?, Task> task)
Parameters
Type | Name | Description |
---|---|---|
Func<object, Task> | task | Task to be executed. |
SimpleCommand(Func<object?, Task>, bool)
Initializes a new instance of the SimpleCommand class.
Declaration
public SimpleCommand(Func<object?, Task> task, bool canExecute)
Parameters
Type | Name | Description |
---|---|---|
Func<object, Task> | task | Task to be executed. |
bool | canExecute | Indicates if the command will be executable by default. |
SimpleCommand(Func<Task>)
Initializes a new instance of the SimpleCommand class.
Declaration
public SimpleCommand(Func<Task> task)
Parameters
Type | Name | Description |
---|---|---|
Func<Task> | task | Task to be executed. |
SimpleCommand(Func<Task>, bool)
Initializes a new instance of the SimpleCommand class.
Declaration
public SimpleCommand(Func<Task> task, bool canExecute)
Parameters
Type | Name | Description |
---|---|---|
Func<Task> | task | Task to be executed. |
bool | canExecute | Indicates if the command will be executable by default. |
Methods
| Edit this page View SourceCanExecute(object?)
Checks if the current command can be executed.
Declaration
public override bool CanExecute(object? parameter)
Parameters
Type | Name | Description |
---|---|---|
object | parameter | DCommand parameters. If the command does not require parameters, this value can be set to null. |
Returns
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceSetCanExecute(bool)
Manually sets a value that determines if this command can be executed.
Declaration
public void SetCanExecute(bool canExecute)
Parameters
Type | Name | Description |
---|---|---|
bool | canExecute | Value that indicates if the command can be executed. |