mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-31 14:25:16 +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.plotMenuItem = 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.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.hddMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -101,12 +102,12 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.timer = new System.Windows.Forms.Timer(this.components);
|
||||
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
|
||||
this.notifyContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.restoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
|
||||
this.columnsContextMenuStrip.SuspendLayout();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.splitContainer.Panel1.SuspendLayout();
|
||||
@@ -411,6 +412,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
// optionsToolStripMenuItem
|
||||
//
|
||||
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.startMinMenuItem,
|
||||
this.minTrayMenuItem,
|
||||
this.toolStripMenuItem3,
|
||||
this.hddMenuItem});
|
||||
@@ -418,6 +420,13 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
||||
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
|
||||
//
|
||||
this.minTrayMenuItem.Checked = true;
|
||||
@@ -480,6 +489,16 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.splitContainer.SplitterWidth = 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
|
||||
//
|
||||
this.notifyContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@@ -514,16 +533,6 @@ namespace OpenHardwareMonitor.GUI {
|
||||
this.sensorContextMenuStrip.Name = "sensorContextMenuStrip";
|
||||
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
|
||||
//
|
||||
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.ToolStripSeparator toolStripMenuItem3;
|
||||
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);
|
||||
limitMenuItem.Checked = Config.Get(limitMenuItem.Name, false);
|
||||
|
||||
startMinMenuItem.Checked = Config.Get(startMinMenuItem.Name, false);
|
||||
minTrayMenuItem.Checked = Config.Get(minTrayMenuItem.Name, true);
|
||||
hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true);
|
||||
|
||||
@@ -143,7 +144,18 @@ namespace OpenHardwareMonitor.GUI {
|
||||
tempMenuItem.Checked = Config.Get(tempMenuItem.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) {
|
||||
@@ -238,6 +250,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
Config.Set(maxMenuItem.Name, maxMenuItem.Checked);
|
||||
Config.Set(limitMenuItem.Name, limitMenuItem.Checked);
|
||||
|
||||
Config.Set(startMinMenuItem.Name, startMinMenuItem.Checked);
|
||||
Config.Set(minTrayMenuItem.Name, minTrayMenuItem.Checked);
|
||||
Config.Set(hddMenuItem.Name, hddMenuItem.Checked);
|
||||
|
||||
@@ -346,13 +359,13 @@ namespace OpenHardwareMonitor.GUI {
|
||||
}
|
||||
|
||||
private void ToggleSysTray() {
|
||||
if (Visible) {
|
||||
notifyIcon.Visible = true;
|
||||
Visible = false;
|
||||
} else {
|
||||
if (notifyIcon.Visible) {
|
||||
Visible = true;
|
||||
notifyIcon.Visible = false;
|
||||
Activate();
|
||||
Activate();
|
||||
} else {
|
||||
notifyIcon.Visible = true;
|
||||
Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,6 +395,5 @@ namespace OpenHardwareMonitor.GUI {
|
||||
|
||||
sensorSystemTray.Remove(sensor);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
11
Program.cs
11
Program.cs
@@ -51,12 +51,21 @@ namespace OpenHardwareMonitor {
|
||||
#endif
|
||||
Application.EnableVisualStyles();
|
||||
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
|
||||
} catch (Exception e) {
|
||||
Utilities.CrashReport.Save(e);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user