GUI/SystemTray.cs
changeset 165 813d8bc3192f
parent 156 3e2ab626531c
child 166 fa9dfbfc4145
     1.1 --- a/GUI/SystemTray.cs	Thu Aug 05 19:28:50 2010 +0000
     1.2 +++ b/GUI/SystemTray.cs	Sun Aug 08 13:57:26 2010 +0000
     1.3 @@ -46,12 +46,14 @@
     1.4  namespace OpenHardwareMonitor.GUI {
     1.5    public class SystemTray : IDisposable {
     1.6      private IComputer computer;
     1.7 +    private PersistentSettings settings;
     1.8      private List<SensorNotifyIcon> list = new List<SensorNotifyIcon>();
     1.9      private bool mainIconEnabled = false;
    1.10      private NotifyIcon mainIcon;
    1.11  
    1.12 -    public SystemTray(IComputer computer) {
    1.13 +    public SystemTray(IComputer computer, PersistentSettings settings) {
    1.14        this.computer = computer;
    1.15 +      this.settings = settings;
    1.16        computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
    1.17        computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
    1.18  
    1.19 @@ -95,7 +97,7 @@
    1.20      }
    1.21  
    1.22      private void SensorAdded(ISensor sensor) {
    1.23 -      if (Config.Get(new Identifier(sensor.Identifier, 
    1.24 +      if (settings.Get(new Identifier(sensor.Identifier, 
    1.25          "tray").ToString(), false)) 
    1.26          Add(sensor, false);   
    1.27      }
    1.28 @@ -127,9 +129,9 @@
    1.29        if (Contains(sensor)) {
    1.30          return;
    1.31        } else {        
    1.32 -        list.Add(new SensorNotifyIcon(this, sensor, balloonTip));
    1.33 +        list.Add(new SensorNotifyIcon(this, sensor, balloonTip, settings));
    1.34          UpdateMainIconVisibilty();
    1.35 -        Config.Set(new Identifier(sensor.Identifier, "tray").ToString(), true);
    1.36 +        settings.Set(new Identifier(sensor.Identifier, "tray").ToString(), true);
    1.37        }
    1.38      }
    1.39  
    1.40 @@ -139,9 +141,9 @@
    1.41  
    1.42      private void Remove(ISensor sensor, bool deleteConfig) {
    1.43        if (deleteConfig) {
    1.44 -        Config.Remove(
    1.45 +        settings.Remove(
    1.46            new Identifier(sensor.Identifier, "tray").ToString());
    1.47 -        Config.Remove(
    1.48 +        settings.Remove(
    1.49            new Identifier(sensor.Identifier, "traycolor").ToString());
    1.50        }
    1.51        SensorNotifyIcon instance = null;