# HG changeset patch # User moel.mich # Date 1300313426 0 # Node ID 8731a1b8130186fa15e7d939c9418573a935013f # Parent ddb02fd788ec2dce71997dbe17a8a3afbafd18e3 Fixed Issue 179. diff -r ddb02fd788ec -r 8731a1b81301 GUI/MainForm.Designer.cs --- a/GUI/MainForm.Designer.cs Tue Mar 15 22:00:31 2011 +0000 +++ b/GUI/MainForm.Designer.cs Wed Mar 16 22:10:26 2011 +0000 @@ -108,6 +108,8 @@ this.splitContainer = new OpenHardwareMonitor.GUI.SplitContainerAdv(); this.treeView = new Aga.Controls.Tree.TreeViewAdv(); this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel(); + this.resetMenuItem = new System.Windows.Forms.MenuItem(); + this.menuItem6 = new System.Windows.Forms.MenuItem(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); this.splitContainer.SuspendLayout(); @@ -203,6 +205,8 @@ this.saveReportMenuItem, this.sumbitReportMenuItem, this.MenuItem2, + this.resetMenuItem, + this.menuItem6, this.exitMenuItem}); this.fileMenuItem.Text = "File"; // @@ -225,7 +229,7 @@ // // exitMenuItem // - this.exitMenuItem.Index = 3; + this.exitMenuItem.Index = 5; this.exitMenuItem.Text = "Exit"; this.exitMenuItem.Click += new System.EventHandler(this.exitClick); // @@ -436,7 +440,7 @@ this.treeView.NodeControls.Add(this.nodeTextBoxText); this.treeView.NodeControls.Add(this.nodeTextBoxValue); this.treeView.NodeControls.Add(this.nodeTextBoxMin); - this.treeView.NodeControls.Add(this.nodeTextBoxMax); + this.treeView.NodeControls.Add(this.nodeTextBoxMax); this.treeView.SelectedNode = null; this.treeView.Size = new System.Drawing.Size(386, 354); this.treeView.TabIndex = 0; @@ -453,6 +457,17 @@ this.plotPanel.Size = new System.Drawing.Size(386, 124); this.plotPanel.TabIndex = 0; // + // resetMenuItem + // + this.resetMenuItem.Index = 3; + this.resetMenuItem.Text = "Reset"; + this.resetMenuItem.Click += new System.EventHandler(this.resetClick); + // + // menuItem6 + // + this.menuItem6.Index = 4; + this.menuItem6.Text = "-"; + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -523,6 +538,8 @@ private System.Windows.Forms.MenuItem MenuItem3; private System.Windows.Forms.MenuItem gadgetMenuItem; private System.Windows.Forms.MenuItem minCloseMenuItem; + private System.Windows.Forms.MenuItem resetMenuItem; + private System.Windows.Forms.MenuItem menuItem6; } } diff -r ddb02fd788ec -r 8731a1b81301 GUI/MainForm.cs --- a/GUI/MainForm.cs Tue Mar 15 22:00:31 2011 +0000 +++ b/GUI/MainForm.cs Wed Mar 16 22:10:26 2011 +0000 @@ -388,9 +388,10 @@ Visible = false; SaveConfiguration(); - timer.Enabled = false; - systemTray.Dispose(); + systemTray.IsMainIconEnabled = false; + timer.Enabled = false; computer.Close(); + systemTray.Dispose(); } private void aboutMenuItem_Click(object sender, EventArgs e) { @@ -593,5 +594,15 @@ settings.SetValue("mainForm.Height", Bounds.Height); } } + + private void resetClick(object sender, EventArgs e) { + // disable the fallback MainIcon during reset, otherwise icon visibility + // might be lost + systemTray.IsMainIconEnabled = false; + computer.Close(); + computer.Open(); + // restore the MainIcon setting + systemTray.IsMainIconEnabled = minimizeToTray.Value; + } } } diff -r ddb02fd788ec -r 8731a1b81301 Hardware/Computer.cs --- a/Hardware/Computer.cs Tue Mar 15 22:00:31 2011 +0000 +++ b/Hardware/Computer.cs Wed Mar 16 22:10:26 2011 +0000 @@ -268,9 +268,11 @@ if (!open) return; - foreach (IGroup group in groups) - group.Close(); - groups.Clear(); + while (groups.Count > 0) { + IGroup group = groups[groups.Count - 1]; + Remove(group); + group.Close(); + } Opcode.Close(); Ring0.Close();