Class ToggleView
public sealed class ToggleView : AbstractView
Inherited Members
Namespace: HomeSeer.Jui.Views
Assembly: PluginSdk.dll
A toggle switch is used to indicate a control that has only two possible operational states.
Constructors
View SourceToggleView(String, String, Boolean)
Create a new instance of a toggle with an ID and Name
Declaration
[JsonConstructor]
public ToggleView(string id, string name, bool isEnabled = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The unique ID for the view |
System.String | name | The name of the view |
System.Boolean | isEnabled | The state of the toggle. DEFAULT: false |
Properties
View SourceIsEnabled
The current state of the toggle switch
Declaration
[JsonProperty("enabled")]
public bool IsEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ToggleType
The style of toggle
Declaration
[JsonProperty("toggle_style")]
public EToggleType ToggleType { get; set; }
Property Value
Type | Description |
---|---|
EToggleType |
Methods
View SourceGetStringValue()
Get the value associated with this view as a string if there is one.
Declaration
public override string GetStringValue()
Returns
Type | Description |
---|---|
System.String | The value stored in this view as a string or NULL if there is no value stored. |
Overrides
View SourceToHtml(Int32)
Get a string representation of this view converted into HTML
Declaration
public override string ToHtml(int indent = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | indent |
Returns
Type | Description |
---|---|
System.String | An HTML representation of the view as a string |
Overrides
View SourceUpdate(AbstractView)
Update the view to the new state. This will change the enabled state
Declaration
public override void Update(AbstractView newViewState)
Parameters
Type | Name | Description |
---|---|---|
AbstractView | newViewState | The new state of the view being updated. This view's ID and Type must match the calling view exactly |
Overrides
Exceptions
Type | Condition |
---|---|
ViewTypeMismatchException | Thrown when the new view's class doesn't match the calling view |
UpdateValue(String)
Update the value of the view
Declaration
public override void UpdateValue(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The new value |
Overrides
Exceptions
Type | Condition |
---|---|
System.FormatException | Thrown when the value is not in the correct format |