Search Results for

    Show / Hide Table of Contents

    Class SettingsCollection

    • C#
    • Visual Basic
    public class SettingsCollection : IEnumerable<Page>, IEnumerable
    Public Class SettingsCollection
        Implements IEnumerable(Of Page), IEnumerable
    Inheritance
    System.Object
    SettingsCollection
    Implements
    System.Collections.Generic.IEnumerable<Page>
    System.Collections.IEnumerable
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: HomeSeer.Jui.Views
    Assembly: PluginSdk.dll


    A collection of JUI settings pages.


    Remarks

    This is the primary container for settings pages used by plugins. It is integrated into the AbstractPlugin class and automatically initialized to an empty collection.

    Constructors

    View Source

    SettingsCollection()

    Default, empty constructor

    Declaration
    • C#
    • Visual Basic
    public SettingsCollection()
    Public Sub New
    View Source

    SettingsCollection(List<Page>)

    Create a new SettingsCollection with the given list of pages

    Declaration
    • C#
    • Visual Basic
    [JsonConstructor]
    public SettingsCollection(List<Page> pages)
    <JsonConstructor>
    Public Sub New(pages As List(Of Page))
    Parameters
    Type Name Description
    System.Collections.Generic.List<Page> pages

    The list of pages for the collection

    See Also
    Page

    Fields

    View Source

    _hiddenPages

    Declaration
    • C#
    • Visual Basic
    [JsonIgnore]
    Dictionary<string, Page> _hiddenPages
    <JsonIgnore>
    _hiddenPages As Dictionary(Of String, Page)
    Field Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, Page>
    View Source

    _pageOrder

    Declaration
    • C#
    • Visual Basic
    [JsonIgnore]
    List<string> _pageOrder
    <JsonIgnore>
    _pageOrder As List(Of String)
    Field Value
    Type Description
    System.Collections.Generic.List<System.String>
    View Source

    _pages

    Declaration
    • C#
    • Visual Basic
    [JsonIgnore]
    Dictionary<string, Page> _pages
    <JsonIgnore>
    _pages As Dictionary(Of String, Page)
    Field Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, Page>

    Properties

    View Source

    AllPages

    The list of all of the pages in the collection, including hidden ones.

    Declaration
    • C#
    • Visual Basic
    [JsonIgnore]
    public List<Page> AllPages { get; }
    <JsonIgnore>
    Public ReadOnly Property AllPages As List(Of Page)
    Property Value
    Type Description
    System.Collections.Generic.List<Page>
    View Source

    Count

    The number of pages in this collection

    Declaration
    • C#
    • Visual Basic
    [JsonIgnore]
    public int Count { get; }
    <JsonIgnore>
    Public ReadOnly Property Count As Integer
    Property Value
    Type Description
    System.Int32
    View Source

    Item[String]

    Get the page with the specified ID

    Declaration
    • C#
    • Visual Basic
    public Page this[string pageId] { get; set; }
    Public Property Item(pageId As String) As Page
    Parameters
    Type Name Description
    System.String pageId

    The ID of the desired page

    Property Value
    Type Description
    Page
    See Also
    Page
    View Source

    Pages

    The list of pages in this collection, excluding hidden pages.

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("pages")]
    public List<Page> Pages { get; set; }
    <JsonProperty("pages")>
    Public Property Pages As List(Of Page)
    Property Value
    Type Description
    System.Collections.Generic.List<Page>
    See Also
    Page
    View Source

    SelectedPageIndex

    The index of the page that is selected and will be shown first to users

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("selected_page")]
    public int SelectedPageIndex { get; set; }
    <JsonProperty("selected_page")>
    Public Property SelectedPageIndex As Integer
    Property Value
    Type Description
    System.Int32

    Methods

    View Source

    Add(Page)

    Add a page to the collection

    Declaration
    • C#
    • Visual Basic
    public void Add(Page page)
    Public Sub Add(page As Page)
    Parameters
    Type Name Description
    Page page

    The page to add. Should be a page of type Settings

    Exceptions
    Type Condition
    System.ArgumentNullException

    The supplied page or its ID is null

    System.ArgumentException

    Thrown if a page with the same ID already exists in the collection

    See Also
    Page
    View Source

    ContainsPageId(String)

    Determine if the collection contains a page with the specified ID

    Declaration
    • C#
    • Visual Basic
    public bool ContainsPageId(string pageId)
    Public Function ContainsPageId(pageId As String) As Boolean
    Parameters
    Type Name Description
    System.String pageId

    The ID of the page to look for

    Returns
    Type Description
    System.Boolean

    TRUE if the collection contains the page, FALSE if the page was not found

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when pageId is null or whitespace

    View Source

    FromJsonString(String)

    Deserialize a JSON string to a settings collection

    This should always be wrapped in a try/catch in case the data received is malformed

    Declaration
    • C#
    • Visual Basic
    public static SettingsCollection FromJsonString(string jsonString)
    Public Shared Function FromJsonString(jsonString As String) As SettingsCollection
    Parameters
    Type Name Description
    System.String jsonString

    The JSON string containing the settings collection

    Returns
    Type Description
    SettingsCollection

    A SettingsCollection

    Exceptions
    Type Condition
    JsonDataException

    Thrown when there was a problem deserializing the settings collection

    View Source

    GetEnumerator()

    Declaration
    • C#
    • Visual Basic
    public IEnumerator<Page> GetEnumerator()
    Public Function GetEnumerator As IEnumerator(Of Page)
    Returns
    Type Description
    System.Collections.Generic.IEnumerator<Page>
    View Source

    HidePageById(String)

    Mark the page with the specified ID as hidden when the collection is converted to HTML so that it is not included.

    Declaration
    • C#
    • Visual Basic
    public void HidePageById(string pageId)
    Public Sub HidePageById(pageId As String)
    Parameters
    Type Name Description
    System.String pageId

    The ID of the page to hide

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when an invalid page ID is specified

    System.Collections.Generic.KeyNotFoundException

    Thrown when a page with the specified ID doesn't exist

    View Source

    IndexOf(String)

    Get the index of the page with the specified ID

    Declaration
    • C#
    • Visual Basic
    public int IndexOf(string pageId)
    Public Function IndexOf(pageId As String) As Integer
    Parameters
    Type Name Description
    System.String pageId

    The ID of the page to look for

    Returns
    Type Description
    System.Int32
    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when pageId is null or whitespace

    System.Collections.Generic.KeyNotFoundException

    Thrown when the pageId was not found in the collection

    View Source

    RemoveAll()

    Remove all pages from the collection

    Declaration
    • C#
    • Visual Basic
    public void RemoveAll()
    Public Sub RemoveAll
    View Source

    RemoveById(String)

    Remove the page with the specified ID from the collection

    Declaration
    • C#
    • Visual Basic
    public void RemoveById(string pageId)
    Public Sub RemoveById(pageId As String)
    Parameters
    Type Name Description
    System.String pageId

    The ID of the page to remove

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when pageId is null or whitespace

    System.Collections.Generic.KeyNotFoundException

    Thrown when the pageId was not found in the collection

    View Source

    ShowPageById(String)

    Mark the page with the specified ID as shown when the collection is converted to HTML so that it is included.

    Declaration
    • C#
    • Visual Basic
    public void ShowPageById(string pageId)
    Public Sub ShowPageById(pageId As String)
    Parameters
    Type Name Description
    System.String pageId

    The ID of the page to show

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when an invalid page ID is specified

    System.Collections.Generic.KeyNotFoundException

    Thrown when a page with the specified ID doesn't exist

    View Source

    Swap(Int32, Int32)

    Swap the pages at the specified indexes

    Declaration
    • C#
    • Visual Basic
    public void Swap(int index1, int index2)
    Public Sub Swap(index1 As Integer, index2 As Integer)
    Parameters
    Type Name Description
    System.Int32 index1

    The index of the first page

    System.Int32 index2

    The index of the second page

    Remarks

    When this method finishes, the page at index1 will be located at index2, and the page at index2 will be located at index1.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Thrown if either index is out of range of the collection

    View Source

    ToHtml()

    Convert the settings collection into a tabbed HTML page.

    Declaration
    • C#
    • Visual Basic
    public string ToHtml()
    Public Function ToHtml As String
    Returns
    Type Description
    System.String

    A string containing a tabbed HTML page

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown if the list of pages is null

    System.ArgumentException

    Thrown if the list of pages is empty

    View Source

    ToJsonString()

    Serialize the settings collection as JSON

    Declaration
    • C#
    • Visual Basic
    public string ToJsonString()
    Public Function ToJsonString As String
    Returns
    Type Description
    System.String

    A string containing the settings collection formatted as JSON

    Explicit Interface Implementations

    View Source

    IEnumerable.GetEnumerator()

    Declaration
    • C#
    • Visual Basic
    IEnumerator IEnumerable.GetEnumerator()
    Function System.Collections.IEnumerable.GetEnumerator As IEnumerator Implements IEnumerable.GetEnumerator
    Returns
    Type Description
    System.Collections.IEnumerator

    Implements

    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable

    See Also

    Page
    • View Source
    In This Article
    Back to top HomeSeer Technologies