Add view menu item to clear the plot (#900)
This commit is contained in:
+10
@@ -64,6 +64,7 @@ namespace LibreHardwareMonitor.UI
|
||||
this.exitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.viewMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.resetMinMaxMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.resetPlotMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.MenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.hiddenMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.plotMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -345,6 +346,7 @@ namespace LibreHardwareMonitor.UI
|
||||
//
|
||||
this.viewMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.resetMinMaxMenuItem,
|
||||
this.resetPlotMenuItem,
|
||||
this.MenuItem3,
|
||||
this.hiddenMenuItem,
|
||||
this.plotMenuItem,
|
||||
@@ -362,6 +364,13 @@ namespace LibreHardwareMonitor.UI
|
||||
this.resetMinMaxMenuItem.Text = "Reset Min/Max";
|
||||
this.resetMinMaxMenuItem.Click += new System.EventHandler(this.ResetMinMaxMenuItem_Click);
|
||||
//
|
||||
// resetPlotMenuItem
|
||||
//
|
||||
this.resetPlotMenuItem.Name = "resetPlotMenuItem";
|
||||
this.resetPlotMenuItem.Size = new System.Drawing.Size(188, 22);
|
||||
this.resetPlotMenuItem.Text = "Reset Plot";
|
||||
this.resetPlotMenuItem.Click += new System.EventHandler(this.resetPlotMenuItem_Click);
|
||||
//
|
||||
// MenuItem3
|
||||
//
|
||||
this.MenuItem3.Name = "MenuItem3";
|
||||
@@ -993,6 +1002,7 @@ namespace LibreHardwareMonitor.UI
|
||||
private ToolStripRadioButtonMenuItem fahrenheitMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator MenuItem2;
|
||||
private System.Windows.Forms.ToolStripMenuItem resetMinMaxMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem resetPlotMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator MenuItem3;
|
||||
private System.Windows.Forms.ToolStripMenuItem gadgetMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem minCloseMenuItem;
|
||||
|
||||
@@ -1100,6 +1100,14 @@ public sealed partial class MainForm : Form
|
||||
}));
|
||||
}
|
||||
|
||||
private void resetPlotMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_computer.Accept(new SensorVisitor(delegate (ISensor sensorClick)
|
||||
{
|
||||
sensorClick.ClearValues();
|
||||
}));
|
||||
}
|
||||
|
||||
private void MainForm_MoveOrResize(object sender, EventArgs e)
|
||||
{
|
||||
if (WindowState != FormWindowState.Minimized)
|
||||
|
||||
@@ -123,4 +123,9 @@ public interface ISensor : IElement
|
||||
/// Resets a value stored in <see cref="Max"/>.
|
||||
/// </summary>
|
||||
void ResetMax();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the values stored in <see cref="Values"/>.
|
||||
/// </summary>
|
||||
void ClearValues();
|
||||
}
|
||||
|
||||
@@ -169,6 +169,11 @@ internal class Sensor : ISensor
|
||||
Max = null;
|
||||
}
|
||||
|
||||
public void ClearValues()
|
||||
{
|
||||
_values.Clear();
|
||||
}
|
||||
|
||||
public void Accept(IVisitor visitor)
|
||||
{
|
||||
if (visitor == null)
|
||||
|
||||
Reference in New Issue
Block a user