Prevent Menu From Closing When Turning On or Off Sensors to Display (#1395)
* Prevent Hardware Menu From Closing When Selecting Sensors To Turn Off * Fix Double Declaration of PSU Menu Item in Designer. Not allowing Designer to Load in VS * Remove Properties Resource File as it's auto generated. * Implemented @pedrosimoes79 suggestion. Work and much cleaner. Thank you. * Update MainForm.cs --------- Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
This commit is contained in:
co-authored by
PhyxionNL
parent
cd48456ad4
commit
46746e7a86
+7
-8
@@ -51,7 +51,7 @@ namespace LibreHardwareMonitor.UI
|
||||
this.saveReportMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.MenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.resetMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuItem5 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuItemFileHardware = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mainboardMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cpuMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ramMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -139,7 +139,6 @@ namespace LibreHardwareMonitor.UI
|
||||
this.splitContainer = new LibreHardwareMonitor.UI.SplitContainerAdv();
|
||||
this.treeView = new Aga.Controls.Tree.TreeViewAdv();
|
||||
this.batteryMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.psuMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.backgroundUpdater = new System.ComponentModel.BackgroundWorker();
|
||||
this.mainMenu.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
|
||||
@@ -244,7 +243,7 @@ namespace LibreHardwareMonitor.UI
|
||||
this.saveReportMenuItem,
|
||||
this.MenuItem2,
|
||||
this.resetMenuItem,
|
||||
this.menuItem5,
|
||||
this.menuItemFileHardware,
|
||||
this.menuItem6,
|
||||
this.exitMenuItem});
|
||||
this.fileMenuItem.Name = "fileMenuItem";
|
||||
@@ -272,7 +271,7 @@ namespace LibreHardwareMonitor.UI
|
||||
//
|
||||
// menuItem5
|
||||
//
|
||||
this.menuItem5.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.menuItemFileHardware.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mainboardMenuItem,
|
||||
this.cpuMenuItem,
|
||||
this.ramMenuItem,
|
||||
@@ -282,9 +281,9 @@ namespace LibreHardwareMonitor.UI
|
||||
this.nicMenuItem,
|
||||
this.psuMenuItem,
|
||||
this.batteryMenuItem});
|
||||
this.menuItem5.Name = "menuItem5";
|
||||
this.menuItem5.Size = new System.Drawing.Size(180, 22);
|
||||
this.menuItem5.Text = "Hardware";
|
||||
this.menuItemFileHardware.Name = "menuItem5";
|
||||
this.menuItemFileHardware.Size = new System.Drawing.Size(180, 22);
|
||||
this.menuItemFileHardware.Text = "Hardware";
|
||||
//
|
||||
// mainboardMenuItem
|
||||
//
|
||||
@@ -1055,7 +1054,7 @@ namespace LibreHardwareMonitor.UI
|
||||
private System.Windows.Forms.ToolStripMenuItem webMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem runWebServerMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem serverPortMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuItem5;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuItemFileHardware;
|
||||
private System.Windows.Forms.ToolStripMenuItem mainboardMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem cpuMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem gpuMenuItem;
|
||||
|
||||
@@ -228,6 +228,11 @@ public sealed partial class MainForm : Form
|
||||
_readBatterySensors.Changed += delegate { _computer.IsBatteryEnabled = _readBatterySensors.Value; };
|
||||
|
||||
_showGadget = new UserOption("gadgetMenuItem", false, gadgetMenuItem, _settings);
|
||||
|
||||
// Prevent Menu From Closing When UnClicking Hardware Items
|
||||
menuItemFileHardware.DropDown.Closing += StopFileHardwareMenuFromClosing;
|
||||
|
||||
|
||||
_showGadget.Changed += delegate
|
||||
{
|
||||
if (_gadget != null)
|
||||
@@ -459,6 +464,14 @@ public sealed partial class MainForm : Form
|
||||
Microsoft.Win32.SystemEvents.PowerModeChanged += PowerModeChanged;
|
||||
}
|
||||
|
||||
private void StopFileHardwareMenuFromClosing(object sender, ToolStripDropDownClosingEventArgs e)
|
||||
{
|
||||
if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool AuthWebServerMenuItemChecked
|
||||
{
|
||||
get { return authWebServerMenuItem.Checked; }
|
||||
|
||||
Reference in New Issue
Block a user