Added a new sensor type "Level" for wear or charge level (or any other percentage based sensors that don't fit into Load or Control).
1.1 --- a/GUI/HardwareNode.cs Wed Oct 06 19:50:10 2010 +0000
1.2 +++ b/GUI/HardwareNode.cs Thu Oct 07 19:34:36 2010 +0000
1.3 @@ -64,6 +64,7 @@
1.4 typeNodes.Add(new TypeNode(SensorType.Fan));
1.5 typeNodes.Add(new TypeNode(SensorType.Flow));
1.6 typeNodes.Add(new TypeNode(SensorType.Control));
1.7 + typeNodes.Add(new TypeNode(SensorType.Level));
1.8
1.9 foreach (ISensor sensor in hardware.Sensors)
1.10 SensorAdded(sensor);
2.1 --- a/GUI/SensorGadget.cs Wed Oct 06 19:50:10 2010 +0000
2.2 +++ b/GUI/SensorGadget.cs Thu Oct 07 19:34:36 2010 +0000
2.3 @@ -429,7 +429,8 @@
2.4
2.5
2.6 if ((sensor.SensorType != SensorType.Load &&
2.7 - sensor.SensorType != SensorType.Control) || !sensor.Value.HasValue)
2.8 + sensor.SensorType != SensorType.Control &&
2.9 + sensor.SensorType != SensorType.Level) || !sensor.Value.HasValue)
2.10 {
2.11 string formatted;
2.12
3.1 --- a/GUI/SensorNode.cs Wed Oct 06 19:50:10 2010 +0000
3.2 +++ b/GUI/SensorNode.cs Thu Oct 07 19:34:36 2010 +0000
3.3 @@ -74,6 +74,7 @@
3.4 case SensorType.Fan: format = "{0:F0} RPM"; break;
3.5 case SensorType.Flow: format = "{0:F0} L/h"; break;
3.6 case SensorType.Control: format = "{0:F1} %"; break;
3.7 + case SensorType.Level: format = "{0:F1} %"; break;
3.8 }
3.9
3.10 bool hidden = settings.GetValue(new Identifier(sensor.Identifier,
4.1 --- a/GUI/SensorNotifyIcon.cs Wed Oct 06 19:50:10 2010 +0000
4.2 +++ b/GUI/SensorNotifyIcon.cs Thu Oct 07 19:34:36 2010 +0000
4.3 @@ -66,7 +66,10 @@
4.4 this.notifyIcon = new NotifyIcon();
4.5
4.6 Color defaultColor = Color.Black;
4.7 - if (sensor.SensorType == SensorType.Load) {
4.8 + if (sensor.SensorType == SensorType.Load ||
4.9 + sensor.SensorType == SensorType.Control ||
4.10 + sensor.SensorType == SensorType.Level)
4.11 + {
4.12 defaultColor = Color.FromArgb(0xff, 0x70, 0x8c, 0xf1);
4.13 }
4.14 Color = settings.GetValue(new Identifier(sensor.Identifier,
4.15 @@ -173,6 +176,8 @@
4.16 return string.Format("{0:F11}", 1e-3f * sensor.Value);
4.17 case SensorType.Control:
4.18 return string.Format("{0:F0}", sensor.Value);
4.19 + case SensorType.Level:
4.20 + return string.Format("{0:F0}", sensor.Value);
4.21 }
4.22 return "-";
4.23 }
4.24 @@ -209,7 +214,7 @@
4.25 return IconFactory.Create(bytes, 16, 16, PixelFormat.Format32bppArgb);
4.26 }
4.27
4.28 - private Icon CreateLoadIcon() {
4.29 + private Icon CreatePercentageIcon() {
4.30 try {
4.31 graphics.Clear(Color.Transparent);
4.32 } catch (ArgumentException) {
4.33 @@ -233,11 +238,17 @@
4.34 public void Update() {
4.35 Icon icon = notifyIcon.Icon;
4.36
4.37 - if (sensor.SensorType == SensorType.Load) {
4.38 - notifyIcon.Icon = CreateLoadIcon();
4.39 - } else {
4.40 - notifyIcon.Icon = CreateTransparentIcon();
4.41 + switch (sensor.SensorType) {
4.42 + case SensorType.Load:
4.43 + case SensorType.Control:
4.44 + case SensorType.Level:
4.45 + notifyIcon.Icon = CreatePercentageIcon();
4.46 + break;
4.47 + default:
4.48 + notifyIcon.Icon = CreateTransparentIcon();
4.49 + break;
4.50 }
4.51 +
4.52 if (icon != null)
4.53 icon.Dispose();
4.54
4.55 @@ -250,6 +261,7 @@
4.56 case SensorType.Fan: format = "\n{0}: {1:F0} RPM"; break;
4.57 case SensorType.Flow: format = "\n{0}: {1:F0} L/h"; break;
4.58 case SensorType.Control: format = "\n{0}: {1:F1} %"; break;
4.59 + case SensorType.Level: format = "\n{0}: {1:F1} %"; break;
4.60 }
4.61 string formattedValue = string.Format(format, sensor.Name, sensor.Value);
4.62 string hardwareName = sensor.Hardware.Name;
5.1 --- a/GUI/TypeNode.cs Wed Oct 06 19:50:10 2010 +0000
5.2 +++ b/GUI/TypeNode.cs Thu Oct 07 19:34:36 2010 +0000
5.3 @@ -76,6 +76,10 @@
5.4 this.Image = Utilities.EmbeddedResources.GetImage("control.png");
5.5 this.Text = "Controls";
5.6 break;
5.7 + case SensorType.Level:
5.8 + this.Image = Utilities.EmbeddedResources.GetImage("level.png");
5.9 + this.Text = "Levels";
5.10 + break;
5.11 }
5.12
5.13 NodeAdded += new NodeEventHandler(TypeNode_NodeAdded);
6.1 --- a/Hardware/ISensor.cs Wed Oct 06 19:50:10 2010 +0000
6.2 +++ b/Hardware/ISensor.cs Thu Oct 07 19:34:36 2010 +0000
6.3 @@ -48,7 +48,8 @@
6.4 Load,
6.5 Fan,
6.6 Flow,
6.7 - Control
6.8 + Control,
6.9 + Level
6.10 }
6.11
6.12 public struct SensorValue {
7.1 --- a/OpenHardwareMonitor.csproj Wed Oct 06 19:50:10 2010 +0000
7.2 +++ b/OpenHardwareMonitor.csproj Thu Oct 07 19:34:36 2010 +0000
7.3 @@ -205,6 +205,9 @@
7.4 <EmbeddedResource Include="Resources\barblue.png" />
7.5 <EmbeddedResource Include="Resources\gadget.png" />
7.6 </ItemGroup>
7.7 + <ItemGroup>
7.8 + <EmbeddedResource Include="Resources\level.png" />
7.9 + </ItemGroup>
7.10 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
7.11 <ProjectExtensions>
7.12 <VisualStudio AllowExistingFolder="true" />
8.1 Binary file Resources/level.png has changed