Implemented storage update interval at the UI side (#1706)
* Minor refactoring for #1699 * Implemented storage update interval for the UI * Revert "Implemented storage update interval for the UI" This reverts commit 977ff2f5518d420e35cadad17054f4e69c260df1. * Revert "Minor refactoring for #1699" This reverts commit 923f6d6f636a2a10ff44b8c23f84e8985ccbf667. * Made update interval configurable for storage devices * Changed label text m to min for consistency * Revised 8e6c669 as requested * ATA Update interval defaults to 1s in the UI * Simplified storage update interval menu
This commit is contained in:
+11
-1
@@ -123,6 +123,7 @@ namespace LibreHardwareMonitor.UI
|
||||
this.updateInterval2sMenuItem = new LibreHardwareMonitor.UI.ToolStripRadioButtonMenuItem();
|
||||
this.updateInterval5sMenuItem = new LibreHardwareMonitor.UI.ToolStripRadioButtonMenuItem();
|
||||
this.updateInterval10sMenuItem = new LibreHardwareMonitor.UI.ToolStripRadioButtonMenuItem();
|
||||
this.throttleAtaUpdateMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.sensorValuesTimeWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.timeWindow30sMenuItem = new LibreHardwareMonitor.UI.ToolStripRadioButtonMenuItem();
|
||||
this.timeWindow1minMenuItem = new LibreHardwareMonitor.UI.ToolStripRadioButtonMenuItem();
|
||||
@@ -787,7 +788,8 @@ namespace LibreHardwareMonitor.UI
|
||||
this.updateInterval1sMenuItem,
|
||||
this.updateInterval2sMenuItem,
|
||||
this.updateInterval5sMenuItem,
|
||||
this.updateInterval10sMenuItem});
|
||||
this.updateInterval10sMenuItem,
|
||||
this.throttleAtaUpdateMenuItem});
|
||||
this.updateIntervalMenuItem.Name = "updateIntervalMenuItem";
|
||||
this.updateIntervalMenuItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.updateIntervalMenuItem.Text = "Update Interval";
|
||||
@@ -834,6 +836,13 @@ namespace LibreHardwareMonitor.UI
|
||||
this.updateInterval10sMenuItem.Size = new System.Drawing.Size(107, 22);
|
||||
this.updateInterval10sMenuItem.Text = "10s";
|
||||
//
|
||||
// throttleATAUpdateMenuItem
|
||||
//
|
||||
this.throttleAtaUpdateMenuItem.CheckOnClick = true;
|
||||
this.throttleAtaUpdateMenuItem.Name = "throttleATAUpdateMenuItem";
|
||||
this.throttleAtaUpdateMenuItem.Size = new System.Drawing.Size(107, 22);
|
||||
this.throttleAtaUpdateMenuItem.Text = "Throttle ATA Storage";
|
||||
//
|
||||
// sensorValuesTimeWindowMenuItem
|
||||
//
|
||||
this.sensorValuesTimeWindowMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@@ -1171,6 +1180,7 @@ namespace LibreHardwareMonitor.UI
|
||||
private ToolStripRadioButtonMenuItem updateInterval2sMenuItem;
|
||||
private ToolStripRadioButtonMenuItem updateInterval5sMenuItem;
|
||||
private ToolStripRadioButtonMenuItem updateInterval10sMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem throttleAtaUpdateMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem nicMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem sensorValuesTimeWindowMenuItem;
|
||||
private ToolStripRadioButtonMenuItem timeWindow30sMenuItem;
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Windows.Forms;
|
||||
using Aga.Controls.Tree;
|
||||
using Aga.Controls.Tree.NodeControls;
|
||||
using LibreHardwareMonitor.Hardware;
|
||||
using LibreHardwareMonitor.Hardware.Storage;
|
||||
using LibreHardwareMonitor.UI.Themes;
|
||||
using LibreHardwareMonitor.Utilities;
|
||||
using LibreHardwareMonitor.Wmi;
|
||||
@@ -30,6 +31,7 @@ public sealed partial class MainForm : Form
|
||||
private readonly Logger _logger;
|
||||
private readonly UserRadioGroup _loggingInterval;
|
||||
private readonly UserRadioGroup _updateInterval;
|
||||
private readonly UserOption _throttleAtaUpdate;
|
||||
private readonly UserOption _logSensors;
|
||||
private readonly UserOption _minimizeOnClose;
|
||||
private readonly UserOption _minimizeToTray;
|
||||
@@ -374,6 +376,21 @@ public sealed partial class MainForm : Form
|
||||
}
|
||||
};
|
||||
|
||||
_throttleAtaUpdate = new UserOption("throttleAtaUpdateMenuItem", false, throttleAtaUpdateMenuItem, _settings);
|
||||
_throttleAtaUpdate.Changed += (sender, e) =>
|
||||
{
|
||||
switch (_throttleAtaUpdate.Value)
|
||||
{
|
||||
case true:
|
||||
AtaStorage.ThrottleInterval = TimeSpan.FromSeconds(30);
|
||||
break;
|
||||
|
||||
case false:
|
||||
AtaStorage.ThrottleInterval = TimeSpan.Zero;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
_sensorValuesTimeWindow = new UserRadioGroup("sensorValuesTimeWindow",
|
||||
10,
|
||||
new[]
|
||||
|
||||
Reference in New Issue
Block a user