3using System.Windows.Media;
15 private readonly
Field field;
23 : base(Colors.Black, Colors.White)
30 if (QoS.HasFlag(
FieldQoS.InvoiceConfirmed) || QoS.HasFlag(
FieldQoS.Invoiced))
31 this.BackgroundColor = Colors.Gold;
32 else if (QoS.HasFlag(
FieldQoS.EndOfSeries))
33 this.BackgroundColor = Colors.LightBlue;
34 else if (QoS.HasFlag(
FieldQoS.Signed))
35 this.BackgroundColor = Colors.LightGreen;
36 else if (QoS.HasFlag(
FieldQoS.Error))
37 this.BackgroundColor = Colors.LightPink;
39 this.BackgroundColor = Colors.LightYellow;
41 this.BackgroundColor = Colors.LightGray;
42 else if (QoS.HasFlag(
FieldQoS.AutomaticEstimate) || QoS.HasFlag(
FieldQoS.ManualEstimate))
43 this.BackgroundColor = Colors.WhiteSmoke;
58 return this.field.Timestamp.ToShortDateString() +
", " + this.field.Timestamp.ToLongTimeString();
74 if (!(this.quantityField is
null))
75 return CommonTypes.
Encode(this.quantityField.Value,
this.quantityField.NrDecimals);
77 return this.field.ObjectValue?.ToString() ??
string.Empty;
88 if (!(this.quantityField is
null))
89 return this.quantityField.Unit;
102 if (this.statusString is
null)
104 StringBuilder Output =
null;
108 if (!this.field.QoS.HasFlag(
Value))
112 Output =
new StringBuilder();
118 case FieldQoS.Missing: Output.Append(
"Missing");
break;
119 case FieldQoS.InProgress: Output.Append(
"In Progress");
break;
120 case FieldQoS.AutomaticEstimate: Output.Append(
"Automatic Estimate");
break;
121 case FieldQoS.ManualEstimate: Output.Append(
"Manual Estimate");
break;
122 case FieldQoS.ManualReadout: Output.Append(
"Manual Readout");
break;
123 case FieldQoS.AutomaticReadout: Output.Append(
"Automatic Readout");
break;
124 case FieldQoS.TimeOffset: Output.Append(
"Time Offset");
break;
125 case FieldQoS.Warning: Output.Append(
"Warning");
break;
126 case FieldQoS.Error: Output.Append(
"Error");
break;
127 case FieldQoS.Signed: Output.Append(
"Signed");
break;
128 case FieldQoS.Invoiced: Output.Append(
"Invoiced");
break;
129 case FieldQoS.EndOfSeries: Output.Append(
"End of Series");
break;
130 case FieldQoS.PowerFailure: Output.Append(
"Power Failure");
break;
131 case FieldQoS.InvoiceConfirmed: Output.Append(
"Invoice Confirmed");
break;
132 default: Output.Append(
Value.ToString());
break;
136 this.statusString = Output.ToString();
139 return this.statusString;
143 private string statusString =
null;
152 if (this.typeString is
null)
154 StringBuilder Output =
null;
158 if (!this.field.Type.HasFlag(
Value))
162 Output =
new StringBuilder();
168 case FieldType.Momentary: Output.Append(
"Momentary");
break;
169 case FieldType.Identity: Output.Append(
"Identity");
break;
170 case FieldType.Status: Output.Append(
"Status");
break;
171 case FieldType.Computed: Output.Append(
"Computed");
break;
172 case FieldType.Peak: Output.Append(
"Peak");
break;
173 case FieldType.Historical: Output.Append(
"Historical");
break;
174 default: Output.Append(
Value.ToString());
break;
178 this.typeString = Output.ToString();
181 return this.typeString;
185 private string typeString =
null;
187 public string Alignment
Represents one item in a sensor data readout.
Field Field
Sensor data field.
string Timestamp
Timestamp of event.
FieldItem(Field Field)
Represents one item in a sensor data readout.
string FieldName
Field Name
Abstract base class for selectable colorable item.
Helps with parsing of commong data types.
static string Encode(bool x)
Encodes a Boolean for use in XML and other formats.
Represents a boolean value that can be either true or false.
Base class for all sensor data fields.
FieldQoS QoS
Field Quality of Service flags.
Represents a 32-bit integer value.
Represents a 64-bit integer value.
Represents a physical quantity value.
FieldQoS
Field Quality of Service flags
FieldType
Field Type flags