Search Results for

    Show / Hide Table of Contents

    Class ValueRange

    • C#
    • Visual Basic
    [Obfuscation(Exclude = true, ApplyToMembers = true)]
    [Serializable]
    public class ValueRange
    <Obfuscation(Exclude:=True, ApplyToMembers:=True)>
    <Serializable>
    Public Class ValueRange
    Inheritance
    System.Object
    ValueRange
    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.PluginSdk.Devices
    Assembly: PluginSdk.dll


    A range of values that can be targeted by StatusControls and StatusGraphics


    Constructors

    View Source

    ValueRange(Double, Double)

    Initialize a new range of values

    Declaration
    • C#
    • Visual Basic
    public ValueRange(double min, double max)
    Public Sub New(min As Double, max As Double)
    Parameters
    Type Name Description
    System.Double min

    The smallest value permitted

    System.Double max

    The largest value permitted

    Exceptions
    Type Condition
    System.ArgumentException

    Thrown when min is less than max

    Fields

    View Source

    _decimalPlaces

    Declaration
    • C#
    • Visual Basic
    int _decimalPlaces
    _decimalPlaces As Integer
    Field Value
    Type Description
    System.Int32
    View Source

    _divisor

    Declaration
    • C#
    • Visual Basic
    double _divisor
    _divisor As Double
    Field Value
    Type Description
    System.Double
    View Source

    _max

    Declaration
    • C#
    • Visual Basic
    double _max
    _max As Double
    Field Value
    Type Description
    System.Double
    View Source

    _min

    Declaration
    • C#
    • Visual Basic
    double _min
    _min As Double
    Field Value
    Type Description
    System.Double
    View Source

    _offset

    Declaration
    • C#
    • Visual Basic
    double _offset
    _offset As Double
    Field Value
    Type Description
    System.Double
    View Source

    _prefix

    Declaration
    • C#
    • Visual Basic
    string _prefix
    _prefix As String
    Field Value
    Type Description
    System.String
    View Source

    _suffix

    Declaration
    • C#
    • Visual Basic
    string _suffix
    _suffix As String
    Field Value
    Type Description
    System.String

    Properties

    View Source

    DecimalPlaces

    The number of decimal places of accuracy displayed by the range

    The displayed value will be the rounded value to the nearest number of decimals. E.G. If DecimalPlaces is 1, a value of 7.1589 will be displayed as 7.2

    Declaration
    • C#
    • Visual Basic
    public int DecimalPlaces { get; set; }
    Public Property DecimalPlaces As Integer
    Property Value
    Type Description
    System.Int32
    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Thrown if you try to set the decimal places to a value less than 0

    View Source

    Divisor

    The amount to divide the value by for display.

    E.G. A value of 45 will be displayed as 22.5 with a divisor of 2

    Declaration
    • C#
    • Visual Basic
    public double Divisor { get; set; }
    Public Property Divisor As Double
    Property Value
    Type Description
    System.Double
    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Thrown if you try to set the divisor less than or equal to 0

    View Source

    Max

    The maximum value permitted by the range

    Declaration
    • C#
    • Visual Basic
    public double Max { get; set; }
    Public Property Max As Double
    Property Value
    Type Description
    System.Double
    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Thrown if the new maximum value is smaller than the current minimum

    View Source

    Min

    The minimum value permitted by the range

    Declaration
    • C#
    • Visual Basic
    public double Min { get; set; }
    Public Property Min As Double
    Property Value
    Type Description
    System.Double
    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Thrown if the new minimum value is larger than the current maximum

    View Source

    Offset

    The amount to subtract from the value for display.

    E.G. A value of 501 will be displayed as 1 with an offset of 500

    Declaration
    • C#
    • Visual Basic
    public double Offset { get; set; }
    Public Property Offset As Double
    Property Value
    Type Description
    System.Double
    View Source

    Prefix

    A text prefix to include with the value when displayed

    Declaration
    • C#
    • Visual Basic
    public string Prefix { get; set; }
    Public Property Prefix As String
    Property Value
    Type Description
    System.String
    View Source

    Suffix

    A text suffix to include with the value when displayed

    Declaration
    • C#
    • Visual Basic
    public string Suffix { get; set; }
    Public Property Suffix As String
    Property Value
    Type Description
    System.String

    Methods

    View Source

    Clone()

    Create a deep copy of this ValueRange

    Declaration
    • C#
    • Visual Basic
    public ValueRange Clone()
    Public Function Clone As ValueRange
    Returns
    Type Description
    ValueRange

    The deep copy of this ValueRange

    View Source

    Equals(Object)

    Compare this object with another to see if they are equal

    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

    The object to compare

    Returns
    Type Description
    System.Boolean

    True if they are equal, False if they are not

    Overrides
    System.Object.Equals(System.Object)
    View Source

    GetHashCode()

    Get the hash code

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

    A hash code based on the Min and Max value

    Overrides
    System.Object.GetHashCode()
    View Source

    GetStringForValue(Double)

    Obtain the string representation of the specified value according to the range's configuration

    Declaration
    • C#
    • Visual Basic
    public string GetStringForValue(double value)
    Public Function GetStringForValue(value As Double) As String
    Parameters
    Type Name Description
    System.Double value

    The value to use in the string

    Returns
    Type Description
    System.String

    The value correctly formatted according to the range

    Remarks

    This returns $"{_prefix}{((value - _offset) / _divisor).ToString($"F{_decimalPlaces}")}{_suffix}"

    View Source

    IsValueInRange(Double)

    Determine if the specified value is valid for this range

    Declaration
    • C#
    • Visual Basic
    public bool IsValueInRange(double value)
    Public Function IsValueInRange(value As Double) As Boolean
    Parameters
    Type Name Description
    System.Double value

    The value to check

    Returns
    Type Description
    System.Boolean

    TRUE is it is valid for the range, FALSE if it is not

    • View Source
    In This Article
    Back to top HomeSeer Technologies