Fixed Issue 65.
authormoel.mich
Sat, 05 Jun 2010 18:59:54 +0000
changeset 1339ad699538c89
parent 132 680ed54e05ca
child 134 8b3b9b2e28e5
Fixed Issue 65.
GUI/MainForm.Designer.cs
GUI/MainForm.cs
GUI/MainForm.resx
GUI/SensorNotifyIcon.cs
GUI/SensorSystemTray.cs
GUI/SystemTray.cs
Hardware/Mainboard/Mainboard.cs
Hardware/Mainboard/Model.cs
Hardware/Mainboard/SMBIOS.cs
Hardware/Mainboard/SuperIOHardware.cs
OpenHardwareMonitor.csproj
     1.1 --- a/GUI/MainForm.Designer.cs	Sat Jun 05 11:15:16 2010 +0000
     1.2 +++ b/GUI/MainForm.Designer.cs	Sat Jun 05 18:59:54 2010 +0000
     1.3 @@ -102,10 +102,6 @@
     1.4        this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     1.5        this.splitContainer = new System.Windows.Forms.SplitContainer();
     1.6        this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
     1.7 -      this.notifyContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
     1.8 -      this.hideShowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     1.9 -      this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
    1.10 -      this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
    1.11        this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
    1.12        this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
    1.13        this.timer = new System.Windows.Forms.Timer(this.components);
    1.14 @@ -113,7 +109,6 @@
    1.15        this.splitContainer.Panel1.SuspendLayout();
    1.16        this.splitContainer.Panel2.SuspendLayout();
    1.17        this.splitContainer.SuspendLayout();
    1.18 -      this.notifyContextMenuStrip.SuspendLayout();
    1.19        this.SuspendLayout();
    1.20        // 
    1.21        // treeView
    1.22 @@ -269,7 +264,7 @@
    1.23        this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
    1.24        this.exitToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
    1.25        this.exitToolStripMenuItem.Text = "Exit";
    1.26 -      this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
    1.27 +      this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitClick);
    1.28        // 
    1.29        // viewToolStripMenuItem
    1.30        // 
    1.31 @@ -393,9 +388,9 @@
    1.32        this.startupMenuItem.Text = "Run On Windows Startup";
    1.33        this.startupMenuItem.CheckedChanged += new System.EventHandler(this.runOnWindowsStartupToolStripMenuItem_CheckedChanged);
    1.34        // 
    1.35 -      // toolStripMenuItem3
    1.36 +      // separatorMenuItem
    1.37        // 
    1.38 -      this.separatorMenuItem.Name = "toolStripMenuItem3";
    1.39 +      this.separatorMenuItem.Name = "separatorMenuItem";
    1.40        this.separatorMenuItem.Size = new System.Drawing.Size(204, 6);
    1.41        // 
    1.42        // temperatureUnitsToolStripMenuItem
    1.43 @@ -410,14 +405,14 @@
    1.44        // celciusToolStripMenuItem
    1.45        // 
    1.46        this.celciusToolStripMenuItem.Name = "celciusToolStripMenuItem";
    1.47 -      this.celciusToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
    1.48 +      this.celciusToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
    1.49        this.celciusToolStripMenuItem.Text = "Celcius";
    1.50        this.celciusToolStripMenuItem.Click += new System.EventHandler(this.celciusToolStripMenuItem_Click);
    1.51        // 
    1.52        // fahrenheitToolStripMenuItem
    1.53        // 
    1.54        this.fahrenheitToolStripMenuItem.Name = "fahrenheitToolStripMenuItem";
    1.55 -      this.fahrenheitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
    1.56 +      this.fahrenheitToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
    1.57        this.fahrenheitToolStripMenuItem.Text = "Fahrenheit";
    1.58        this.fahrenheitToolStripMenuItem.Click += new System.EventHandler(this.fahrenheitToolStripMenuItem_Click);
    1.59        // 
    1.60 @@ -478,38 +473,10 @@
    1.61        this.plotPanel.Size = new System.Drawing.Size(410, 171);
    1.62        this.plotPanel.TabIndex = 0;
    1.63        // 
    1.64 -      // notifyContextMenuStrip
    1.65 -      // 
    1.66 -      this.notifyContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
    1.67 -            this.hideShowToolStripMenuItem,
    1.68 -            this.toolStripMenuItem2,
    1.69 -            this.exitToolStripMenuItem1});
    1.70 -      this.notifyContextMenuStrip.Name = "notifyContextMenuStrip";
    1.71 -      this.notifyContextMenuStrip.Size = new System.Drawing.Size(134, 54);
    1.72 -      // 
    1.73 -      // hideShowToolStripMenuItem
    1.74 -      // 
    1.75 -      this.hideShowToolStripMenuItem.Name = "hideShowToolStripMenuItem";
    1.76 -      this.hideShowToolStripMenuItem.Size = new System.Drawing.Size(133, 22);
    1.77 -      this.hideShowToolStripMenuItem.Text = "Hide/Show";
    1.78 -      this.hideShowToolStripMenuItem.Click += new System.EventHandler(this.hideShowClick);
    1.79 -      // 
    1.80 -      // toolStripMenuItem2
    1.81 -      // 
    1.82 -      this.toolStripMenuItem2.Name = "toolStripMenuItem2";
    1.83 -      this.toolStripMenuItem2.Size = new System.Drawing.Size(130, 6);
    1.84 -      // 
    1.85 -      // exitToolStripMenuItem1
    1.86 -      // 
    1.87 -      this.exitToolStripMenuItem1.Name = "exitToolStripMenuItem1";
    1.88 -      this.exitToolStripMenuItem1.Size = new System.Drawing.Size(133, 22);
    1.89 -      this.exitToolStripMenuItem1.Text = "Exit";
    1.90 -      this.exitToolStripMenuItem1.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
    1.91 -      // 
    1.92        // sensorContextMenuStrip
    1.93        // 
    1.94        this.sensorContextMenuStrip.Name = "sensorContextMenuStrip";
    1.95 -      this.sensorContextMenuStrip.Size = new System.Drawing.Size(61, 4);
    1.96 +      this.sensorContextMenuStrip.Size = new System.Drawing.Size(153, 26);
    1.97        // 
    1.98        // saveFileDialog
    1.99        // 
   1.100 @@ -542,7 +509,6 @@
   1.101        this.splitContainer.Panel1.ResumeLayout(false);
   1.102        this.splitContainer.Panel2.ResumeLayout(false);
   1.103        this.splitContainer.ResumeLayout(false);
   1.104 -      this.notifyContextMenuStrip.ResumeLayout(false);
   1.105        this.ResumeLayout(false);
   1.106        this.PerformLayout();
   1.107  
   1.108 @@ -575,10 +541,6 @@
   1.109      private System.Windows.Forms.ToolStripMenuItem saveReportToolStripMenuItem;
   1.110      private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
   1.111      private System.Windows.Forms.ToolStripMenuItem hddMenuItem;
   1.112 -    private System.Windows.Forms.ContextMenuStrip notifyContextMenuStrip;
   1.113 -    private System.Windows.Forms.ToolStripMenuItem hideShowToolStripMenuItem;
   1.114 -    private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
   1.115 -    private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1;
   1.116      private System.Windows.Forms.ToolStripMenuItem minTrayMenuItem;
   1.117      private System.Windows.Forms.ToolStripSeparator separatorMenuItem;
   1.118      private System.Windows.Forms.ContextMenuStrip sensorContextMenuStrip;
     2.1 --- a/GUI/MainForm.cs	Sat Jun 05 11:15:16 2010 +0000
     2.2 +++ b/GUI/MainForm.cs	Sat Jun 05 18:59:54 2010 +0000
     2.3 @@ -57,8 +57,7 @@
     2.4      private IDictionary<ISensor, Color> sensorPlotColors = 
     2.5        new Dictionary<ISensor, Color>();
     2.6      private Color[] plotColorPalette;
     2.7 -    private SensorSystemTray sensorSystemTray;
     2.8 -    private NotifyIcon notifyIcon;
     2.9 +    private SystemTray systemTray;    
    2.10      private StartupManager startupManager = new StartupManager();
    2.11      private UpdateVisitor updateVisitor = new UpdateVisitor();
    2.12  
    2.13 @@ -68,21 +67,13 @@
    2.14        treeView.Font = SystemFonts.MessageBoxFont;
    2.15        plotPanel.Font = SystemFonts.MessageBoxFont;
    2.16        
    2.17 -      nodeCheckBox.IsVisibleValueNeeded += 
    2.18 -        new EventHandler<NodeControlValueEventArgs>(
    2.19 -          nodeCheckBox_IsVisibleValueNeeded);
    2.20 -      nodeCheckBox.CheckStateChanged += 
    2.21 -        new EventHandler<TreePathEventArgs>(UpdatePlotSelection);
    2.22 -      nodeTextBoxText.DrawText += 
    2.23 -        new EventHandler<DrawEventArgs>(nodeTextBoxText_DrawText);
    2.24 -      nodeTextBoxValue.DrawText +=
    2.25 -        new EventHandler<DrawEventArgs>(nodeTextBoxText_DrawText);
    2.26 -      nodeTextBoxMin.DrawText +=
    2.27 -        new EventHandler<DrawEventArgs>(nodeTextBoxText_DrawText);
    2.28 -      nodeTextBoxMax.DrawText +=
    2.29 -        new EventHandler<DrawEventArgs>(nodeTextBoxText_DrawText);
    2.30 -      nodeTextBoxLimit.DrawText += 
    2.31 -        new EventHandler<DrawEventArgs>(nodeTextBoxLimit_DrawText);
    2.32 +      nodeCheckBox.IsVisibleValueNeeded += nodeCheckBox_IsVisibleValueNeeded;
    2.33 +      nodeCheckBox.CheckStateChanged += UpdatePlotSelection;
    2.34 +      nodeTextBoxText.DrawText += nodeTextBoxText_DrawText;
    2.35 +      nodeTextBoxValue.DrawText += nodeTextBoxText_DrawText;
    2.36 +      nodeTextBoxMin.DrawText += nodeTextBoxText_DrawText;
    2.37 +      nodeTextBoxMax.DrawText += nodeTextBoxText_DrawText;
    2.38 +      nodeTextBoxLimit.DrawText += nodeTextBoxLimit_DrawText;
    2.39  
    2.40        if (Utilities.Config.Contains("mainForm.Location.X")) {
    2.41          int x = Utilities.Config.Get("mainForm.Location.X", Location.X);
    2.42 @@ -107,15 +98,11 @@
    2.43        root.Image = Utilities.EmbeddedResources.GetImage("computer.png");
    2.44        
    2.45        treeModel.Nodes.Add(root);
    2.46 -      treeView.Model = treeModel;
    2.47 -      
    2.48 -      notifyIcon = new NotifyIcon();
    2.49 -      notifyIcon.ContextMenuStrip = this.notifyContextMenuStrip;
    2.50 -      notifyIcon.Icon = EmbeddedResources.GetIcon("smallicon.ico");
    2.51 -      notifyIcon.Text = "Open Hardware Monitor";      
    2.52 -      notifyIcon.DoubleClick += new EventHandler(this.hideShowClick);
    2.53 +      treeView.Model = treeModel;     
    2.54  
    2.55 -      sensorSystemTray = new SensorSystemTray(computer);
    2.56 +      systemTray = new SystemTray(computer);
    2.57 +      systemTray.HideShowCommand += hideShowClick;
    2.58 +      systemTray.ExitCommand += exitClick;
    2.59  
    2.60        computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
    2.61        computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
    2.62 @@ -257,7 +244,7 @@
    2.63          plotMenuItem.Checked;
    2.64      }
    2.65  
    2.66 -    private void exitToolStripMenuItem_Click(object sender, EventArgs e) {
    2.67 +    private void exitClick(object sender, EventArgs e) {
    2.68        Close();      
    2.69      }
    2.70  
    2.71 @@ -265,7 +252,7 @@
    2.72        computer.Accept(updateVisitor);
    2.73        treeView.Invalidate();
    2.74        plotPanel.Invalidate();
    2.75 -      sensorSystemTray.Redraw();
    2.76 +      systemTray.Redraw();
    2.77      }
    2.78  
    2.79      private void SaveConfiguration() {
    2.80 @@ -299,8 +286,7 @@
    2.81        SaveConfiguration();
    2.82  
    2.83        timer.Enabled = false;
    2.84 -      sensorSystemTray.Dispose();
    2.85 -      notifyIcon.Dispose();
    2.86 +      systemTray.Dispose();      
    2.87        computer.Close();
    2.88      }
    2.89  
    2.90 @@ -347,16 +333,16 @@
    2.91              };
    2.92              sensorContextMenuStrip.Items.Add(item);
    2.93            }         
    2.94 -          if (sensorSystemTray.Contains(node.Sensor)) {
    2.95 +          if (systemTray.Contains(node.Sensor)) {
    2.96              ToolStripMenuItem item = new ToolStripMenuItem("Remove From Tray");
    2.97              item.Click += delegate(object obj, EventArgs args) {
    2.98 -              sensorSystemTray.Remove(node.Sensor);
    2.99 +              systemTray.Remove(node.Sensor);
   2.100              };
   2.101              sensorContextMenuStrip.Items.Add(item);
   2.102            } else {
   2.103              ToolStripMenuItem item = new ToolStripMenuItem("Add To Tray");
   2.104              item.Click += delegate(object obj, EventArgs args) {
   2.105 -              sensorSystemTray.Add(node.Sensor, true);
   2.106 +              systemTray.Add(node.Sensor, true);
   2.107              };
   2.108              sensorContextMenuStrip.Items.Add(item);
   2.109            }
   2.110 @@ -411,7 +397,7 @@
   2.111        if (sensor == null)
   2.112          return;
   2.113  
   2.114 -      sensorSystemTray.Remove(sensor);
   2.115 +      systemTray.Remove(sensor);
   2.116      }
   2.117  
   2.118      private void ShowParameterForm(ISensor sensor) {
   2.119 @@ -437,7 +423,7 @@
   2.120      }
   2.121  
   2.122      private void minTrayMenuItem_CheckedChanged(object sender, EventArgs e) {
   2.123 -      notifyIcon.Visible = minTrayMenuItem.Checked;
   2.124 +      systemTray.IsMainIconEnabled = minTrayMenuItem.Checked;
   2.125      }
   2.126  
   2.127      private void hiddenSensorsMenuItem_CheckedChanged(object sender, 
     3.1 --- a/GUI/MainForm.resx	Sat Jun 05 11:15:16 2010 +0000
     3.2 +++ b/GUI/MainForm.resx	Sat Jun 05 18:59:54 2010 +0000
     3.3 @@ -120,17 +120,14 @@
     3.4    <metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     3.5      <value>17, 17</value>
     3.6    </metadata>
     3.7 -  <metadata name="notifyContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     3.8 +  <metadata name="sensorContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     3.9      <value>125, 17</value>
    3.10    </metadata>
    3.11 -  <metadata name="sensorContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    3.12 -    <value>307, 17</value>
    3.13 -  </metadata>
    3.14    <metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    3.15 -    <value>493, 17</value>
    3.16 +    <value>311, 17</value>
    3.17    </metadata>
    3.18    <metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    3.19 -    <value>622, 17</value>
    3.20 +    <value>440, 17</value>
    3.21    </metadata>
    3.22    <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    3.23      <value>55</value>
     4.1 --- a/GUI/SensorNotifyIcon.cs	Sat Jun 05 11:15:16 2010 +0000
     4.2 +++ b/GUI/SensorNotifyIcon.cs	Sat Jun 05 18:59:54 2010 +0000
     4.3 @@ -61,7 +61,7 @@
     4.4      private Pen pen;
     4.5      private Font font;
     4.6  
     4.7 -    public SensorNotifyIcon(SensorSystemTray sensorSystemTray, ISensor sensor,
     4.8 +    public SensorNotifyIcon(SystemTray sensorSystemTray, ISensor sensor,
     4.9        bool balloonTip) 
    4.10      {
    4.11        this.sensor = sensor;
    4.12 @@ -78,7 +78,13 @@
    4.13        this.font = SystemFonts.MessageBoxFont;
    4.14  
    4.15        ContextMenuStrip contextMenuStrip = new ContextMenuStrip();
    4.16 -      ToolStripMenuItem removeItem = new ToolStripMenuItem("Remove");
    4.17 +      ToolStripMenuItem hideShowItem = new ToolStripMenuItem("Hide/Show");
    4.18 +      hideShowItem.Click += delegate(object obj, EventArgs args) {
    4.19 +        sensorSystemTray.SendHideShowCommand();
    4.20 +      };
    4.21 +      contextMenuStrip.Items.Add(hideShowItem);
    4.22 +      contextMenuStrip.Items.Add(new ToolStripSeparator());
    4.23 +      ToolStripMenuItem removeItem = new ToolStripMenuItem("Remove Sensor");
    4.24        removeItem.Click += delegate(object obj, EventArgs args) {
    4.25          sensorSystemTray.Remove(this.sensor);
    4.26        };
    4.27 @@ -94,7 +100,16 @@
    4.28          }
    4.29        };
    4.30        contextMenuStrip.Items.Add(colorItem);
    4.31 +      contextMenuStrip.Items.Add(new ToolStripSeparator());
    4.32 +      ToolStripMenuItem exitItem = new ToolStripMenuItem("Exit");
    4.33 +      exitItem.Click += delegate(object obj, EventArgs args) {
    4.34 +        sensorSystemTray.SendExitCommand();
    4.35 +      };
    4.36 +      contextMenuStrip.Items.Add(exitItem);
    4.37        this.notifyIcon.ContextMenuStrip = contextMenuStrip;
    4.38 +      this.notifyIcon.DoubleClick += delegate(object obj, EventArgs args) {
    4.39 +        sensorSystemTray.SendHideShowCommand();
    4.40 +      };
    4.41  
    4.42        this.bitmap = new Bitmap(16, 16, PixelFormat.Format32bppArgb);
    4.43        this.graphics = Graphics.FromImage(this.bitmap);
     5.1 --- a/GUI/SensorSystemTray.cs	Sat Jun 05 11:15:16 2010 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,134 +0,0 @@
     5.4 -/*
     5.5 -  
     5.6 -  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     5.7 -
     5.8 -  The contents of this file are subject to the Mozilla Public License Version
     5.9 -  1.1 (the "License"); you may not use this file except in compliance with
    5.10 -  the License. You may obtain a copy of the License at
    5.11 - 
    5.12 -  http://www.mozilla.org/MPL/
    5.13 -
    5.14 -  Software distributed under the License is distributed on an "AS IS" basis,
    5.15 -  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    5.16 -  for the specific language governing rights and limitations under the License.
    5.17 -
    5.18 -  The Original Code is the Open Hardware Monitor code.
    5.19 -
    5.20 -  The Initial Developer of the Original Code is 
    5.21 -  Michael Möller <m.moeller@gmx.ch>.
    5.22 -  Portions created by the Initial Developer are Copyright (C) 2009-2010
    5.23 -  the Initial Developer. All Rights Reserved.
    5.24 -
    5.25 -  Contributor(s):
    5.26 -
    5.27 -  Alternatively, the contents of this file may be used under the terms of
    5.28 -  either the GNU General Public License Version 2 or later (the "GPL"), or
    5.29 -  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    5.30 -  in which case the provisions of the GPL or the LGPL are applicable instead
    5.31 -  of those above. If you wish to allow use of your version of this file only
    5.32 -  under the terms of either the GPL or the LGPL, and not to allow others to
    5.33 -  use your version of this file under the terms of the MPL, indicate your
    5.34 -  decision by deleting the provisions above and replace them with the notice
    5.35 -  and other provisions required by the GPL or the LGPL. If you do not delete
    5.36 -  the provisions above, a recipient may use your version of this file under
    5.37 -  the terms of any one of the MPL, the GPL or the LGPL.
    5.38 - 
    5.39 -*/
    5.40 -
    5.41 -using System;
    5.42 -using System.Collections.Generic;
    5.43 -using System.Drawing;
    5.44 -using System.Text;
    5.45 -using System.Windows.Forms;
    5.46 -using OpenHardwareMonitor.Hardware;
    5.47 -using OpenHardwareMonitor.Utilities;
    5.48 -
    5.49 -namespace OpenHardwareMonitor.GUI {
    5.50 -  public class SensorSystemTray : IDisposable {
    5.51 -    private IComputer computer;
    5.52 -    private List<SensorNotifyIcon> list = new List<SensorNotifyIcon>();
    5.53 -
    5.54 -    public SensorSystemTray(IComputer computer) {
    5.55 -      this.computer = computer;
    5.56 -      computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
    5.57 -      computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
    5.58 -    }
    5.59 -
    5.60 -    private void HardwareRemoved(IHardware hardware) {
    5.61 -      hardware.SensorAdded -= new SensorEventHandler(SensorAdded);
    5.62 -      hardware.SensorRemoved -= new SensorEventHandler(SensorRemoved);
    5.63 -      foreach (ISensor sensor in hardware.Sensors) 
    5.64 -        SensorRemoved(sensor);
    5.65 -      foreach (IHardware subHardware in hardware.SubHardware)
    5.66 -        HardwareRemoved(subHardware);
    5.67 -    }
    5.68 -
    5.69 -    private void HardwareAdded(IHardware hardware) {
    5.70 -      foreach (ISensor sensor in hardware.Sensors)
    5.71 -        SensorAdded(sensor);
    5.72 -      hardware.SensorAdded += new SensorEventHandler(SensorAdded);
    5.73 -      hardware.SensorRemoved += new SensorEventHandler(SensorRemoved);
    5.74 -      foreach (IHardware subHardware in hardware.SubHardware)
    5.75 -        HardwareAdded(subHardware);
    5.76 -    }
    5.77 -
    5.78 -    private void SensorAdded(ISensor sensor) {
    5.79 -      if (Config.Get(new Identifier(sensor.Identifier, 
    5.80 -        "tray").ToString(), false)) 
    5.81 -        Add(sensor, false);   
    5.82 -    }
    5.83 -
    5.84 -    private void SensorRemoved(ISensor sensor) {
    5.85 -      if (Contains(sensor)) 
    5.86 -        Remove(sensor, false);
    5.87 -    }
    5.88 -
    5.89 -    public void Dispose() {
    5.90 -      foreach (SensorNotifyIcon icon in list)
    5.91 -        icon.Dispose();
    5.92 -    }
    5.93 -
    5.94 -    public void Redraw() {
    5.95 -      foreach (SensorNotifyIcon icon in list)
    5.96 -        icon.Update();
    5.97 -    }
    5.98 -
    5.99 -    public bool Contains(ISensor sensor) {
   5.100 -      foreach (SensorNotifyIcon icon in list)
   5.101 -        if (icon.Sensor == sensor)
   5.102 -          return true;
   5.103 -      return false;
   5.104 -    }
   5.105 -
   5.106 -    public void Add(ISensor sensor, bool balloonTip) {
   5.107 -      if (Contains(sensor)) {
   5.108 -        return;
   5.109 -      } else {        
   5.110 -        list.Add(new SensorNotifyIcon(this, sensor, balloonTip));
   5.111 -        Config.Set(new Identifier(sensor.Identifier, "tray").ToString(), true);
   5.112 -      }
   5.113 -    }
   5.114 -
   5.115 -    public void Remove(ISensor sensor) {
   5.116 -      Remove(sensor, true);
   5.117 -    }
   5.118 -
   5.119 -    private void Remove(ISensor sensor, bool deleteConfig) {
   5.120 -      if (deleteConfig) {
   5.121 -        Config.Remove(
   5.122 -          new Identifier(sensor.Identifier, "tray").ToString());
   5.123 -        Config.Remove(
   5.124 -          new Identifier(sensor.Identifier, "traycolor").ToString());
   5.125 -      }
   5.126 -      SensorNotifyIcon instance = null;
   5.127 -      foreach (SensorNotifyIcon icon in list)
   5.128 -        if (icon.Sensor == sensor)
   5.129 -          instance = icon;
   5.130 -      if (instance != null) {
   5.131 -        list.Remove(instance);
   5.132 -        instance.Dispose();
   5.133 -      }
   5.134 -    }
   5.135 -
   5.136 -  }
   5.137 -}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/GUI/SystemTray.cs	Sat Jun 05 18:59:54 2010 +0000
     6.3 @@ -0,0 +1,190 @@
     6.4 +/*
     6.5 +  
     6.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     6.7 +
     6.8 +  The contents of this file are subject to the Mozilla Public License Version
     6.9 +  1.1 (the "License"); you may not use this file except in compliance with
    6.10 +  the License. You may obtain a copy of the License at
    6.11 + 
    6.12 +  http://www.mozilla.org/MPL/
    6.13 +
    6.14 +  Software distributed under the License is distributed on an "AS IS" basis,
    6.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    6.16 +  for the specific language governing rights and limitations under the License.
    6.17 +
    6.18 +  The Original Code is the Open Hardware Monitor code.
    6.19 +
    6.20 +  The Initial Developer of the Original Code is 
    6.21 +  Michael Möller <m.moeller@gmx.ch>.
    6.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    6.23 +  the Initial Developer. All Rights Reserved.
    6.24 +
    6.25 +  Contributor(s):
    6.26 +
    6.27 +  Alternatively, the contents of this file may be used under the terms of
    6.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    6.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    6.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
    6.31 +  of those above. If you wish to allow use of your version of this file only
    6.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
    6.33 +  use your version of this file under the terms of the MPL, indicate your
    6.34 +  decision by deleting the provisions above and replace them with the notice
    6.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
    6.36 +  the provisions above, a recipient may use your version of this file under
    6.37 +  the terms of any one of the MPL, the GPL or the LGPL.
    6.38 + 
    6.39 +*/
    6.40 +
    6.41 +using System;
    6.42 +using System.Collections.Generic;
    6.43 +using System.Drawing;
    6.44 +using System.Text;
    6.45 +using System.Windows.Forms;
    6.46 +using OpenHardwareMonitor.Hardware;
    6.47 +using OpenHardwareMonitor.Utilities;
    6.48 +
    6.49 +namespace OpenHardwareMonitor.GUI {
    6.50 +  public class SystemTray : IDisposable {
    6.51 +    private IComputer computer;
    6.52 +    private List<SensorNotifyIcon> list = new List<SensorNotifyIcon>();
    6.53 +    private bool mainIconEnabled = false;
    6.54 +    private NotifyIcon mainIcon;
    6.55 +
    6.56 +    public SystemTray(IComputer computer) {
    6.57 +      this.computer = computer;
    6.58 +      computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
    6.59 +      computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
    6.60 +
    6.61 +      this.mainIcon = new NotifyIcon();
    6.62 +
    6.63 +      ContextMenuStrip contextMenuStrip = new ContextMenuStrip();
    6.64 +      ToolStripMenuItem hideShowItem = new ToolStripMenuItem("Hide/Show");
    6.65 +      hideShowItem.Click += delegate(object obj, EventArgs args) {
    6.66 +        SendHideShowCommand();
    6.67 +      };
    6.68 +      contextMenuStrip.Items.Add(hideShowItem);
    6.69 +      contextMenuStrip.Items.Add(new ToolStripSeparator());      
    6.70 +      ToolStripMenuItem exitItem = new ToolStripMenuItem("Exit");
    6.71 +      exitItem.Click += delegate(object obj, EventArgs args) {
    6.72 +        SendExitCommand();
    6.73 +      };
    6.74 +      contextMenuStrip.Items.Add(exitItem);
    6.75 +      this.mainIcon.ContextMenuStrip = contextMenuStrip;
    6.76 +      this.mainIcon.DoubleClick += delegate(object obj, EventArgs args) {
    6.77 +        SendHideShowCommand();
    6.78 +      };
    6.79 +      this.mainIcon.Icon = EmbeddedResources.GetIcon("smallicon.ico");
    6.80 +    }
    6.81 +
    6.82 +    private void HardwareRemoved(IHardware hardware) {
    6.83 +      hardware.SensorAdded -= new SensorEventHandler(SensorAdded);
    6.84 +      hardware.SensorRemoved -= new SensorEventHandler(SensorRemoved);
    6.85 +      foreach (ISensor sensor in hardware.Sensors) 
    6.86 +        SensorRemoved(sensor);
    6.87 +      foreach (IHardware subHardware in hardware.SubHardware)
    6.88 +        HardwareRemoved(subHardware);
    6.89 +    }
    6.90 +
    6.91 +    private void HardwareAdded(IHardware hardware) {
    6.92 +      foreach (ISensor sensor in hardware.Sensors)
    6.93 +        SensorAdded(sensor);
    6.94 +      hardware.SensorAdded += new SensorEventHandler(SensorAdded);
    6.95 +      hardware.SensorRemoved += new SensorEventHandler(SensorRemoved);
    6.96 +      foreach (IHardware subHardware in hardware.SubHardware)
    6.97 +        HardwareAdded(subHardware);
    6.98 +    }
    6.99 +
   6.100 +    private void SensorAdded(ISensor sensor) {
   6.101 +      if (Config.Get(new Identifier(sensor.Identifier, 
   6.102 +        "tray").ToString(), false)) 
   6.103 +        Add(sensor, false);   
   6.104 +    }
   6.105 +
   6.106 +    private void SensorRemoved(ISensor sensor) {
   6.107 +      if (Contains(sensor)) 
   6.108 +        Remove(sensor, false);
   6.109 +    }
   6.110 +
   6.111 +    public void Dispose() {
   6.112 +      foreach (SensorNotifyIcon icon in list)
   6.113 +        icon.Dispose();
   6.114 +      mainIcon.Dispose();
   6.115 +    }
   6.116 +
   6.117 +    public void Redraw() {
   6.118 +      foreach (SensorNotifyIcon icon in list)
   6.119 +        icon.Update();
   6.120 +    }
   6.121 +
   6.122 +    public bool Contains(ISensor sensor) {
   6.123 +      foreach (SensorNotifyIcon icon in list)
   6.124 +        if (icon.Sensor == sensor)
   6.125 +          return true;
   6.126 +      return false;
   6.127 +    }
   6.128 +
   6.129 +    public void Add(ISensor sensor, bool balloonTip) {
   6.130 +      if (Contains(sensor)) {
   6.131 +        return;
   6.132 +      } else {        
   6.133 +        list.Add(new SensorNotifyIcon(this, sensor, balloonTip));
   6.134 +        UpdateMainIconVisibilty();
   6.135 +        Config.Set(new Identifier(sensor.Identifier, "tray").ToString(), true);
   6.136 +      }
   6.137 +    }
   6.138 +
   6.139 +    public void Remove(ISensor sensor) {
   6.140 +      Remove(sensor, true);
   6.141 +    }
   6.142 +
   6.143 +    private void Remove(ISensor sensor, bool deleteConfig) {
   6.144 +      if (deleteConfig) {
   6.145 +        Config.Remove(
   6.146 +          new Identifier(sensor.Identifier, "tray").ToString());
   6.147 +        Config.Remove(
   6.148 +          new Identifier(sensor.Identifier, "traycolor").ToString());
   6.149 +      }
   6.150 +      SensorNotifyIcon instance = null;
   6.151 +      foreach (SensorNotifyIcon icon in list)
   6.152 +        if (icon.Sensor == sensor)
   6.153 +          instance = icon;
   6.154 +      if (instance != null) {
   6.155 +        list.Remove(instance);
   6.156 +        UpdateMainIconVisibilty();
   6.157 +        instance.Dispose();        
   6.158 +      }
   6.159 +    }
   6.160 +
   6.161 +    public event EventHandler HideShowCommand;
   6.162 +
   6.163 +    public void SendHideShowCommand() {
   6.164 +      if (HideShowCommand != null)
   6.165 +        HideShowCommand(this, null);
   6.166 +    }
   6.167 +
   6.168 +    public event EventHandler ExitCommand;
   6.169 +
   6.170 +    public void SendExitCommand() {
   6.171 +      if (ExitCommand != null)
   6.172 +        ExitCommand(this, null);
   6.173 +    }
   6.174 +
   6.175 +    private void UpdateMainIconVisibilty() {
   6.176 +      if (mainIconEnabled) {
   6.177 +        mainIcon.Visible = list.Count == 0;
   6.178 +      } else {
   6.179 +        mainIcon.Visible = false;
   6.180 +      }
   6.181 +    }
   6.182 +
   6.183 +    public bool IsMainIconEnabled {
   6.184 +      get { return mainIconEnabled; }
   6.185 +      set {
   6.186 +        if (mainIconEnabled != value) {
   6.187 +          mainIconEnabled = value;
   6.188 +          UpdateMainIconVisibilty();
   6.189 +        }
   6.190 +      }
   6.191 +    }
   6.192 +  }
   6.193 +}
     7.1 --- a/Hardware/Mainboard/Mainboard.cs	Sat Jun 05 11:15:16 2010 +0000
     7.2 +++ b/Hardware/Mainboard/Mainboard.cs	Sat Jun 05 18:59:54 2010 +0000
     7.3 @@ -76,7 +76,7 @@
     7.4          superIOHardware[i] = new SuperIOHardware(superIO[i], 
     7.5            smbios.Board != null ? smbios.Board.Manufacturer : 
     7.6            Manufacturer.Unknown, smbios.Board != null ? smbios.Board.Model : 
     7.7 -          Model.Unknown);
     7.8 +          Model.Unknown);      
     7.9      }
    7.10  
    7.11      public string Name {
     8.1 --- a/Hardware/Mainboard/Model.cs	Sat Jun 05 11:15:16 2010 +0000
     8.2 +++ b/Hardware/Mainboard/Model.cs	Sat Jun 05 18:59:54 2010 +0000
     8.3 @@ -39,7 +39,9 @@
     8.4  
     8.5    public enum Model {
     8.6      // ASUS
     8.7 -    P5W_DH_Deluxe,
     8.8 +    Crosshair_III_Formula,
     8.9 +    M2N_SLI_DELUXE,
    8.10 +    P5W_DH_Deluxe,    
    8.11  
    8.12      // DFI
    8.13      LP_BI_P45_T2RS_Elite,
    8.14 @@ -52,8 +54,10 @@
    8.15      _965P_S3,
    8.16      EP45_DS3R,
    8.17      EP45_UD3R,
    8.18 +    EX58_EXTREME,
    8.19      GA_MA785GMT_UD2H,
    8.20      P35_DS3,
    8.21 +    P35_DS3L,
    8.22      X38_DS5,
    8.23  
    8.24      // Unknown
     9.1 --- a/Hardware/Mainboard/SMBIOS.cs	Sat Jun 05 11:15:16 2010 +0000
     9.2 +++ b/Hardware/Mainboard/SMBIOS.cs	Sat Jun 05 18:59:54 2010 +0000
     9.3 @@ -226,6 +226,10 @@
     9.4          }
     9.5  
     9.6          switch (productName) {
     9.7 +          case "Crosshair III Formula":
     9.8 +            model = Model.Crosshair_III_Formula; break;
     9.9 +          case "M2N-SLI DELUXE":
    9.10 +            model = Model.M2N_SLI_DELUXE; break;
    9.11            case "P5W DH Deluxe":
    9.12              model = Model.P5W_DH_Deluxe; break;
    9.13            case "LP BI P45-T2RS Elite":
    9.14 @@ -240,10 +244,14 @@
    9.15              model = Model.EP45_DS3R; break;
    9.16            case "EP45-UD3R":
    9.17              model = Model.EP45_UD3R; break;
    9.18 +          case "EX58-EXTREME":
    9.19 +            model = Model.EX58_EXTREME; break;
    9.20            case "GA-MA785GMT-UD2H":
    9.21              model = Model.GA_MA785GMT_UD2H; break;
    9.22            case "P35-DS3":
    9.23              model = Model.P35_DS3; break;
    9.24 +          case "P35-DS3L":
    9.25 +            model = Model.P35_DS3L; break;
    9.26            case "X38-DS5":
    9.27              model = Model.X38_DS5; break;
    9.28            default:
    10.1 --- a/Hardware/Mainboard/SuperIOHardware.cs	Sat Jun 05 11:15:16 2010 +0000
    10.2 +++ b/Hardware/Mainboard/SuperIOHardware.cs	Sat Jun 05 18:59:54 2010 +0000
    10.3 @@ -90,6 +90,44 @@
    10.4          case Chip.IT8720F:
    10.5          case Chip.IT8726F:
    10.6            switch (manufacturer) {
    10.7 +            case Manufacturer.ASUS:
    10.8 +              switch (model) {
    10.9 +                case Model.Crosshair_III_Formula:
   10.10 +                  v.Add(new Voltage("VBat", 8));
   10.11 +                  t.Add(new Temperature("CPU", 0));
   10.12 +                  for (int i = 0; i < superIO.Fans.Length; i++)
   10.13 +                    f.Add(new Fan("Fan #" + (i + 1), i));
   10.14 +                  break;
   10.15 +                case Model.M2N_SLI_DELUXE:
   10.16 +                  v.Add(new Voltage("CPU VCore", 0));
   10.17 +                  v.Add(new Voltage("+3.3V", 1));
   10.18 +                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
   10.19 +                  v.Add(new Voltage("+12V", 4, 30, 10, 0));
   10.20 +                  v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0));
   10.21 +                  v.Add(new Voltage("VBat", 8));
   10.22 +                  t.Add(new Temperature("CPU", 0));
   10.23 +                  t.Add(new Temperature("Motherboard", 1));
   10.24 +                  f.Add(new Fan("CPU Fan", 0));
   10.25 +                  f.Add(new Fan("Chassis Fan #1", 1));
   10.26 +                  f.Add(new Fan("Power Fan", 2));
   10.27 +                  break;
   10.28 +                default:
   10.29 +                  v.Add(new Voltage("CPU VCore", 0));
   10.30 +                  v.Add(new Voltage("Voltage #2", 1, true));
   10.31 +                  v.Add(new Voltage("Voltage #3", 2, true));
   10.32 +                  v.Add(new Voltage("Voltage #4", 3, true));
   10.33 +                  v.Add(new Voltage("Voltage #5", 4, true));
   10.34 +                  v.Add(new Voltage("Voltage #6", 5, true));
   10.35 +                  v.Add(new Voltage("Voltage #7", 6, true));
   10.36 +                  v.Add(new Voltage("Voltage #8", 7, true));
   10.37 +                  v.Add(new Voltage("VBat", 8));
   10.38 +                  for (int i = 0; i < superIO.Temperatures.Length; i++)
   10.39 +                    t.Add(new Temperature("Temperature #" + (i + 1), i));
   10.40 +                  for (int i = 0; i < superIO.Fans.Length; i++)
   10.41 +                    f.Add(new Fan("Fan #" + (i + 1), i));
   10.42 +                  break;
   10.43 +              }
   10.44 +              break;
   10.45              case Manufacturer.DFI:
   10.46                switch (model) {
   10.47                  case Model.LP_BI_P45_T2RS_Elite:
   10.48 @@ -160,7 +198,7 @@
   10.49                    break;
   10.50                  case Model.EP45_DS3R:
   10.51                  case Model.EP45_UD3R: 
   10.52 -                case Model.X38_DS5:
   10.53 +                case Model.X38_DS5:                
   10.54                    v.Add(new Voltage("CPU VCore", 0));
   10.55                    v.Add(new Voltage("DRAM", 1));
   10.56                    v.Add(new Voltage("+3.3V", 2));
   10.57 @@ -174,7 +212,21 @@
   10.58                    f.Add(new Fan("Power Fan", 2));
   10.59                    f.Add(new Fan("System Fan #1", 3));
   10.60                    break;
   10.61 +                case Model.EX58_EXTREME:
   10.62 +                  v.Add(new Voltage("CPU VCore", 0));
   10.63 +                  v.Add(new Voltage("DRAM", 1));
   10.64 +                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
   10.65 +                  v.Add(new Voltage("VBat", 8));
   10.66 +                  t.Add(new Temperature("System", 0));
   10.67 +                  t.Add(new Temperature("CPU", 1));
   10.68 +                  t.Add(new Temperature("MCH", 2));
   10.69 +                  f.Add(new Fan("CPU Fan", 0));
   10.70 +                  f.Add(new Fan("System Fan #2", 1));
   10.71 +                  f.Add(new Fan("Power Fan", 2));
   10.72 +                  f.Add(new Fan("System Fan #1", 3));
   10.73 +                  break;
   10.74                  case Model.P35_DS3:
   10.75 +                case Model.P35_DS3L:
   10.76                    v.Add(new Voltage("CPU VCore", 0));
   10.77                    v.Add(new Voltage("DRAM", 1));
   10.78                    v.Add(new Voltage("+3.3V", 2));
    11.1 --- a/OpenHardwareMonitor.csproj	Sat Jun 05 11:15:16 2010 +0000
    11.2 +++ b/OpenHardwareMonitor.csproj	Sat Jun 05 18:59:54 2010 +0000
    11.3 @@ -74,7 +74,7 @@
    11.4        <DependentUpon>ParameterForm.cs</DependentUpon>
    11.5      </Compile>
    11.6      <Compile Include="GUI\SensorNotifyIcon.cs" />
    11.7 -    <Compile Include="GUI\SensorSystemTray.cs" />
    11.8 +    <Compile Include="GUI\SystemTray.cs" />
    11.9      <Compile Include="GUI\StartupManager.cs" />
   11.10      <Compile Include="GUI\TaskScheduler.cs" />
   11.11      <Compile Include="GUI\TreeModel.cs" />