Fixed Issue 179.
authormoel.mich
Wed, 16 Mar 2011 22:10:26 +0000
changeset 2628731a1b81301
parent 261 ddb02fd788ec
child 263 575f8d4c378d
Fixed Issue 179.
GUI/MainForm.Designer.cs
GUI/MainForm.cs
Hardware/Computer.cs
     1.1 --- a/GUI/MainForm.Designer.cs	Tue Mar 15 22:00:31 2011 +0000
     1.2 +++ b/GUI/MainForm.Designer.cs	Wed Mar 16 22:10:26 2011 +0000
     1.3 @@ -108,6 +108,8 @@
     1.4        this.splitContainer = new OpenHardwareMonitor.GUI.SplitContainerAdv();
     1.5        this.treeView = new Aga.Controls.Tree.TreeViewAdv();
     1.6        this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
     1.7 +      this.resetMenuItem = new System.Windows.Forms.MenuItem();
     1.8 +      this.menuItem6 = new System.Windows.Forms.MenuItem();
     1.9        this.splitContainer.Panel1.SuspendLayout();
    1.10        this.splitContainer.Panel2.SuspendLayout();
    1.11        this.splitContainer.SuspendLayout();
    1.12 @@ -203,6 +205,8 @@
    1.13              this.saveReportMenuItem,
    1.14              this.sumbitReportMenuItem,
    1.15              this.MenuItem2,
    1.16 +            this.resetMenuItem,
    1.17 +            this.menuItem6,
    1.18              this.exitMenuItem});
    1.19        this.fileMenuItem.Text = "File";
    1.20        // 
    1.21 @@ -225,7 +229,7 @@
    1.22        // 
    1.23        // exitMenuItem
    1.24        // 
    1.25 -      this.exitMenuItem.Index = 3;
    1.26 +      this.exitMenuItem.Index = 5;
    1.27        this.exitMenuItem.Text = "Exit";
    1.28        this.exitMenuItem.Click += new System.EventHandler(this.exitClick);
    1.29        // 
    1.30 @@ -436,7 +440,7 @@
    1.31        this.treeView.NodeControls.Add(this.nodeTextBoxText);
    1.32        this.treeView.NodeControls.Add(this.nodeTextBoxValue);
    1.33        this.treeView.NodeControls.Add(this.nodeTextBoxMin);
    1.34 -      this.treeView.NodeControls.Add(this.nodeTextBoxMax);      
    1.35 +      this.treeView.NodeControls.Add(this.nodeTextBoxMax);
    1.36        this.treeView.SelectedNode = null;
    1.37        this.treeView.Size = new System.Drawing.Size(386, 354);
    1.38        this.treeView.TabIndex = 0;
    1.39 @@ -453,6 +457,17 @@
    1.40        this.plotPanel.Size = new System.Drawing.Size(386, 124);
    1.41        this.plotPanel.TabIndex = 0;
    1.42        // 
    1.43 +      // resetMenuItem
    1.44 +      // 
    1.45 +      this.resetMenuItem.Index = 3;
    1.46 +      this.resetMenuItem.Text = "Reset";
    1.47 +      this.resetMenuItem.Click += new System.EventHandler(this.resetClick);
    1.48 +      // 
    1.49 +      // menuItem6
    1.50 +      // 
    1.51 +      this.menuItem6.Index = 4;
    1.52 +      this.menuItem6.Text = "-";
    1.53 +      // 
    1.54        // MainForm
    1.55        // 
    1.56        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    1.57 @@ -523,6 +538,8 @@
    1.58      private System.Windows.Forms.MenuItem MenuItem3;
    1.59      private System.Windows.Forms.MenuItem gadgetMenuItem;
    1.60      private System.Windows.Forms.MenuItem minCloseMenuItem;
    1.61 +    private System.Windows.Forms.MenuItem resetMenuItem;
    1.62 +    private System.Windows.Forms.MenuItem menuItem6;
    1.63    }
    1.64  }
    1.65  
     2.1 --- a/GUI/MainForm.cs	Tue Mar 15 22:00:31 2011 +0000
     2.2 +++ b/GUI/MainForm.cs	Wed Mar 16 22:10:26 2011 +0000
     2.3 @@ -388,9 +388,10 @@
     2.4        Visible = false;
     2.5        SaveConfiguration();
     2.6  
     2.7 -      timer.Enabled = false;
     2.8 -      systemTray.Dispose();      
     2.9 +      systemTray.IsMainIconEnabled = false;
    2.10 +      timer.Enabled = false;            
    2.11        computer.Close();
    2.12 +      systemTray.Dispose();
    2.13      }
    2.14  
    2.15      private void aboutMenuItem_Click(object sender, EventArgs e) {
    2.16 @@ -593,5 +594,15 @@
    2.17          settings.SetValue("mainForm.Height", Bounds.Height);
    2.18        }
    2.19      }
    2.20 +
    2.21 +    private void resetClick(object sender, EventArgs e) {
    2.22 +      // disable the fallback MainIcon during reset, otherwise icon visibility
    2.23 +      // might be lost 
    2.24 +      systemTray.IsMainIconEnabled = false;
    2.25 +      computer.Close();
    2.26 +      computer.Open();
    2.27 +      // restore the MainIcon setting
    2.28 +      systemTray.IsMainIconEnabled = minimizeToTray.Value;
    2.29 +    }
    2.30    }
    2.31  }
     3.1 --- a/Hardware/Computer.cs	Tue Mar 15 22:00:31 2011 +0000
     3.2 +++ b/Hardware/Computer.cs	Wed Mar 16 22:10:26 2011 +0000
     3.3 @@ -268,9 +268,11 @@
     3.4        if (!open)
     3.5          return;
     3.6  
     3.7 -      foreach (IGroup group in groups)
     3.8 -        group.Close();
     3.9 -      groups.Clear();
    3.10 +      while (groups.Count > 0) {
    3.11 +        IGroup group = groups[groups.Count - 1];
    3.12 +        Remove(group);
    3.13 +        group.Close(); 
    3.14 +      } 
    3.15  
    3.16        Opcode.Close();
    3.17        Ring0.Close();