Class EditorCommand<T>
An implementation of the IEditorCommand<T> interface.
Implements
Inherited Members
Namespace: Gorgon.Editor.UI
Assembly: Gorgon.Editor.API.dll
Syntax
public class EditorCommand<T> : IEditorCommand<T>
Type Parameters
Name | Description |
---|---|
T | The type of data to pass to the command. |
Remarks
Commands are used to perform actions on a view model. They work similarly to events in that they are usually called in response to a UI action like a button click.
Constructors
| Edit this page View SourceEditorCommand(Action, Func<bool>)
Initializes a new instance of the EditorCommand<T> class.
Declaration
public EditorCommand(Action execute, Func<bool> canExecute = null)
Parameters
Type | Name | Description |
---|---|---|
Action | execute | The method to execute when the command is executed. |
Func<bool> | canExecute | The method used to determine if the command can execute. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
EditorCommand(Action<T>, Func<T, bool>)
Initializes a new instance of the EditorCommand<T> class.
Declaration
public EditorCommand(Action<T> execute, Func<T, bool> canExecute = null)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | execute | The method to execute when the command is executed. |
Func<T, bool> | canExecute | The method used to determine if the command can execute. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
Methods
| Edit this page View SourceCanExecute(T)
Function to determine if a command can be executed or not.
Declaration
public bool CanExecute(T args)
Parameters
Type | Name | Description |
---|---|---|
T | args | The arguments to check. |
Returns
Type | Description |
---|---|
bool | true if the command can be executed, false if not. |
Execute(T)
Function to execute the command.
Declaration
public void Execute(T args)
Parameters
Type | Name | Description |
---|---|---|
T | args | The arguments to pass to the command. |