GUI/SensorNotifyIcon.cs
changeset 282 a2793a38aac0
parent 252 e62afa69214f
child 317 1ccf99e620a9
     1.1 --- a/GUI/SensorNotifyIcon.cs	Sun May 15 15:37:50 2011 +0000
     1.2 +++ b/GUI/SensorNotifyIcon.cs	Sun May 15 16:00:22 2011 +0000
     1.3 @@ -176,6 +176,9 @@
     1.4      }
     1.5  
     1.6      private string GetString() {
     1.7 +      if (!sensor.Value.HasValue)
     1.8 +        return "-";
     1.9 +
    1.10        switch (sensor.SensorType) {
    1.11          case SensorType.Voltage:
    1.12            return string.Format("{0:F11}", sensor.Value);
    1.13 @@ -237,7 +240,8 @@
    1.14          graphics.Clear(Color.Black);
    1.15        }
    1.16        graphics.FillRectangle(darkBrush, 0.5f, -0.5f, bitmap.Width - 2, bitmap.Height);
    1.17 -      float y = 0.16f * (100 - sensor.Value.Value);
    1.18 +      float value = sensor.Value.GetValueOrDefault();
    1.19 +      float y = 0.16f * (100 - value);
    1.20        graphics.FillRectangle(brush, 0.5f, -0.5f + y, bitmap.Width - 2, bitmap.Height - y);
    1.21        graphics.DrawRectangle(pen, 1, 0, bitmap.Width - 3, bitmap.Height - 1);
    1.22