Added an Identifier class for IHardware, ISensor and IParameter Identifier properties.
This commit is contained in:
@@ -71,7 +71,8 @@ namespace OpenHardwareMonitor.GUI {
|
||||
if (sensor.SensorType == SensorType.Load) {
|
||||
defaultColor = Color.FromArgb(0xff, 0x70, 0x8c, 0xf1);
|
||||
}
|
||||
Color = Config.Get(sensor.Identifier + "/traycolor", defaultColor);
|
||||
Color = Config.Get(new Identifier(sensor.Identifier,
|
||||
"traycolor").ToString(), defaultColor);
|
||||
|
||||
this.pen = new Pen(Color.FromArgb(96, Color.Black));
|
||||
this.font = new Font(SystemFonts.MessageBoxFont.FontFamily, 9);
|
||||
@@ -88,7 +89,8 @@ namespace OpenHardwareMonitor.GUI {
|
||||
dialog.Color = Color;
|
||||
if (dialog.ShowDialog() == DialogResult.OK) {
|
||||
Color = dialog.Color;
|
||||
Config.Set(sensor.Identifier + "/traycolor", Color);
|
||||
Config.Set(new Identifier(sensor.Identifier,
|
||||
"traycolor").ToString(), Color);
|
||||
}
|
||||
};
|
||||
contextMenuStrip.Items.Add(colorItem);
|
||||
|
||||
@@ -73,7 +73,8 @@ namespace OpenHardwareMonitor.GUI {
|
||||
}
|
||||
|
||||
private void SensorAdded(ISensor sensor) {
|
||||
if (Config.Get(sensor.Identifier + "/tray", false))
|
||||
if (Config.Get(new Identifier(sensor.Identifier,
|
||||
"tray").ToString(), false))
|
||||
Add(sensor, false);
|
||||
}
|
||||
|
||||
@@ -104,7 +105,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
return;
|
||||
} else {
|
||||
list.Add(new SensorNotifyIcon(this, sensor, balloonTip));
|
||||
Config.Set(sensor.Identifier + "/tray", true);
|
||||
Config.Set(new Identifier(sensor.Identifier, "tray").ToString(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,8 +115,10 @@ namespace OpenHardwareMonitor.GUI {
|
||||
|
||||
private void Remove(ISensor sensor, bool deleteConfig) {
|
||||
if (deleteConfig) {
|
||||
Config.Remove(sensor.Identifier + "/tray");
|
||||
Config.Remove(sensor.Identifier + "/traycolor");
|
||||
Config.Remove(
|
||||
new Identifier(sensor.Identifier, "tray").ToString());
|
||||
Config.Remove(
|
||||
new Identifier(sensor.Identifier, "traycolor").ToString());
|
||||
}
|
||||
SensorNotifyIcon instance = null;
|
||||
foreach (SensorNotifyIcon icon in list)
|
||||
|
||||
Reference in New Issue
Block a user