Fixed Issue 82.

This commit is contained in:
Michael Möller 2010-07-04 12:49:16 +00:00
parent a72af71590
commit c7ef3b8ecf
7 changed files with 107 additions and 13 deletions

View File

@ -76,6 +76,8 @@ namespace OpenHardwareMonitor.GUI {
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.sumbitReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.hiddenMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -102,8 +104,8 @@ namespace OpenHardwareMonitor.GUI {
this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
this.timer = new System.Windows.Forms.Timer(this.components);
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.sumbitReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
this.resetMinMaxMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
@ -243,6 +245,18 @@ namespace OpenHardwareMonitor.GUI {
this.saveReportToolStripMenuItem.Text = "Save Report...";
this.saveReportToolStripMenuItem.Click += new System.EventHandler(this.saveReportToolStripMenuItem_Click);
//
// sumbitReportToolStripMenuItem
//
this.sumbitReportToolStripMenuItem.Name = "sumbitReportToolStripMenuItem";
this.sumbitReportToolStripMenuItem.Size = new System.Drawing.Size(159, 22);
this.sumbitReportToolStripMenuItem.Text = "Submit Report...";
this.sumbitReportToolStripMenuItem.Click += new System.EventHandler(this.sumbitReportToolStripMenuItem_Click);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(156, 6);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
@ -253,6 +267,8 @@ namespace OpenHardwareMonitor.GUI {
// viewToolStripMenuItem
//
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.resetMinMaxMenuItem,
this.toolStripMenuItem3,
this.hiddenMenuItem,
this.plotMenuItem,
this.toolStripMenuItem1,
@ -464,17 +480,17 @@ namespace OpenHardwareMonitor.GUI {
this.timer.Interval = 1000;
this.timer.Tick += new System.EventHandler(this.timer_Tick);
//
// toolStripMenuItem2
// toolStripMenuItem3
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(156, 6);
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(185, 6);
//
// sumbitReportToolStripMenuItem
// resetMinMaxMenuItem
//
this.sumbitReportToolStripMenuItem.Name = "sumbitReportToolStripMenuItem";
this.sumbitReportToolStripMenuItem.Size = new System.Drawing.Size(159, 22);
this.sumbitReportToolStripMenuItem.Text = "Submit Report...";
this.sumbitReportToolStripMenuItem.Click += new System.EventHandler(this.sumbitReportToolStripMenuItem_Click);
this.resetMinMaxMenuItem.Name = "resetMinMaxMenuItem";
this.resetMinMaxMenuItem.Size = new System.Drawing.Size(188, 22);
this.resetMinMaxMenuItem.Text = "Reset Min/Max";
this.resetMinMaxMenuItem.Click += new System.EventHandler(this.resetMinMaxMenuItem_Click);
//
// MainForm
//
@ -543,6 +559,8 @@ namespace OpenHardwareMonitor.GUI {
private System.Windows.Forms.ToolStripMenuItem fahrenheitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem sumbitReportToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem resetMinMaxMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
}
}

View File

@ -462,5 +462,10 @@ namespace OpenHardwareMonitor.GUI {
form.Report = computer.GetReport();
form.ShowDialog();
}
private void resetMinMaxMenuItem_Click(object sender, EventArgs e) {
IVisitor visitor = new ResetMinMaxVisitor();
computer.Accept(visitor);
}
}
}

59
GUI/ResetMinMaxVisitor.cs Normal file
View File

@ -0,0 +1,59 @@
/*
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the License.
The Original Code is the Open Hardware Monitor code.
The Initial Developer of the Original Code is
Michael Möller <m.moeller@gmx.ch>.
Portions created by the Initial Developer are Copyright (C) 2009-2010
the Initial Developer. All Rights Reserved.
Contributor(s):
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
*/
using System;
using System.Collections.Generic;
using OpenHardwareMonitor.Hardware;
namespace OpenHardwareMonitor.GUI {
public class ResetMinMaxVisitor : IVisitor {
public void VisitComputer(IComputer computer) {
computer.Traverse(this);
}
public void VisitHardware(IHardware hardware) {
hardware.Traverse(this);
}
public void VisitSensor(ISensor sensor) {
sensor.ResetMin();
sensor.ResetMax();
}
public void VisitParameter(IParameter parameter) { }
}
}

View File

@ -74,6 +74,9 @@ namespace OpenHardwareMonitor.Hardware {
float? Min { get; }
float? Max { get; }
void ResetMin();
void ResetMax();
IEnumerable<ISensorEntry> Plot { get; }
}

View File

@ -163,6 +163,14 @@ namespace OpenHardwareMonitor.Hardware {
public float? Min { get { return min; } }
public float? Max { get { return max; } }
public void ResetMin() {
min = null;
}
public void ResetMax() {
max = null;
}
public IEnumerable<ISensorEntry> Plot {
get { return entries; }
}

View File

@ -80,6 +80,7 @@
<Compile Include="GUI\ParameterForm.Designer.cs">
<DependentUpon>ParameterForm.cs</DependentUpon>
</Compile>
<Compile Include="GUI\ResetMinMaxVisitor.cs" />
<Compile Include="GUI\SensorNotifyIcon.cs" />
<Compile Include="GUI\SystemTray.cs" />
<Compile Include="GUI\StartupManager.cs" />

View File

@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.36.0")]
[assembly: AssemblyFileVersion("0.1.36.0")]
[assembly: AssemblyVersion("0.1.37.0")]
[assembly: AssemblyFileVersion("0.1.37.0")]