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: ClientCore.dll
Syntax
public abstract class SingleToggleCommand : ViewToggleCommand, IHasChildren<EPCommandWithDescriptor>, IHasChildren, IDisposable, IEPCommandWithDescriptor, IEPCommand, ICommand, ICommandDescriptor
Constructors
SingleToggleCommand(IModelLayoutCommon, Func<Boolean>, Action<Boolean>)
Creates a new veiw SingleToggleCommand
Declaration
public SingleToggleCommand(IModelLayoutCommon host, Func<bool> isToggled, Action<bool> toggle)
Parameters
Type | Name | Description |
---|---|---|
IModelLayoutCommon | host | The host context this command operates within |
System.Func<System.Boolean> | isToggled | A function that indicates the state of this toggle command |
System.Action<System.Boolean> | toggle | A method that indicates the toggle action is being executed |
SingleToggleCommand(Func<Boolean>, Action<Boolean>)
Creates a new veiw SingleToggleCommand
Declaration
public SingleToggleCommand(Func<bool> isToggled, Action<bool> toggle)
Parameters
Type | Name | Description |
---|---|---|
System.Func<System.Boolean> | isToggled | A function that indicates the state of this toggle command |
System.Action<System.Boolean> | 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 |
---|---|
System.Boolean |
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 |
---|---|---|
System.Object | parameter | The command parameter |
Returns
Type | Description |
---|---|
System.Boolean | True |
Overrides
InternalExecute(Object)
Toggles the toggle action for this command
Declaration
public override void InternalExecute(object parameter)
Parameters
Type | Name | Description |
---|---|---|
System.Object | parameter | The command parameter |
Overrides
OnToggleChanged()
Call to indicate the toggle class has had its toggle state changed
Declaration
public void OnToggleChanged()