1.1 --- a/GUI/TypeNode.cs Sun May 09 16:22:13 2010 +0000
1.2 +++ b/GUI/TypeNode.cs Fri May 14 22:30:06 2010 +0000
1.3 @@ -37,14 +37,12 @@
1.4
1.5 using System;
1.6 using System.Collections.Generic;
1.7 -using Aga.Controls.Tree;
1.8 using OpenHardwareMonitor.Hardware;
1.9
1.10 namespace OpenHardwareMonitor.GUI {
1.11 public class TypeNode : Node {
1.12
1.13 private SensorType sensorType;
1.14 - private bool visible = true;
1.15
1.16 public TypeNode(SensorType sensorType) : base() {
1.17 this.sensorType = sensorType;
1.18 @@ -75,16 +73,32 @@
1.19 this.Text = "Flows";
1.20 break;
1.21 }
1.22 +
1.23 + NodeAdded += new NodeEventHandler(TypeNode_NodeAdded);
1.24 + NodeRemoved += new NodeEventHandler(TypeNode_NodeRemoved);
1.25 + }
1.26 +
1.27 + private void TypeNode_NodeRemoved(Node node) {
1.28 + node.IsVisibleChanged -= new NodeEventHandler(node_IsVisibleChanged);
1.29 + node_IsVisibleChanged(null);
1.30 + }
1.31 +
1.32 + private void TypeNode_NodeAdded(Node node) {
1.33 + node.IsVisibleChanged += new NodeEventHandler(node_IsVisibleChanged);
1.34 + node_IsVisibleChanged(null);
1.35 + }
1.36 +
1.37 + private void node_IsVisibleChanged(Node node) {
1.38 + foreach (Node n in Nodes)
1.39 + if (n.IsVisible) {
1.40 + this.IsVisible = true;
1.41 + return;
1.42 + }
1.43 + this.IsVisible = false;
1.44 }
1.45
1.46 public SensorType SensorType {
1.47 get { return sensorType; }
1.48 }
1.49 -
1.50 - public bool IsVisible {
1.51 - get { return visible; }
1.52 - set { visible = value; }
1.53 - }
1.54 -
1.55 }
1.56 }