Search Results for

    Show / Hide Table of Contents

    Class Page

    • C#
    • Visual Basic
    public class Page
    Public Class Page
    Inheritance
    System.Object
    Page
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: HomeSeer.Jui.Views
    Assembly: PluginSdk.dll


    A page is the primary container used to define a view for the user interface.


    Constructors

    View Source

    Page(String, String, EPageType)

    Create a new instance of a Page of the specified type with an ID and Name

    Declaration
    • C#
    • Visual Basic
    [JsonConstructor]
    Page(string id, string name, EPageType type)
    <JsonConstructor>
    Sub New(id As String, name As String, type As EPageType)
    Parameters
    Type Name Description
    System.String id

    The unique ID of the page

    System.String name

    The name of the page; the title shown to the user

    EPageType type

    The type of the page

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown if a Page is created with an invalid ID or Name

    Fields

    View Source

    _viewIds

    A set of IDs for the views on this page. This is used to ensure that there are no duplicate IDs used.

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

    _views

    The collection of views that are on this page.

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("views")]
    List<AbstractView> _views
    <JsonProperty("views")>
    _views As List(Of AbstractView)
    Field Value
    Type Description
    System.Collections.Generic.List<AbstractView>

    Properties

    View Source

    Id

    A unique identifier for the page

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("id")]
    public string Id { get; protected set; }
    <JsonProperty("id")>
    Public Property Id As String
    Property Value
    Type Description
    System.String
    View Source

    Image

    A Base64 encoded image used as an icon for this page

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("image")]
    public string Image { get; set; }
    <JsonProperty("image")>
    Public Property Image As String
    Property Value
    Type Description
    System.String
    View Source

    Name

    The name that is displayed to the user for this page

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("name")]
    public string Name { get; protected set; }
    <JsonProperty("name")>
    Public Property Name As String
    Property Value
    Type Description
    System.String
    View Source

    Type

    The page's type; this determines where this page will present itself to the user.

    Declaration
    • C#
    • Visual Basic
    [JsonProperty("type")]
    public EPageType Type { get; protected set; }
    <JsonProperty("type")>
    Public Property Type As EPageType
    Property Value
    Type Description
    EPageType
    View Source

    ViewCount

    The number of views that are on this page.

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

    ViewIds

    A list of the IDs of the views in this group

    Declaration
    • C#
    • Visual Basic
    [JsonIgnore]
    public ReadOnlyCollection<string> ViewIds { get; }
    <JsonIgnore>
    Public ReadOnly Property ViewIds As ReadOnlyCollection(Of String)
    Property Value
    Type Description
    System.Collections.ObjectModel.ReadOnlyCollection<System.String>
    View Source

    Views

    The collection of views that are on this page. This is for access only. Use AddView(AbstractView) and UpdateViewById(AbstractView) for setting views/updating them

    Declaration
    • C#
    • Visual Basic
    [JsonIgnore]
    public ReadOnlyCollection<AbstractView> Views { get; }
    <JsonIgnore>
    Public ReadOnly Property Views As ReadOnlyCollection(Of AbstractView)
    Property Value
    Type Description
    System.Collections.ObjectModel.ReadOnlyCollection<AbstractView>

    Methods

    View Source

    AddView(AbstractView)

    Add a view to the page

    Declaration
    • C#
    • Visual Basic
    public void AddView(AbstractView view)
    Public Sub AddView(view As AbstractView)
    Parameters
    Type Name Description
    AbstractView view
    Exceptions
    Type Condition
    System.ArgumentNullException

    The view or its ID is null

    System.ArgumentException

    There is already a view with the same ID present in the collection

    System.InvalidOperationException

    Thrown when trying to add a ViewGroup to another ViewGroup

    ViewTypeMismatchException

    Thrown when a view group's type does not match its class

    View Source

    AddViewDelta(AbstractView, Object)

    Add a view change to the page

    Used to log value changes for views on settings, device config, event trigger and event action pages. This method performs a shallow copy of the original view and update it with the new value before adding it to the page.

    Declaration
    • C#
    • Visual Basic
    public void AddViewDelta(AbstractView originalView, object newValue)
    Public Sub AddViewDelta(originalView As AbstractView, newValue As Object)
    Parameters
    Type Name Description
    AbstractView originalView

    The original view before the change

    System.Object newValue

    The new value for the view

    Exceptions
    Type Condition
    System.ArgumentNullException

    A valid original view was not specified

    System.ArgumentOutOfRangeException

    The type or integer value is invalid

    System.ArgumentException

    The value type doesn't match the view type

    View Source

    AddViewDelta(String, Int32, Object)

    Add a view change to the page

    Used to log value changes for views on settings pages. All names are left blank

    Declaration
    • C#
    • Visual Basic
    public void AddViewDelta(string id, int type, object value)
    Public Sub AddViewDelta(id As String, type As Integer, value As Object)
    Parameters
    Type Name Description
    System.String id

    The id of the view

    System.Int32 type

    The EViewType of the view

    System.Object value

    The new value for the view

    Exceptions
    Type Condition
    System.ArgumentNullException

    A valid ID was not specified

    System.ArgumentOutOfRangeException

    The type or integer value is invalid

    System.ArgumentException

    The value type doesn't match the view type

    View Source

    AddViews(IEnumerable<AbstractView>)

    Add multiple views to the page

    Declaration
    • C#
    • Visual Basic
    public void AddViews(IEnumerable<AbstractView> views)
    Public Sub AddViews(views As IEnumerable(Of AbstractView))
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<AbstractView> views
    Exceptions
    Type Condition
    System.ArgumentNullException

    The list of views is null

    View Source

    ContainsViewWithId(String)

    Check to see if a view with a specific ID is present in a collection

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

    TRUE if the view exists in the collection; FALSE if it does not exist in the collection

    Exceptions
    Type Condition
    System.ArgumentNullException

    The viewId to look for is NULL

    System.IndexOutOfRangeException

    The ID was found, but the view is not in the collection

    View Source

    Equals(Object)

    Compares the Id, Name, and the number of views

    Declaration
    • C#
    • Visual Basic
    public override bool Equals(object obj)
    Public Overrides Function Equals(obj As Object) As Boolean
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.Object.Equals(System.Object)
    View Source

    FromJsonString(String)

    Deserialize a JSON string to a page

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

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

    The JSON string containing the page

    Returns
    Type Description
    Page

    A Page

    Exceptions
    Type Condition
    JsonDataException

    Thrown when there was a problem deserializing the page

    View Source

    GetHashCode()

    Compares the Id, Name, and the number of views

    Declaration
    • C#
    • Visual Basic
    public override int GetHashCode()
    Public Overrides Function GetHashCode As Integer
    Returns
    Type Description
    System.Int32
    Overrides
    System.Object.GetHashCode()
    View Source

    GetViewById(String)

    Get the view on the page with the given ID

    Declaration
    • C#
    • Visual Basic
    public AbstractView GetViewById(string viewId)
    Public Function GetViewById(viewId As String) As AbstractView
    Parameters
    Type Name Description
    System.String viewId

    The ID of the view to get

    Returns
    Type Description
    AbstractView

    The view with the specified ID as an AbstractView. This should be cast to the appropriate view type before use.

    Exceptions
    Type Condition
    System.ArgumentNullException

    An invalid view ID was entered

    System.ArgumentException

    No views are on the page to get

    System.IndexOutOfRangeException

    The ID was found, but the view was not. The page is probably malformed and should be recreated.

    System.Collections.Generic.KeyNotFoundException

    No views with that ID were found

    View Source

    GetViewById<TViewType>(String)

    Get the view with a specific ID from a collection cast as the target type

    Declaration
    • C#
    • Visual Basic
    public TViewType GetViewById<TViewType>(string viewId)
        where TViewType : AbstractView
    Public Function GetViewById(Of TViewType As AbstractView)(viewId As String) As TViewType
    Parameters
    Type Name Description
    System.String viewId

    The ID of the view to get

    Returns
    Type Description
    TViewType

    The view with the specified ID cast as the target type.

    Type Parameters
    Name Description
    TViewType
    Exceptions
    Type Condition
    System.ArgumentNullException

    An invalid view ID was entered

    System.ArgumentException

    No views are on the page to get

    System.IndexOutOfRangeException

    The ID was found, but the view was not. The page is probably malformed and should be recreated.

    System.Collections.Generic.KeyNotFoundException

    No views with that ID were found

    View Source

    ListFromJson(String)

    Deserialize a JSON string to a List of Pages

    Declaration
    • C#
    • Visual Basic
    public static List<Page> ListFromJson(string jsonString)
    Public Shared Function ListFromJson(jsonString As String) As List(Of Page)
    Parameters
    Type Name Description
    System.String jsonString

    The JSON string containing the list of pages

    Returns
    Type Description
    System.Collections.Generic.List<Page>

    A List of Jui.Page objects

    Exceptions
    Type Condition
    JsonDataException

    Thrown when there was a problem deserializing the page

    View Source

    MapViewIds()

    Build a map of view IDs and list indexes for a collection of views

    Declaration
    • C#
    • Visual Basic
    void MapViewIds()
    Sub MapViewIds
    Exceptions
    Type Condition
    System.ArgumentNullException

    The list of views to map is null

    View Source

    RemoveAllViews()

    Clear a collection of views

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

    RemoveViewById(String)

    Remove a view with the specified ID from the collection.

    Remaining views at indexes greater than the specified view will be moved down one index to fill the empty space

    Declaration
    • C#
    • Visual Basic
    public void RemoveViewById(string viewId)
    Public Sub RemoveViewById(viewId As String)
    Parameters
    Type Name Description
    System.String viewId
    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when any of the supplied parameters is null of empty

    System.ArgumentException

    Thrown when the number of items in the viewList and viewIds do not match

    System.Collections.Generic.KeyNotFoundException

    Thrown when a view with the specified ID was not found

    View Source

    RemoveViewsAfterId(String)

    Trim all views in the collection following the view with the specified ID

    Declaration
    • C#
    • Visual Basic
    public void RemoveViewsAfterId(string viewId)
    Public Sub RemoveViewsAfterId(viewId As String)
    Parameters
    Type Name Description
    System.String viewId
    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when any of the supplied parameters is null of empty

    System.ArgumentException

    Thrown when the number of items in the viewList and viewIds do not match

    View Source

    SetViews(IEnumerable<AbstractView>)

    Set the list of views on this page

    Declaration
    • C#
    • Visual Basic
    public void SetViews(IEnumerable<AbstractView> views)
    Public Sub SetViews(views As IEnumerable(Of AbstractView))
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<AbstractView> views
    Exceptions
    Type Condition
    System.ArgumentNullException

    The list of views is null

    View Source

    ToHtml(Int32)

    Get a string representation of this page converted into HTML

    Declaration
    • C#
    • Visual Basic
    public string ToHtml(int indent = 0)
    Public Function ToHtml(indent As Integer = 0) As String
    Parameters
    Type Name Description
    System.Int32 indent
    Returns
    Type Description
    System.String

    An HTML representation of the page as a string

    View Source

    ToJsonString()

    Serialize the page as JSON

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

    A string containing the page formatted as JSON

    View Source

    ToValueMap()

    Get a dictionary mapping IDs to values for the views on this page with mutable values.

    These include: InputViews, SelectListViews, and ToggleViews

    Declaration
    • C#
    • Visual Basic
    public Dictionary<string, string> ToValueMap()
    Public Function ToValueMap As Dictionary(Of String, String)
    Returns
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.String>

    A Dictionary of view IDs to view values

    View Source

    UpdateViewById(AbstractView)

    Perform a soft update to a view in a collection with a particular ID

    Declaration
    • C#
    • Visual Basic
    public void UpdateViewById(AbstractView view)
    Public Sub UpdateViewById(view As AbstractView)
    Parameters
    Type Name Description
    AbstractView view
    Exceptions
    Type Condition
    System.ArgumentNullException

    The viewId to look for is NULL

    System.IndexOutOfRangeException

    The ID was found, but the view is not in the collection

    System.ArgumentException

    There are no views in the collection

    ViewNotFoundException

    No views with that ID were found in the collection

    View Source

    UpdateViewValueById(String, String)

    Declaration
    • C#
    • Visual Basic
    public void UpdateViewValueById(string id, string value)
    Public Sub UpdateViewValueById(id As String, value As String)
    Parameters
    Type Name Description
    System.String id
    System.String value
    • View Source
    In This Article
    Back to top HomeSeer Technologies