Ejemplo n.º 1
0
        public void AddSensorNode(SensorNode item)
        {
            if (this.ContainsSensor(item.Sensor))
            {
                return;
            }

            OverviewItem oi = null;

            if (item.Sensor.SensorType == SensorType.Temperature)
            {
                oi = new TemperatureOverviewItem(item, this);
                tempsBoxLayout.Controls.Add(oi);
            }
            else if (item.Sensor.SensorType == SensorType.Fan)
            {
                oi = new FanOverviewItem(item, this);
                fanBoxLayout.Controls.Add(oi);
            }
            else
            {
                oi = new OtherOverviewItem(item, this);
                otherBoxLayout.Controls.Add(oi);
            }
            if (oi != null)
            {
                items.Add(oi);
            }
        }
Ejemplo n.º 2
0
 private void SensorRemoved(ISensor sensor)
 {
     foreach (TypeNode typeNode in typeNodes)
     {
         if (typeNode.SensorType == sensor.SensorType)
         {
             SensorNode sensorNode = null;
             foreach (Node node in typeNode.Nodes)
             {
                 SensorNode n = node as SensorNode;
                 if (n != null && n.Sensor == sensor)
                 {
                     sensorNode = n;
                 }
             }
             if (sensorNode != null)
             {
                 sensorNode.PlotSelectionChanged     -= SensorPlotSelectionChanged;
                 sensorNode.OverviewSelectionChanged -= SensorOverviewSelectionChanged;
                 typeNode.Nodes.Remove(sensorNode);
                 UpdateNode(typeNode);
             }
         }
     }
     if (PlotSelectionChanged != null)
     {
         PlotSelectionChanged(this, null);
     }
     if (OverviewSelectionChanged != null)
     {
         OverviewSelectionChanged(this, null);
     }
 }
Ejemplo n.º 3
0
        //private ProgressBar bar;

        public TemperatureOverviewItem(SensorNode sens, Overview overview) : base(sens, overview)
        {
            this.Controls.Add(nameLabel);
            nameLabel.Location = new Point(0, 0);
            nameLabel.AutoSize = true;

            this.Controls.Add(valueLabel);
            valueLabel.Location  = new Point(100, 0);
            valueLabel.AutoSize  = true;
            valueLabel.Font      = new Font(FontFamily.GenericMonospace, 10);
            valueLabel.BackColor = Color.Black;
            valueLabel.ForeColor = Color.LightGreen;

            // Progress bar Damelei

            /*bar = new ProgressBar();
             *
             *
             * this.Controls.Add(bar);
             * bar.Location = new Point(170, 3);
             * bar.Height = 10;
             * bar.Width = 150;*/

            this.Height = 17;
            //this.Width = 340;
            this.Width = 250;
        }
Ejemplo n.º 4
0
        public FanOverviewItem(SensorNode sens, Overview overview) : base(sens, overview)
        {
            this.Controls.Add(nameLabel);
            nameLabel.Location = new Point(0, 3);
            nameLabel.AutoSize = true;

            this.Controls.Add(valueLabel);
            valueLabel.Location  = new Point(100, 3);
            valueLabel.AutoSize  = true;
            valueLabel.Font      = new Font(FontFamily.GenericMonospace, 10);
            valueLabel.BackColor = Color.Black;
            valueLabel.ForeColor = Color.LightGreen;


            if (sens.Sensor.Affector != null)
            {
                controller.Minimum = 0;
                controller.Maximum = 100;
                if (sens.Sensor.Affector.Value.HasValue)
                {
                    controller.Value = (sens.Sensor.Affector.Control.UseCalibrated)
                        ? ((int)(sens.Sensor.Affector.Control.Calibrated.Get(sens.Sensor.Affector.Value.Value / 100f * sens.Sensor.Affector.Control.MaxRPM)))
                        : ((int)(sens.Sensor.Affector.Value));
                }
                this.Controls.Add(controller);
                controller.Location      = new Point(180, 0);
                controller.Width         = 50;
                controller.ValueChanged += new System.EventHandler(this.controller_ValueChanged);

                UpdateControllerToolTip();
            }

            this.Height = 20;
            this.Width  = 250;
        }
Ejemplo n.º 5
0
 public OverviewItem(SensorNode sens, Overview overview)
 {
     this.sensorNode      = sens;
     this.nameLabel       = new Label();
     this.nameLabel.Text  = sensorNode.Sensor.Name;
     this.valueLabel      = new Label();
     this.valueLabel.Text = sensorNode.ValueToString(sensorNode.Sensor.Value);
     this.overview        = overview;
 }
Ejemplo n.º 6
0
        private void InsertSorted(Node node, ISensor sensor)
        {
            int i = 0;

            while (i < node.Nodes.Count &&
                   ((SensorNode)node.Nodes[i]).Sensor.Index < sensor.Index)
            {
                i++;
            }
            SensorNode sensorNode = new SensorNode(sensor, settings, unitManager);

            sensorNode.PlotSelectionChanged     += SensorPlotSelectionChanged;
            sensorNode.OverviewSelectionChanged += SensorOverviewSelectionChanged;
            node.Nodes.Insert(i, sensorNode);
        }
Ejemplo n.º 7
0
        public override bool Equals(System.Object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            SensorNode s = obj as SensorNode;

            if (s == null)
            {
                return(false);
            }

            return(sensor == s.sensor);
        }