mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-09-01 14:55:13 +00:00
New option to start the application minimized.
This commit is contained in:
32
GUI/MainForm.Designer.cs
generated
32
GUI/MainForm.Designer.cs
generated
@@ -94,6 +94,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.plotMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.plotMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.startMinMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.minTrayMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.minTrayMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.hddMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.hddMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@@ -101,12 +102,12 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.timer = new System.Windows.Forms.Timer(this.components);
|
this.timer = new System.Windows.Forms.Timer(this.components);
|
||||||
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||||
|
this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
|
||||||
this.notifyContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.notifyContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
this.restoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.restoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
|
|
||||||
this.columnsContextMenuStrip.SuspendLayout();
|
this.columnsContextMenuStrip.SuspendLayout();
|
||||||
this.menuStrip.SuspendLayout();
|
this.menuStrip.SuspendLayout();
|
||||||
this.splitContainer.Panel1.SuspendLayout();
|
this.splitContainer.Panel1.SuspendLayout();
|
||||||
@@ -411,6 +412,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
// optionsToolStripMenuItem
|
// optionsToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.startMinMenuItem,
|
||||||
this.minTrayMenuItem,
|
this.minTrayMenuItem,
|
||||||
this.toolStripMenuItem3,
|
this.toolStripMenuItem3,
|
||||||
this.hddMenuItem});
|
this.hddMenuItem});
|
||||||
@@ -418,6 +420,13 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
||||||
this.optionsToolStripMenuItem.Text = "Options";
|
this.optionsToolStripMenuItem.Text = "Options";
|
||||||
//
|
//
|
||||||
|
// startMinimizedMenuItem
|
||||||
|
//
|
||||||
|
this.startMinMenuItem.CheckOnClick = true;
|
||||||
|
this.startMinMenuItem.Name = "startMinimizedMenuItem";
|
||||||
|
this.startMinMenuItem.Size = new System.Drawing.Size(166, 22);
|
||||||
|
this.startMinMenuItem.Text = "Start Minimized";
|
||||||
|
//
|
||||||
// minTrayMenuItem
|
// minTrayMenuItem
|
||||||
//
|
//
|
||||||
this.minTrayMenuItem.Checked = true;
|
this.minTrayMenuItem.Checked = true;
|
||||||
@@ -480,6 +489,16 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.splitContainer.SplitterWidth = 3;
|
this.splitContainer.SplitterWidth = 3;
|
||||||
this.splitContainer.TabIndex = 3;
|
this.splitContainer.TabIndex = 3;
|
||||||
//
|
//
|
||||||
|
// plotPanel
|
||||||
|
//
|
||||||
|
this.plotPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
this.plotPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.plotPanel.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||||
|
this.plotPanel.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.plotPanel.Name = "plotPanel";
|
||||||
|
this.plotPanel.Size = new System.Drawing.Size(478, 198);
|
||||||
|
this.plotPanel.TabIndex = 0;
|
||||||
|
//
|
||||||
// notifyContextMenuStrip
|
// notifyContextMenuStrip
|
||||||
//
|
//
|
||||||
this.notifyContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.notifyContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
@@ -514,16 +533,6 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
this.sensorContextMenuStrip.Name = "sensorContextMenuStrip";
|
this.sensorContextMenuStrip.Name = "sensorContextMenuStrip";
|
||||||
this.sensorContextMenuStrip.Size = new System.Drawing.Size(61, 4);
|
this.sensorContextMenuStrip.Size = new System.Drawing.Size(61, 4);
|
||||||
//
|
//
|
||||||
// plotPanel
|
|
||||||
//
|
|
||||||
this.plotPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
|
||||||
this.plotPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.plotPanel.Font = new System.Drawing.Font("Segoe UI", 9F);
|
|
||||||
this.plotPanel.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.plotPanel.Name = "plotPanel";
|
|
||||||
this.plotPanel.Size = new System.Drawing.Size(478, 198);
|
|
||||||
this.plotPanel.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
@@ -597,6 +606,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
private System.Windows.Forms.ToolStripMenuItem minTrayMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem minTrayMenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
|
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
|
||||||
private System.Windows.Forms.ContextMenuStrip sensorContextMenuStrip;
|
private System.Windows.Forms.ContextMenuStrip sensorContextMenuStrip;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem startMinMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -134,6 +134,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
maxMenuItem.Checked = Config.Get(maxMenuItem.Name, true);
|
maxMenuItem.Checked = Config.Get(maxMenuItem.Name, true);
|
||||||
limitMenuItem.Checked = Config.Get(limitMenuItem.Name, false);
|
limitMenuItem.Checked = Config.Get(limitMenuItem.Name, false);
|
||||||
|
|
||||||
|
startMinMenuItem.Checked = Config.Get(startMinMenuItem.Name, false);
|
||||||
minTrayMenuItem.Checked = Config.Get(minTrayMenuItem.Name, true);
|
minTrayMenuItem.Checked = Config.Get(minTrayMenuItem.Name, true);
|
||||||
hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true);
|
hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true);
|
||||||
|
|
||||||
@@ -144,6 +145,17 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
fansMenuItem.Checked = Config.Get(fansMenuItem.Name, true);
|
fansMenuItem.Checked = Config.Get(fansMenuItem.Name, true);
|
||||||
|
|
||||||
timer.Enabled = true;
|
timer.Enabled = true;
|
||||||
|
|
||||||
|
if (startMinMenuItem.Checked) {
|
||||||
|
if (minTrayMenuItem.Checked) {
|
||||||
|
notifyIcon.Visible = true;
|
||||||
|
} else {
|
||||||
|
WindowState = FormWindowState.Minimized;
|
||||||
|
Show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HardwareAdded(IHardware hardware) {
|
private void HardwareAdded(IHardware hardware) {
|
||||||
@@ -238,6 +250,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
Config.Set(maxMenuItem.Name, maxMenuItem.Checked);
|
Config.Set(maxMenuItem.Name, maxMenuItem.Checked);
|
||||||
Config.Set(limitMenuItem.Name, limitMenuItem.Checked);
|
Config.Set(limitMenuItem.Name, limitMenuItem.Checked);
|
||||||
|
|
||||||
|
Config.Set(startMinMenuItem.Name, startMinMenuItem.Checked);
|
||||||
Config.Set(minTrayMenuItem.Name, minTrayMenuItem.Checked);
|
Config.Set(minTrayMenuItem.Name, minTrayMenuItem.Checked);
|
||||||
Config.Set(hddMenuItem.Name, hddMenuItem.Checked);
|
Config.Set(hddMenuItem.Name, hddMenuItem.Checked);
|
||||||
|
|
||||||
@@ -346,13 +359,13 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleSysTray() {
|
private void ToggleSysTray() {
|
||||||
if (Visible) {
|
if (notifyIcon.Visible) {
|
||||||
notifyIcon.Visible = true;
|
|
||||||
Visible = false;
|
|
||||||
} else {
|
|
||||||
Visible = true;
|
Visible = true;
|
||||||
notifyIcon.Visible = false;
|
notifyIcon.Visible = false;
|
||||||
Activate();
|
Activate();
|
||||||
|
} else {
|
||||||
|
notifyIcon.Visible = true;
|
||||||
|
Visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,6 +395,5 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
|
|
||||||
sensorSystemTray.Remove(sensor);
|
sensorSystemTray.Remove(sensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
Program.cs
11
Program.cs
@@ -51,12 +51,21 @@ namespace OpenHardwareMonitor {
|
|||||||
#endif
|
#endif
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
Application.Run(new GUI.MainForm());
|
|
||||||
|
using (GUI.MainForm form = new GUI.MainForm()) {
|
||||||
|
form.FormClosed += delegate(Object sender, FormClosedEventArgs e) {
|
||||||
|
Application.Exit();
|
||||||
|
};
|
||||||
|
Application.Run();
|
||||||
|
}
|
||||||
|
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Utilities.CrashReport.Save(e);
|
Utilities.CrashReport.Save(e);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user