Class SingleToggleCommand
A base toggle view command that provides an implemention of the IHasToggleStatus derived from a function stating if the item is toggled, and an action to toggle it
This can be used for simple toggle states that do not need to track events or other UI wiring
Inheritance
Implements
Inherited Members
Namespace: LemonEdge.Client.Core.Commands.ViewCommands
Assembly: LemonEdge.ClientCore.dll
Syntax
public abstract class SingleToggleCommand : ViewToggleCommand, IHasChildren<EPCommandWithDescriptor>, IHasChildren, IDisposable, IEPCommandWithDescriptor, IEPCommand, ICommand, ICommandDescriptor
Constructors
SingleToggleCommand(IRootController, Func<bool>, Action<bool>)
Creates a new view SingleToggleCommand
Declaration
protected SingleToggleCommand(IRootController root, Func<bool> isToggled, Action<bool> toggle)
Parameters
Type | Name | Description |
---|---|---|
IRootController | root | The root controller, for service access. |
Func<bool> | isToggled | A function that indicates the state of this toggle command |
Action<bool> | toggle | A method that indicates the toggle action is being executed |
Properties
InExecuteCanToggle
Returns if this command can execute the toggle action. Default is true.
Declaration
protected virtual bool InExecuteCanToggle { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
InternalCanExecute(object)
True - Can always switch the toggle state of this command. Override to change
Declaration
public override bool InternalCanExecute(object parameter)
Parameters
Type | Name | Description |
---|---|---|
object | parameter | The command parameter |
Returns
Type | Description |
---|---|
bool | True |
Overrides
InternalExecute(object)
Toggles the toggle action for this command
Declaration
public override void InternalExecute(object parameter)
Parameters
Type | Name | Description |
---|---|---|
object | parameter | The command parameter |
Overrides
OnToggleChanged()
Call to indicate the toggle class has had its toggle state changed
Declaration
public void OnToggleChanged()