Esempio n. 1
0
        public SensorDisplay(int sensorType, int index, int totalIndex, int minValue, int maxValue, int scale, Color[] color)
        {
            SensorType      = sensorType;
            Index           = index;
            this.totalIndex = totalIndex;

            string[] vAxisLabel     = new string[scale + 1];
            var      resourceLoader = ResourceLoader.GetForCurrentView();

            StackPanelSensor.Children.Clear();

            expanderProperty.Content     = scrollViewerProperty;
            scrollViewerProperty.Content = StackPanelProperty;
            expanderPLD.Content          = scrollViewerPLD;
            scrollViewerPLD.Content      = stackPanelPLD;

            for (int i = 0; i <= scale; i++)
            {
                if (sensorType == Sensor.ACTIVITYSENSOR)
                {
                    if (i < 2)
                    {
                        vAxisLabel[i] = ((ActivitySensorReadingConfidence)i).ToString();
                    }
                    else
                    {
                        vAxisLabel[i] = "None";
                    }
                }
                else if (sensorType == Sensor.SIMPLEORIENTATIONSENSOR)
                {
                    vAxisLabel[i] = ((SimpleOrientation)(maxValue - i)).ToString().Replace("DegreesCounterclockwise", "°↺");
                }
                else
                {
                    vAxisLabel[i] = (maxValue - Convert.ToDouble(i) / scale * (maxValue - minValue)).ToString();
                }
            }

            PlotCanvas = new PlotCanvas(minValue, maxValue, color, canvasSensor, vAxisLabel);
            stackPanelSwitch.Children.Add(buttonSensor);

            if (sensorType == Sensor.ACCELEROMETER || sensorType == Sensor.ACCELEROMETERGRAVITY || sensorType == Sensor.ACCELEROMETERLINEAR)
            {
                Grid gridAccelerometer = new Grid();
                gridAccelerometer.Children.Add(new Ellipse()
                {
                    Width = 100, Height = 100, Stroke = new SolidColorBrush(Colors.Black), StrokeThickness = 5
                });
                gridAccelerometer.Children.Add(new Ellipse()
                {
                    Width = 50, Height = 50, Stroke = new SolidColorBrush(Colors.Black), StrokeThickness = 5
                });
                gridAccelerometer.Children.Add(ellipseAccelerometer);
                StackPanelTop.Children.Add(gridAccelerometer);
            }
            else if (sensorType == Sensor.COMPASS)
            {
                StackPanelTop.Children.Add(imageCompass);
            }
            else if (sensorType == Sensor.GYROMETER)
            {
                StackPanel stackPanelX = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                stackPanelX.Children.Add(imageGyrometerX);
                stackPanelX.Children.Add(new TextBlock()
                {
                    Text = "X", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanel stackPanelY = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                stackPanelY.Children.Add(imageGyrometerY);
                stackPanelY.Children.Add(new TextBlock()
                {
                    Text = "Y", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanel stackPanelZ = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                stackPanelZ.Children.Add(imageGyrometerZ);
                stackPanelZ.Children.Add(new TextBlock()
                {
                    Text = "Z", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanelTop.Children.Add(stackPanelX);
                StackPanelTop.Children.Add(stackPanelY);
                StackPanelTop.Children.Add(stackPanelZ);
            }
            else if (sensorType == Sensor.INCLINOMETER)
            {
                StackPanel stackPanelX = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                stackPanelX.Children.Add(imageInclinometerPitch);
                stackPanelX.Children.Add(new TextBlock()
                {
                    Text = "Pitch", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanel stackPanelY = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                stackPanelY.Children.Add(imageInclinometerRoll);
                stackPanelY.Children.Add(new TextBlock()
                {
                    Text = "Roll", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanel stackPanelZ = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                stackPanelZ.Children.Add(imageInclinometerYaw);
                stackPanelZ.Children.Add(new TextBlock()
                {
                    Text = "Yaw", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanelTop.Children.Add(stackPanelX);
                StackPanelTop.Children.Add(stackPanelY);
                StackPanelTop.Children.Add(stackPanelZ);
            }
            else if (sensorType == Sensor.ACTIVITYSENSOR || sensorType == Sensor.LIGHTSENSOR || sensorType == Sensor.PEDOMETER || sensorType == Sensor.PROXIMITYSENSOR)
            {
                StackPanelTop.Children.Add(textBlockSensor);
            }
            else
            {
                StackPanelTop.Height = 0;
            }

            textBlockProperty = new TextBlock[color.Length + 1];
            textBlockValue    = new TextBlock[textBlockProperty.Length];
            textBlockMinValue = new TextBlock[textBlockProperty.Length];
            textBlockMaxValue = new TextBlock[textBlockProperty.Length];

            textBlockProperty[color.Length] = new TextBlock()
            {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center
            };
            stackPanelDataName.Children.Add(textBlockProperty[color.Length]);

            textBlockValue[color.Length] = new TextBlock()
            {
                Text = resourceLoader.GetString("Value"), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center
            };
            stackPanelValue.Children.Add(textBlockValue[color.Length]);

            textBlockMinValue[color.Length] = new TextBlock()
            {
                Text = resourceLoader.GetString("Min"), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center
            };
            stackPanelMinValue.Children.Add(textBlockMinValue[color.Length]);

            textBlockMaxValue[color.Length] = new TextBlock()
            {
                Text = resourceLoader.GetString("Max"), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center
            };
            stackPanelMaxValue.Children.Add(textBlockMaxValue[color.Length]);

            for (int i = 0; i < color.Length; i++)
            {
                textBlockProperty[i] = new TextBlock()
                {
                    HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center
                };
                textBlockProperty[i].Foreground = new SolidColorBrush(color[i]);
                stackPanelDataName.Children.Add(textBlockProperty[i]);

                textBlockValue[i] = new TextBlock()
                {
                    HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center
                };
                textBlockValue[i].Foreground = new SolidColorBrush(color[i]);
                stackPanelValue.Children.Add(textBlockValue[i]);

                textBlockMinValue[i] = new TextBlock()
                {
                    HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center
                };
                textBlockMinValue[i].Foreground = new SolidColorBrush(color[i]);
                stackPanelMinValue.Children.Add(textBlockMinValue[i]);

                textBlockMaxValue[i] = new TextBlock()
                {
                    HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center
                };
                textBlockMaxValue[i].Foreground = new SolidColorBrush(color[i]);
                stackPanelMaxValue.Children.Add(textBlockMaxValue[i]);
            }

            stackPanelExpander.Children.Add(expanderProperty);
            stackPanelExpander.Children.Add(expanderPLD);
            stackPanelBottom.Children.Add(stackPanelExpander);

            if (sensorType == Sensor.LIGHTSENSOR)
            {
                stackPanelBottomData.Children.Add(stackPanelDataName);
                stackPanelBottomData.Children.Add(stackPanelValue);
                stackPanelBottomData.Children.Add(stackPanelMinValue);
                stackPanelBottomData.Children.Add(stackPanelMaxValue);

                stackPanelBottomRightCol.Children.Add(stackPanelBottomData);
                stackPanelBottom.Children.Add(stackPanelBottomRightCol);
            }
            else
            {
                stackPanelBottom.Children.Add(stackPanelDataName);
                stackPanelBottom.Children.Add(stackPanelValue);
                stackPanelBottom.Children.Add(stackPanelMinValue);
                stackPanelBottom.Children.Add(stackPanelMaxValue);
            }

            textBlockPropertyName  = new TextBlock[properties.Length];
            textBlockPropertyValue = new TextBlock[textBlockPropertyName.Length];

            for (int i = 0; i < properties.Length; i++)
            {
                textBlockPropertyName[i] = new TextBlock()
                {
                    Text = properties[i], HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center
                };
                textBlockPropertyValue[i] = new TextBlock()
                {
                    Text = (i == 0 ? "\r\n" : "") + "        -", HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center
                };
                stackPanelPropertyName.Children.Add(textBlockPropertyName[i]);

                if (i == 0)
                {
                    textBlockPropertyName[i].Height  = 60;
                    textBlockPropertyValue[i].Height = 60;
                    buttonReportInterval.Click      += Scenario1View.Scenario1.ReportIntervalButton;
                    StackPanel stackPanelReportInterval = new StackPanel();
                    stackPanelReportInterval.Orientation = Orientation.Horizontal;
                    stackPanelReportInterval.Children.Add(textBlockPropertyValue[i]);
                    stackPanelReportInterval.Children.Add(TextboxReportInterval);
                    stackPanelReportInterval.Children.Add(buttonReportInterval);
                    stackPanelPropertyValue.Children.Add(stackPanelReportInterval);
                }
                else
                {
                    stackPanelPropertyValue.Children.Add(textBlockPropertyValue[i]);
                }
            }

            StackPanelProperty.Children.Add(stackPanelPropertyName);
            StackPanelProperty.Children.Add(stackPanelPropertyValue);

            textBlockPLDName  = new TextBlock[pld.Length];
            textBlockPLDValue = new TextBlock[textBlockPLDName.Length];

            for (int i = 0; i < pld.Length; i++)
            {
                textBlockPLDName[i] = new TextBlock()
                {
                    Text = pld[i], HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center
                };
                textBlockPLDValue[i] = new TextBlock()
                {
                    Text = (i == 0 ? "\r\n" : "") + "        -", HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center
                };
                stackPanelPLDName.Children.Add(textBlockPLDName[i]);
                stackPanelPLDValue.Children.Add(textBlockPLDValue[i]);
            }

            stackPanelPLD.Children.Add(stackPanelPLDName);
            stackPanelPLD.Children.Add(stackPanelPLDValue);

            StackPanelSensor.Children.Add(StackPanelTop);
            StackPanelSensor.Children.Add(canvasSensor);
            StackPanelSensor.Children.Add(stackPanelBottom);
        }
Esempio n. 2
0
        public SensorDisplay(int sensorType, int index, int totalIndex, string name, int minValue, int maxValue, int scale, Color[] color)
        {
            var resourceLoader = ResourceLoader.GetForCurrentView();

            StackPanelSensor.Children.Clear();

            _sensorType = sensorType;
            _index      = index;
            _totalIndex = totalIndex;
            _name       = name;

            string[] vAxisLabel = new string[scale + 1];

            for (int i = 0; i <= scale; i++)
            {
                if (sensorType == Sensor.ACTIVITYSENSOR)
                {
                    if (i < 2)
                    {
                        vAxisLabel[i] = ((ActivitySensorReadingConfidence)i).ToString();
                    }
                    else
                    {
                        vAxisLabel[i] = "None";
                    }
                }
                else if (sensorType == Sensor.SIMPLEORIENTATIONSENSOR)
                {
                    vAxisLabel[i] = ((SimpleOrientation)(maxValue - i)).ToString().Replace("DegreesCounterclockwise", "°↺");
                }
                else
                {
                    vAxisLabel[i] = (maxValue - Convert.ToDouble(i) / scale * (maxValue - minValue)).ToString();
                }
            }

            _plotCanvas = new PlotCanvas(minValue, maxValue, color, CanvasSensor, vAxisLabel);

            StackPanelSwitch.Children.Add(ButtonSensor);

            StackPanelSensor.Margin = new Thickness()
            {
                Right = 18, Bottom = 20, Top = 0
            };
            StackPanelSensor.Orientation = Orientation.Vertical;
            StackPanelSensor.Visibility  = Visibility.Collapsed;

            StackPanelTop.Orientation         = Orientation.Horizontal;
            StackPanelTop.Height              = 100;
            StackPanelTop.HorizontalAlignment = HorizontalAlignment.Center;

            if (sensorType == Sensor.ACCELEROMETER || sensorType == Sensor.ACCELEROMETERLINEAR || sensorType == Sensor.ACCELEROMETERGRAVITY)
            {
                Grid GridAccelerometer = new Grid();
                GridAccelerometer.Children.Add(new Ellipse()
                {
                    Width = 100, Height = 100, Stroke = new SolidColorBrush(Colors.Black), StrokeThickness = 5
                });
                GridAccelerometer.Children.Add(new Ellipse()
                {
                    Width = 50, Height = 50, Stroke = new SolidColorBrush(Colors.Black), StrokeThickness = 5
                });
                GridAccelerometer.Children.Add(EllipseAccelerometer);
                StackPanelTop.Children.Add(GridAccelerometer);
            }
            else if (sensorType == Sensor.COMPASS)
            {
                StackPanelTop.Children.Add(ImageCompass);
            }
            else if (sensorType == Sensor.GYROMETER)
            {
                StackPanel StackPanelX = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                StackPanelX.Children.Add(ImageGyrometerX);
                StackPanelX.Children.Add(new TextBlock()
                {
                    Text = "X", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanel StackPanelY = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                StackPanelY.Children.Add(ImageGyrometerY);
                StackPanelY.Children.Add(new TextBlock()
                {
                    Text = "Y", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanel StackPanelZ = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                StackPanelZ.Children.Add(ImageGyrometerZ);
                StackPanelZ.Children.Add(new TextBlock()
                {
                    Text = "Z", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanelTop.Children.Add(StackPanelX);
                StackPanelTop.Children.Add(StackPanelY);
                StackPanelTop.Children.Add(StackPanelZ);
            }
            else if (sensorType == Sensor.INCLINOMETER)
            {
                StackPanel StackPanelX = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                StackPanelX.Children.Add(ImageInclinometerPitch);
                StackPanelX.Children.Add(new TextBlock()
                {
                    Text = "Pitch", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanel StackPanelY = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                StackPanelY.Children.Add(ImageInclinometerRoll);
                StackPanelY.Children.Add(new TextBlock()
                {
                    Text = "Roll", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanel StackPanelZ = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                StackPanelZ.Children.Add(ImageInclinometerYaw);
                StackPanelZ.Children.Add(new TextBlock()
                {
                    Text = "Yaw", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanelTop.Children.Add(StackPanelX);
                StackPanelTop.Children.Add(StackPanelY);
                StackPanelTop.Children.Add(StackPanelZ);
            }
            else if (sensorType == Sensor.ACTIVITYSENSOR || sensorType == Sensor.LIGHTSENSOR || sensorType == Sensor.PEDOMETER || sensorType == Sensor.PROXIMITYSENSOR)
            {
                StackPanelTop.Children.Add(TextBlockSensor);
            }
            else
            {
                StackPanelTop.Height = 0;
            }

            StackPanelBottom.Orientation = Orientation.Horizontal;

            StackPanelDataName.Orientation = Orientation.Vertical;
            StackPanelValue.Orientation    = Orientation.Vertical;
            StackPanelMinValue.Orientation = Orientation.Vertical;
            StackPanelMaxValue.Orientation = Orientation.Vertical;

            TextBlockProperty = new TextBlock[color.Length + 1];
            TextBlockValue    = new TextBlock[TextBlockProperty.Length];
            TextBlockMinValue = new TextBlock[TextBlockProperty.Length];
            TextBlockMaxValue = new TextBlock[TextBlockProperty.Length];

            TextBlockProperty[color.Length] = SetTextStyle("", HorizontalAlignment.Center);
            StackPanelDataName.Children.Add(TextBlockProperty[color.Length]);

            TextBlockValue[color.Length] = SetTextStyle(resourceLoader.GetString("Value"), HorizontalAlignment.Center);
            StackPanelValue.Children.Add(TextBlockValue[color.Length]);

            TextBlockMinValue[color.Length] = SetTextStyle(resourceLoader.GetString("Min"), HorizontalAlignment.Center);
            StackPanelMinValue.Children.Add(TextBlockMinValue[color.Length]);

            TextBlockMaxValue[color.Length] = SetTextStyle(resourceLoader.GetString("Max"), HorizontalAlignment.Center);
            StackPanelMaxValue.Children.Add(TextBlockMaxValue[color.Length]);

            for (int i = 0; i < color.Length; i++)
            {
                TextBlockProperty[i]            = SetTextStyle("", HorizontalAlignment.Left);
                TextBlockProperty[i].Foreground = new SolidColorBrush(color[i]);
                StackPanelDataName.Children.Add(TextBlockProperty[i]);

                TextBlockValue[i]            = SetTextStyle("", HorizontalAlignment.Right);
                TextBlockValue[i].Foreground = new SolidColorBrush(color[i]);
                StackPanelValue.Children.Add(TextBlockValue[i]);

                TextBlockMinValue[i]            = SetTextStyle("", HorizontalAlignment.Right);
                TextBlockMinValue[i].Foreground = new SolidColorBrush(color[i]);
                StackPanelMinValue.Children.Add(TextBlockMinValue[i]);

                TextBlockMaxValue[i]            = SetTextStyle("", HorizontalAlignment.Right);
                TextBlockMaxValue[i].Foreground = new SolidColorBrush(color[i]);
                StackPanelMaxValue.Children.Add(TextBlockMaxValue[i]);
            }

            StackPanelDataName.Margin = new Thickness(40, 0, 0, 0);

            StackPanelBottom.Children.Add(StackPanelProperty);
            StackPanelBottom.Children.Add(StackPanelDataName);
            StackPanelBottom.Children.Add(StackPanelValue);
            StackPanelBottom.Children.Add(StackPanelMinValue);
            StackPanelBottom.Children.Add(StackPanelMaxValue);

            StackPanelProperty.Orientation = Orientation.Horizontal;

            StackPanelPropertyName.Orientation  = Orientation.Vertical;
            StackPanelPropertyValue.Orientation = Orientation.Vertical;

            TextBlockPropertyName  = new TextBlock[_properties.Length];
            TextBlockPropertyValue = new TextBlock[TextBlockPropertyName.Length];

            for (int i = 0; i < _properties.Length; i++)
            {
                TextBlockPropertyName[i] = SetTextStyle(_properties[i], HorizontalAlignment.Left);
                StackPanelPropertyName.Children.Add(TextBlockPropertyName[i]);

                TextBlockPropertyValue[i] = SetTextStyle((i == 0 ? "\r\n" : "") + "        -", HorizontalAlignment.Left);
                StackPanelPropertyValue.Children.Add(TextBlockPropertyValue[i]);
            }

            StackPanelProperty.Children.Add(StackPanelPropertyName);
            StackPanelProperty.Children.Add(StackPanelPropertyValue);

            StackPanelSensor.Children.Add(StackPanelTop);
            StackPanelSensor.Children.Add(CanvasSensor);
            StackPanelSensor.Children.Add(StackPanelBottom);
        }
Esempio n. 3
0
        public SensorDisplay(int sensorType, int index, int totalIndex, string name, int minValue, int maxValue, int scale, Color[] color)
        {
            var resourceLoader = ResourceLoader.GetForCurrentView();

            StackPanelSensor.Children.Clear();

            _sensorType = sensorType;
            _index      = index;
            _totalIndex = totalIndex;
            _name       = name;

            expanderProperty.Content     = scrollViewerProperty;
            scrollViewerProperty.Content = stackPanelProperty;

            string[] vAxisLabel = new string[scale + 1];

            for (int i = 0; i <= scale; i++)
            {
                if (sensorType == Sensor.ACTIVITYSENSOR)
                {
                    if (i < 2)
                    {
                        vAxisLabel[i] = ((ActivitySensorReadingConfidence)i).ToString();
                    }
                    else
                    {
                        vAxisLabel[i] = "None";
                    }
                }
                else if (sensorType == Sensor.SIMPLEORIENTATIONSENSOR)
                {
                    vAxisLabel[i] = ((SimpleOrientation)(maxValue - i)).ToString().Replace("DegreesCounterclockwise", "°↺");
                }
                else
                {
                    vAxisLabel[i] = (maxValue - Convert.ToDouble(i) / scale * (maxValue - minValue)).ToString();
                }
            }

            _plotCanvas = new PlotCanvas(minValue, maxValue, color, canvasSensor, vAxisLabel);
            stackPanelSwitch.Children.Add(buttonSensor);

            if (sensorType == Sensor.ACCELEROMETER || sensorType == Sensor.ACCELEROMETERLINEAR || sensorType == Sensor.ACCELEROMETERGRAVITY)
            {
                Grid gridAccelerometer = new Grid();
                gridAccelerometer.Children.Add(new Ellipse()
                {
                    Width = 100, Height = 100, Stroke = new SolidColorBrush(Colors.Black), StrokeThickness = 5
                });
                gridAccelerometer.Children.Add(new Ellipse()
                {
                    Width = 50, Height = 50, Stroke = new SolidColorBrush(Colors.Black), StrokeThickness = 5
                });
                gridAccelerometer.Children.Add(ellipseAccelerometer);
                stackPanelTop.Children.Add(gridAccelerometer);
            }
            else if (sensorType == Sensor.COMPASS)
            {
                stackPanelTop.Children.Add(imageCompass);
            }
            else if (sensorType == Sensor.GYROMETER)
            {
                StackPanel stackPanelX = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                stackPanelX.Children.Add(imageGyrometerX);
                stackPanelX.Children.Add(new TextBlock()
                {
                    Text = "X", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanel stackPanelY = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                stackPanelY.Children.Add(imageGyrometerY);
                stackPanelY.Children.Add(new TextBlock()
                {
                    Text = "Y", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanel stackPanelZ = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                stackPanelZ.Children.Add(imageGyrometerZ);
                stackPanelZ.Children.Add(new TextBlock()
                {
                    Text = "Z", HorizontalAlignment = HorizontalAlignment.Center
                });

                stackPanelTop.Children.Add(stackPanelX);
                stackPanelTop.Children.Add(stackPanelY);
                stackPanelTop.Children.Add(stackPanelZ);
            }
            else if (sensorType == Sensor.INCLINOMETER)
            {
                StackPanel stackPanelX = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                stackPanelX.Children.Add(imageInclinometerPitch);
                stackPanelX.Children.Add(new TextBlock()
                {
                    Text = "Pitch", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanel stackPanelY = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                stackPanelY.Children.Add(imageInclinometerRoll);
                stackPanelY.Children.Add(new TextBlock()
                {
                    Text = "Roll", HorizontalAlignment = HorizontalAlignment.Center
                });

                StackPanel stackPanelZ = new StackPanel()
                {
                    Orientation = Orientation.Vertical, Margin = new Thickness(10), Width = 60
                };
                stackPanelZ.Children.Add(imageInclinometerYaw);
                stackPanelZ.Children.Add(new TextBlock()
                {
                    Text = "Yaw", HorizontalAlignment = HorizontalAlignment.Center
                });

                stackPanelTop.Children.Add(stackPanelX);
                stackPanelTop.Children.Add(stackPanelY);
                stackPanelTop.Children.Add(stackPanelZ);
            }
            else if (sensorType == Sensor.ACTIVITYSENSOR || sensorType == Sensor.LIGHTSENSOR || sensorType == Sensor.PEDOMETER || sensorType == Sensor.PROXIMITYSENSOR)
            {
                stackPanelTop.Children.Add(textBlockSensor);
            }
            else
            {
                stackPanelTop.Height = 0;
            }

            textBlockProperty = new TextBlock[color.Length + 1];
            textBlockValue    = new TextBlock[textBlockProperty.Length];
            textBlockMinValue = new TextBlock[textBlockProperty.Length];
            textBlockMaxValue = new TextBlock[textBlockProperty.Length];

            textBlockProperty[color.Length] = SetTextStyle("", HorizontalAlignment.Center);
            stackPanelDataName.Children.Add(textBlockProperty[color.Length]);

            textBlockValue[color.Length] = SetTextStyle(resourceLoader.GetString("Value"), HorizontalAlignment.Center);
            stackPanelValue.Children.Add(textBlockValue[color.Length]);

            textBlockMinValue[color.Length] = SetTextStyle(resourceLoader.GetString("Min"), HorizontalAlignment.Center);
            stackPanelMinValue.Children.Add(textBlockMinValue[color.Length]);

            textBlockMaxValue[color.Length] = SetTextStyle(resourceLoader.GetString("Max"), HorizontalAlignment.Center);
            stackPanelMaxValue.Children.Add(textBlockMaxValue[color.Length]);

            for (int i = 0; i < color.Length; i++)
            {
                textBlockProperty[i]            = SetTextStyle("", HorizontalAlignment.Left);
                textBlockProperty[i].Foreground = new SolidColorBrush(color[i]);
                stackPanelDataName.Children.Add(textBlockProperty[i]);

                textBlockValue[i]            = SetTextStyle("", HorizontalAlignment.Right);
                textBlockValue[i].Foreground = new SolidColorBrush(color[i]);
                stackPanelValue.Children.Add(textBlockValue[i]);

                textBlockMinValue[i]            = SetTextStyle("", HorizontalAlignment.Right);
                textBlockMinValue[i].Foreground = new SolidColorBrush(color[i]);
                stackPanelMinValue.Children.Add(textBlockMinValue[i]);

                textBlockMaxValue[i]            = SetTextStyle("", HorizontalAlignment.Right);
                textBlockMaxValue[i].Foreground = new SolidColorBrush(color[i]);
                stackPanelMaxValue.Children.Add(textBlockMaxValue[i]);
            }

            stackPanelBottom.Children.Add(expanderProperty);

            if (sensorType == Sensor.LIGHTSENSOR)
            {
                stackPanelBottomData.Children.Add(stackPanelDataName);
                stackPanelBottomData.Children.Add(stackPanelValue);
                stackPanelBottomData.Children.Add(stackPanelMinValue);
                stackPanelBottomData.Children.Add(stackPanelMaxValue);

                stackPanelBottomRightCol.Children.Add(stackPanelBottomData);
                stackPanelBottomRightCol.Children.Add(MALTButton);
                MALTButton.Click += Scenario1View.Scenario1.MALTButton;

                textBlockMALTPropertyName1  = new TextBlock[8];
                TextBlockMALTPropertyValue1 = new TextBlock[8];
                textBlockMALTPropertyName2  = new TextBlock[8];
                TextBlockMALTPropertyValue2 = new TextBlock[8];

                textBlockMALTPropertyName1[0] = new TextBlock()
                {
                    Text = "Lux", Width = 120
                };
                textBlockMALTPropertyName1[1] = new TextBlock()
                {
                    Text = "Clear", Width = 120, Foreground = new SolidColorBrush(Colors.DarkGray)
                };
                textBlockMALTPropertyName1[2] = new TextBlock()
                {
                    Text = "R", Width = 120, Foreground = new SolidColorBrush(Colors.Red)
                };
                textBlockMALTPropertyName1[3] = new TextBlock()
                {
                    Text = "G", Width = 120, Foreground = new SolidColorBrush(Colors.Green)
                };
                textBlockMALTPropertyName1[4] = new TextBlock()
                {
                    Text = "B", Width = 120, Foreground = new SolidColorBrush(Colors.Blue)
                };
                //textBlockMALTPropertyName1[5] = new TextBlock() { Text = "Chromaticity x", Width = 120 };
                //textBlockMALTPropertyName1[6] = new TextBlock() { Text = "Chromaticity y", Width = 120 };
                //textBlockMALTPropertyName1[7] = new TextBlock() { Text = "Chromaticity Y", Width = 120 };

                TextBlockMALTPropertyValue1[0] = new TextBlock()
                {
                    Width = 120
                };
                TextBlockMALTPropertyValue1[1] = new TextBlock()
                {
                    Width = 120, Foreground = new SolidColorBrush(Colors.DarkGray)
                };
                TextBlockMALTPropertyValue1[2] = new TextBlock()
                {
                    Width = 120, Foreground = new SolidColorBrush(Colors.Red)
                };
                TextBlockMALTPropertyValue1[3] = new TextBlock()
                {
                    Width = 120, Foreground = new SolidColorBrush(Colors.Green)
                };
                TextBlockMALTPropertyValue1[4] = new TextBlock()
                {
                    Width = 120, Foreground = new SolidColorBrush(Colors.Blue)
                };
                //TextBlockMALTPropertyValue1[5] = new TextBlock() { Width = 120 };
                //TextBlockMALTPropertyValue1[6] = new TextBlock() { Width = 120 };
                //TextBlockMALTPropertyValue1[7] = new TextBlock() { Width = 120 };

                textBlockMALTPropertyName2[0] = new TextBlock()
                {
                    Text = "Lux", Width = 120
                };
                textBlockMALTPropertyName2[1] = new TextBlock()
                {
                    Text = "Clear", Width = 120, Foreground = new SolidColorBrush(Colors.DarkGray)
                };
                textBlockMALTPropertyName2[2] = new TextBlock()
                {
                    Text = "R", Width = 120, Foreground = new SolidColorBrush(Colors.Red)
                };
                textBlockMALTPropertyName2[3] = new TextBlock()
                {
                    Text = "G", Width = 120, Foreground = new SolidColorBrush(Colors.Green)
                };
                textBlockMALTPropertyName2[4] = new TextBlock()
                {
                    Text = "B", Width = 120, Foreground = new SolidColorBrush(Colors.Blue)
                };
                //textBlockMALTPropertyName2[5] = new TextBlock() { Text = "Chromaticity x", Width = 120 };
                //textBlockMALTPropertyName2[6] = new TextBlock() { Text = "Chromaticity y", Width = 120 };
                //textBlockMALTPropertyName2[7] = new TextBlock() { Text = "Chromaticity Y", Width = 120 };

                TextBlockMALTPropertyValue2[0] = new TextBlock()
                {
                    Width = 120
                };
                TextBlockMALTPropertyValue2[1] = new TextBlock()
                {
                    Width = 120, Foreground = new SolidColorBrush(Colors.DarkGray)
                };
                TextBlockMALTPropertyValue2[2] = new TextBlock()
                {
                    Width = 120, Foreground = new SolidColorBrush(Colors.Red)
                };
                TextBlockMALTPropertyValue2[3] = new TextBlock()
                {
                    Width = 120, Foreground = new SolidColorBrush(Colors.Green)
                };
                TextBlockMALTPropertyValue2[4] = new TextBlock()
                {
                    Width = 120, Foreground = new SolidColorBrush(Colors.Blue)
                };
                //TextBlockMALTPropertyValue2[5] = new TextBlock() { Width = 120 };
                //TextBlockMALTPropertyValue2[6] = new TextBlock() { Width = 120 };
                //TextBlockMALTPropertyValue2[7] = new TextBlock() { Width = 120 };

                for (int i = 0; i < textBlockMALTPropertyName1.Length - 3; i++)
                {
                    stackPanelMALTPropertyName1.Children.Add(textBlockMALTPropertyName1[i]);
                    stackPanelMALTPropertyValue1.Children.Add(TextBlockMALTPropertyValue1[i]);
                    stackPanelMALTPropertyName2.Children.Add(textBlockMALTPropertyName2[i]);
                    stackPanelMALTPropertyValue2.Children.Add(TextBlockMALTPropertyValue2[i]);
                }

                StackPanelMALTData.Children.Add(textblockMALTData1);
                StackPanelMALTData.Children.Add(stackPanelMALTPropertyName1);
                StackPanelMALTData.Children.Add(stackPanelMALTPropertyValue1);
                StackPanelMALTData.Children.Add(textblockMALTData2);
                StackPanelMALTData.Children.Add(stackPanelMALTPropertyName2);
                StackPanelMALTData.Children.Add(stackPanelMALTPropertyValue2);
                StackPanelMALTData.Children.Add(hideMALTButton);
                hideMALTButton.Click += Scenario1View.Scenario1.HideMALTButton;

                stackPanelBottom.Children.Add(stackPanelBottomRightCol);
                stackPanelBottom.Children.Add(StackPanelMALTData);
            }
            else
            {
                stackPanelBottom.Children.Add(stackPanelDataName);
                stackPanelBottom.Children.Add(stackPanelValue);
                stackPanelBottom.Children.Add(stackPanelMinValue);
                stackPanelBottom.Children.Add(stackPanelMaxValue);
            }

            textBlockPropertyName  = new TextBlock[_properties.Length];
            textBlockPropertyValue = new TextBlock[textBlockPropertyName.Length];

            for (int i = 0; i < _properties.Length; i++)
            {
                textBlockPropertyName[i]  = SetTextStyle(_properties[i], HorizontalAlignment.Left);
                textBlockPropertyValue[i] = SetTextStyle((i == 0 ? "\r\n" : "") + "        -", HorizontalAlignment.Left);
                stackPanelPropertyName.Children.Add(textBlockPropertyName[i]);

                if (i == 0)
                {
                    textBlockPropertyName[i].Height  = 60;
                    textBlockPropertyValue[i].Height = 60;
                    buttonReportInterval.Click      += Scenario1View.Scenario1.ReportIntervalButton;
                    StackPanel stackPanelReportInterval = new StackPanel();
                    stackPanelReportInterval.Orientation = Orientation.Horizontal;
                    stackPanelReportInterval.Children.Add(textBlockPropertyValue[i]);
                    stackPanelReportInterval.Children.Add(TextboxReportInterval);
                    stackPanelReportInterval.Children.Add(buttonReportInterval);
                    stackPanelPropertyValue.Children.Add(stackPanelReportInterval);
                }
                else
                {
                    stackPanelPropertyValue.Children.Add(textBlockPropertyValue[i]);
                }
            }

            stackPanelProperty.Children.Add(stackPanelPropertyName);
            stackPanelProperty.Children.Add(stackPanelPropertyValue);

            StackPanelSensor.Children.Add(stackPanelTop);
            StackPanelSensor.Children.Add(canvasSensor);
            StackPanelSensor.Children.Add(stackPanelBottom);
        }