Fixed a problem, where the MainForm location and size was lost when the application is started minimized and exited without ever showing the form. This caused MainForm_Load to be never called (location and size was not loaded), but the default size and location were still saved. The new implementation only saves the location and size when one of the two is changed.
3 Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 The contents of this file are subject to the Mozilla Public License Version
6 1.1 (the "License"); you may not use this file except in compliance with
7 the License. You may obtain a copy of the License at
9 http://www.mozilla.org/MPL/
11 Software distributed under the License is distributed on an "AS IS" basis,
12 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 for the specific language governing rights and limitations under the License.
15 The Original Code is the Open Hardware Monitor code.
17 The Initial Developer of the Original Code is
18 Michael Möller <m.moeller@gmx.ch>.
19 Portions created by the Initial Developer are Copyright (C) 2009-2010
20 the Initial Developer. All Rights Reserved.
24 Alternatively, the contents of this file may be used under the terms of
25 either the GNU General Public License Version 2 or later (the "GPL"), or
26 the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 in which case the provisions of the GPL or the LGPL are applicable instead
28 of those above. If you wish to allow use of your version of this file only
29 under the terms of either the GPL or the LGPL, and not to allow others to
30 use your version of this file under the terms of the MPL, indicate your
31 decision by deleting the provisions above and replace them with the notice
32 and other provisions required by the GPL or the LGPL. If you do not delete
33 the provisions above, a recipient may use your version of this file under
34 the terms of any one of the MPL, the GPL or the LGPL.
40 using OpenHardwareMonitor.Hardware.LPC;
42 namespace OpenHardwareMonitor.Hardware.Mainboard {
43 internal class Mainboard : IHardware {
44 private readonly SMBIOS smbios;
45 private readonly string name;
47 private readonly LPCIO lpcio;
48 private readonly LMSensors lmSensors;
49 private readonly IHardware[] superIOHardware;
51 public Mainboard(ISettings settings) {
52 this.smbios = new SMBIOS();
54 if (smbios.Board != null) {
55 if (!string.IsNullOrEmpty(smbios.Board.ProductName)) {
56 if (smbios.Board.Manufacturer == Manufacturer.Unknown)
57 this.name = smbios.Board.ProductName;
59 this.name = smbios.Board.Manufacturer + " " +
60 smbios.Board.ProductName;
62 this.name = smbios.Board.Manufacturer.ToString();
65 this.name = Manufacturer.Unknown.ToString();
69 int p = (int)Environment.OSVersion.Platform;
70 if ((p == 4) || (p == 128)) {
71 this.lmSensors = new LMSensors();
72 superIO = lmSensors.SuperIO;
74 this.lpcio = new LPCIO();
75 superIO = lpcio.SuperIO;
78 superIOHardware = new IHardware[superIO.Length];
79 for (int i = 0; i < superIO.Length; i++)
80 superIOHardware[i] = new SuperIOHardware(this, superIO[i],
81 smbios.Board != null ? smbios.Board.Manufacturer :
82 Manufacturer.Unknown, smbios.Board != null ? smbios.Board.Model :
83 Model.Unknown, settings);
90 public Identifier Identifier {
91 get { return new Identifier("mainboard"); }
94 public HardwareType HardwareType {
95 get { return HardwareType.Mainboard; }
98 public virtual IHardware Parent {
102 public string GetReport() {
103 StringBuilder r = new StringBuilder();
105 r.AppendLine("Mainboard");
107 r.Append(smbios.GetReport());
110 r.Append(lpcio.GetReport());
115 public void Update() { }
117 public void Close() {
118 if (lmSensors != null)
122 public IHardware[] SubHardware {
123 get { return superIOHardware; }
126 public ISensor[] Sensors {
127 get { return new ISensor[0]; }
130 #pragma warning disable 67
131 public event SensorEventHandler SensorAdded;
132 public event SensorEventHandler SensorRemoved;
133 #pragma warning restore 67
135 public void Accept(IVisitor visitor) {
137 throw new ArgumentNullException("visitor");
138 visitor.VisitHardware(this);
141 public void Traverse(IVisitor visitor) {
142 foreach (IHardware hardware in superIOHardware)
143 hardware.Accept(visitor);