Add Humidity Sensors support (#1281)
* Add Humidity Sensors support Signed-off-by: wlkmanist <vlad.king5555@mail.ru> * Humidity icon Signed-off-by: wlkmanist <vlad.king5555@mail.ru> * fix humidity icon Signed-off-by: wlkmanist <vlad.king5555@mail.ru> --------- Signed-off-by: wlkmanist <vlad.king5555@mail.ru>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 853 B |
@@ -200,7 +200,8 @@ public class PlotPanel : UserControl
|
||||
{ SensorType.Data, "GB" },
|
||||
{ SensorType.Frequency, "Hz" },
|
||||
{ SensorType.Energy, "mWh" },
|
||||
{ SensorType.Noise, "dBA" }
|
||||
{ SensorType.Noise, "dBA" },
|
||||
{ SensorType.Humidity, "%" }
|
||||
};
|
||||
|
||||
foreach (SensorType type in Enum.GetValues(typeof(SensorType)))
|
||||
@@ -415,4 +416,4 @@ public class PlotPanel : UserControl
|
||||
foreach (LinearAxis axis in _axes.Values)
|
||||
axis.Zoom(double.NaN, double.NaN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -598,7 +598,8 @@ public class SensorGadget : Gadget
|
||||
|
||||
if ((sensor.SensorType != SensorType.Load &&
|
||||
sensor.SensorType != SensorType.Control &&
|
||||
sensor.SensorType != SensorType.Level) || !sensor.Value.HasValue)
|
||||
sensor.SensorType != SensorType.Level &&
|
||||
sensor.SensorType != SensorType.Humidity) || !sensor.Value.HasValue)
|
||||
{
|
||||
string formatted;
|
||||
|
||||
@@ -751,4 +752,4 @@ public class SensorGadget : Gadget
|
||||
return x.Identifier.CompareTo(y.Identifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,9 @@ public class SensorNode : Node
|
||||
case SensorType.Noise:
|
||||
Format = "{0:F0} dBA";
|
||||
break;
|
||||
case SensorType.Humidity:
|
||||
Format = "{0:F0} %";
|
||||
break;
|
||||
}
|
||||
|
||||
bool hidden = settings.GetValue(new Identifier(sensor.Identifier, "hidden").ToString(), sensor.IsDefaultHidden);
|
||||
@@ -276,4 +279,4 @@ public class SensorNode : Node
|
||||
{
|
||||
return Sensor.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,6 +183,7 @@ public class SensorNotifyIcon : IDisposable
|
||||
case SensorType.Load:
|
||||
case SensorType.Energy:
|
||||
case SensorType.Noise:
|
||||
case SensorType.Humidity:
|
||||
return $"{Sensor.Value:F0}";
|
||||
default:
|
||||
return "-";
|
||||
@@ -259,6 +260,7 @@ public class SensorNotifyIcon : IDisposable
|
||||
case SensorType.Factor: format = "\n{0}: {1:F3} GB"; break;
|
||||
case SensorType.Energy: format = "\n{0}: {0:F0} mWh"; break;
|
||||
case SensorType.Noise: format = "\n{0}: {0:F0} dBA"; break;
|
||||
case SensorType.Humidity: format = "\n{0}: {0:F0} %"; break;
|
||||
}
|
||||
string formattedValue = string.Format(format, Sensor.Name, Sensor.Value);
|
||||
|
||||
@@ -277,4 +279,4 @@ public class SensorNotifyIcon : IDisposable
|
||||
_notifyIcon.Text = text;
|
||||
_notifyIcon.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +95,10 @@ public sealed class TypeNode : Node, IExpandPersistNode
|
||||
Image = Utilities.EmbeddedResources.GetImage("loudspeaker.png");
|
||||
Text = "Noise Levels";
|
||||
break;
|
||||
case SensorType.Humidity:
|
||||
Image = Utilities.EmbeddedResources.GetImage("humidity.png");
|
||||
Text = "Humidity Levels";
|
||||
break;
|
||||
}
|
||||
|
||||
NodeAdded += TypeNode_NodeAdded;
|
||||
@@ -138,4 +142,4 @@ public sealed class TypeNode : Node, IExpandPersistNode
|
||||
_settings.SetValue(_expandedIdentifier, _expanded);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -679,6 +679,8 @@ public class HttpServer
|
||||
return "loudspeaker.png";
|
||||
case SensorType.Throughput:
|
||||
return "throughput.png";
|
||||
case SensorType.Humidity:
|
||||
return "flow.png";
|
||||
default:
|
||||
return "power.png";
|
||||
}
|
||||
@@ -703,4 +705,4 @@ public class HttpServer
|
||||
StopHttpListener();
|
||||
_listener.Abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user