Exemple #1
0
        public void UpdateUI()
        {
            this.Panel.Children.Clear();
            this.Panel.RowDefinitions.Clear();

            Sensor[] sensors = SensorManager.getAllSensors();
            int      col     = 0;
            int      row     = 0;

            foreach (Sensor s in sensors)
            {
                SensorComposite sComposite = new SensorComposite(s);
                this.Panel.Children.Add(sComposite);
                Grid.SetColumn(sComposite, col);
                Grid.SetRow(sComposite, row);
                col++;
                if (col == Panel.ColumnDefinitions.Count)
                {
                    RowDefinition rDef = new RowDefinition();
                    this.Panel.RowDefinitions.Add(new RowDefinition());
                    this.Panel.Height = (sComposite.Height) * row;
                    row++;
                    col = 0;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Updates the current Sensors in viewspace.
        /// </summary>
        internal void update()
        {
            this.pnlSensorContainer.Controls.Clear();
            Sensor[] sens        = SensorManager.getAllSensors();
            int      i           = 0;
            int      leftOffset  = 0;
            int      topOffset   = 0;
            int      rightOffset = 250;

            foreach (Sensor s in sens)
            {
                SensorComposite sensor = new SensorComposite(s);
                s.connect();
                sensor.Top  = topOffset;
                sensor.Left = leftOffset + (i * (sensor.Width + 20));
                this.pnlSensorContainer.Controls.Add(sensor);
                i++;
                if (i * (sensor.Width + 20) > (this.Width - rightOffset))
                {
                    leftOffset = 0;
                    topOffset += sensor.Height + 20;
                    i          = 0;
                }
            }
        }