Class ValueRange
[Obfuscation(Exclude = true, ApplyToMembers = true)]
[Serializable]
public class ValueRange
Inheritance
Inherited Members
Namespace: HomeSeer.PluginSdk.Devices
Assembly: PluginSdk.dll
A range of values that can be targeted by StatusControls and StatusGraphics
Constructors
View SourceValueRange(Double, Double)
Initialize a new range of values
Declaration
public ValueRange(double min, double max)
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 |
Fields
View Source_decimalPlaces
Declaration
int _decimalPlaces
Field Value
Type | Description |
---|---|
System.Int32 |
_divisor
Declaration
double _divisor
Field Value
Type | Description |
---|---|
System.Double |
_max
Declaration
double _max
Field Value
Type | Description |
---|---|
System.Double |
_min
Declaration
double _min
Field Value
Type | Description |
---|---|
System.Double |
_offset
Declaration
double _offset
Field Value
Type | Description |
---|---|
System.Double |
_prefix
Declaration
string _prefix
Field Value
Type | Description |
---|---|
System.String |
_suffix
Declaration
string _suffix
Field Value
Type | Description |
---|---|
System.String |
Properties
View SourceDecimalPlaces
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
public int DecimalPlaces { get; set; }
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 |
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
public double Divisor { get; set; }
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 |
Max
The maximum value permitted by the range
Declaration
public double Max { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if the new maximum value is smaller than the current minimum |
Min
The minimum value permitted by the range
Declaration
public double Min { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if the new minimum value is larger than the current maximum |
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
public double Offset { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Prefix
A text prefix to include with the value when displayed
Declaration
public string Prefix { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Suffix
A text suffix to include with the value when displayed
Declaration
public string Suffix { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
View SourceClone()
Create a deep copy of this ValueRange
Declaration
public ValueRange Clone()
Returns
Type | Description |
---|---|
ValueRange | The deep copy of this ValueRange |
Equals(Object)
Compare this object with another to see if they are equal
Declaration
public override bool Equals(object obj)
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
GetHashCode()
Get the hash code
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
GetStringForValue(Double)
Obtain the string representation of the specified value according to the range's configuration
Declaration
public string GetStringForValue(double value)
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}"
IsValueInRange(Double)
Determine if the specified value is valid for this range
Declaration
public bool IsValueInRange(double value)
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 |