Adding SoundGraphDisplay and SensorFrontView classes.
They were respectively based on SystemTray and SensorNotifyIcon.
SoundGraphDisplay is now able to load iMONDisplay.dll providing it lives on your PATH.
Adding option to sensor context menu for adding it into FrontView.
3 This Source Code Form is subject to the terms of the Mozilla Public
4 License, v. 2.0. If a copy of the MPL was not distributed with this
5 file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 Copyright (C) 2010-2014 Michael Möller <mmoeller@openhardwaremonitor.org>
12 using System.Globalization;
14 namespace OpenHardwareMonitor.Hardware {
16 internal delegate void ControlEventHandler(Control control);
18 internal class Control : IControl {
20 private readonly Identifier identifier;
21 private readonly ISettings settings;
22 private ControlMode mode;
23 private float softwareValue;
24 private float minSoftwareValue;
25 private float maxSoftwareValue;
27 public Control(ISensor sensor, ISettings settings, float minSoftwareValue,
28 float maxSoftwareValue)
30 this.identifier = new Identifier(sensor.Identifier, "control");
31 this.settings = settings;
32 this.minSoftwareValue = minSoftwareValue;
33 this.maxSoftwareValue = maxSoftwareValue;
35 if (!float.TryParse(settings.GetValue(
36 new Identifier(identifier, "value").ToString(), "0"),
37 NumberStyles.Float, CultureInfo.InvariantCulture,
38 out this.softwareValue))
40 this.softwareValue = 0;
43 if (!int.TryParse(settings.GetValue(
44 new Identifier(identifier, "mode").ToString(),
45 ((int)ControlMode.Undefined).ToString(CultureInfo.InvariantCulture)),
46 NumberStyles.Integer, CultureInfo.InvariantCulture,
49 this.mode = ControlMode.Undefined;
51 this.mode = (ControlMode)mode;
55 public Identifier Identifier {
61 public ControlMode ControlMode {
68 if (ControlModeChanged != null)
69 ControlModeChanged(this);
70 this.settings.SetValue(new Identifier(identifier, "mode").ToString(),
71 ((int)mode).ToString(CultureInfo.InvariantCulture));
76 public float SoftwareValue {
81 if (softwareValue != value) {
82 softwareValue = value;
83 if (SoftwareControlValueChanged != null)
84 SoftwareControlValueChanged(this);
85 this.settings.SetValue(new Identifier(identifier,
87 value.ToString(CultureInfo.InvariantCulture));
92 public void SetDefault() {
93 ControlMode = ControlMode.Default;
96 public float MinSoftwareValue {
98 return minSoftwareValue;
102 public float MaxSoftwareValue {
104 return maxSoftwareValue;
108 public void SetSoftware(float value) {
109 ControlMode = ControlMode.Software;
110 SoftwareValue = value;
113 internal event ControlEventHandler ControlModeChanged;
114 internal event ControlEventHandler SoftwareControlValueChanged;