Updated the version.
3 This Source Code Form is subject to the terms of the Mozilla Public
4 License, v. 2.0. If a copy of the MPL was not distributed with this
5 file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
12 using System.Collections.Generic;
13 using OpenHardwareMonitor.Hardware;
15 namespace OpenHardwareMonitor.GUI {
16 public class TypeNode : Node {
18 private SensorType sensorType;
20 public TypeNode(SensorType sensorType) : base() {
21 this.sensorType = sensorType;
24 case SensorType.Voltage:
25 this.Image = Utilities.EmbeddedResources.GetImage("voltage.png");
26 this.Text = "Voltages";
28 case SensorType.Clock:
29 this.Image = Utilities.EmbeddedResources.GetImage("clock.png");
33 this.Image = Utilities.EmbeddedResources.GetImage("load.png");
36 case SensorType.Temperature:
37 this.Image = Utilities.EmbeddedResources.GetImage("temperature.png");
38 this.Text = "Temperatures";
41 this.Image = Utilities.EmbeddedResources.GetImage("fan.png");
45 this.Image = Utilities.EmbeddedResources.GetImage("flow.png");
48 case SensorType.Control:
49 this.Image = Utilities.EmbeddedResources.GetImage("control.png");
50 this.Text = "Controls";
52 case SensorType.Level:
53 this.Image = Utilities.EmbeddedResources.GetImage("level.png");
56 case SensorType.Power:
57 this.Image = Utilities.EmbeddedResources.GetImage("power.png");
61 this.Image = Utilities.EmbeddedResources.GetImage("data.png");
64 case SensorType.Factor:
65 this.Image = Utilities.EmbeddedResources.GetImage("factor.png");
66 this.Text = "Factors";
70 NodeAdded += new NodeEventHandler(TypeNode_NodeAdded);
71 NodeRemoved += new NodeEventHandler(TypeNode_NodeRemoved);
74 private void TypeNode_NodeRemoved(Node node) {
75 node.IsVisibleChanged -= new NodeEventHandler(node_IsVisibleChanged);
76 node_IsVisibleChanged(null);
79 private void TypeNode_NodeAdded(Node node) {
80 node.IsVisibleChanged += new NodeEventHandler(node_IsVisibleChanged);
81 node_IsVisibleChanged(null);
84 private void node_IsVisibleChanged(Node node) {
85 foreach (Node n in Nodes)
87 this.IsVisible = true;
90 this.IsVisible = false;
93 public SensorType SensorType {
94 get { return sensorType; }