private async static void PeriodicTimerCallbackSensorDisplay()

in sensors/Tools/SensorExplorer/PeriodicTimer.cs [53:128]


        private async static void PeriodicTimerCallbackSensorDisplay(ThreadPoolTimer timer)
        {
            await cd.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                for (int i = 0; i < Sensor.SensorDisplay.Count; i++)
                {
                    SensorDisplay selectedDisplay = Sensor.SensorDisplay[i];
                    SensorData selectedData = Sensor.SensorData[i];
                    if (selectedDisplay.StackPanelSensor.Visibility == Visibility.Visible)
                    {
                        selectedDisplay.PlotCanvas.Plot(selectedData);
                        selectedDisplay.UpdateText(selectedData);
                    }

                    if (selectedData.ReportIntervalChanged)
                    {
                        try
                        {
                            if (selectedData.SensorType == Sensor.ACCELEROMETER)
                            {
                                Sensor.AccelerometerStandardList[selectedDisplay.Index].ReportInterval = selectedData.ReportInterval;
                                selectedData.ReportInterval = Sensor.AccelerometerStandardList[selectedDisplay.Index].ReportInterval;
                            }
                            else if (selectedData.SensorType == Sensor.ACCELEROMETERGRAVITY)
                            {
                                Sensor.AccelerometerGravityList[selectedDisplay.Index].ReportInterval = selectedData.ReportInterval;
                                selectedData.ReportInterval = Sensor.AccelerometerGravityList[selectedDisplay.Index].ReportInterval;
                            }
                            else if (selectedData.SensorType == Sensor.ACCELEROMETERLINEAR)
                            {
                                Sensor.AccelerometerLinearList[selectedDisplay.Index].ReportInterval = selectedData.ReportInterval;
                                selectedData.ReportInterval = Sensor.AccelerometerLinearList[selectedDisplay.Index].ReportInterval;
                            }
                            else if (selectedData.SensorType == Sensor.COMPASS)
                            {
                                Sensor.CompassList[selectedDisplay.Index].ReportInterval = selectedData.ReportInterval;
                                selectedData.ReportInterval = Sensor.CompassList[selectedDisplay.Index].ReportInterval;
                            }
                            else if (selectedData.SensorType == Sensor.GYROMETER)
                            {
                                Sensor.GyrometerList[selectedDisplay.Index].ReportInterval = selectedData.ReportInterval;
                                selectedData.ReportInterval = Sensor.GyrometerList[selectedDisplay.Index].ReportInterval;
                            }
                            else if (selectedData.SensorType == Sensor.INCLINOMETER)
                            {
                                Sensor.InclinometerList[selectedDisplay.Index].ReportInterval = selectedData.ReportInterval;
                                selectedData.ReportInterval = Sensor.InclinometerList[selectedDisplay.Index].ReportInterval;
                            }
                            else if (selectedData.SensorType == Sensor.LIGHTSENSOR)
                            {
                                Sensor.LightSensorList[selectedDisplay.Index].ReportInterval = selectedData.ReportInterval;
                                selectedData.ReportInterval = Sensor.LightSensorList[selectedDisplay.Index].ReportInterval;
                            }
                            else if (selectedData.SensorType == Sensor.ORIENTATIONSENSOR)
                            {
                                Sensor.OrientationAbsoluteList[selectedDisplay.Index].ReportInterval = selectedData.ReportInterval;
                                selectedData.ReportInterval = Sensor.OrientationAbsoluteList[selectedDisplay.Index].ReportInterval;
                            }
                            else if (selectedData.SensorType == Sensor.ORIENTATIONGEOMAGNETIC)
                            {
                                Sensor.OrientationGeomagneticList[selectedDisplay.Index].ReportInterval = selectedData.ReportInterval;
                                selectedData.ReportInterval = Sensor.OrientationGeomagneticList[selectedDisplay.Index].ReportInterval;
                            }
                            else if (selectedData.SensorType == Sensor.ORIENTATIONRELATIVE)
                            {
                                Sensor.OrientationRelativeList[selectedDisplay.Index].ReportInterval = selectedData.ReportInterval;
                                selectedData.ReportInterval = Sensor.OrientationRelativeList[selectedDisplay.Index].ReportInterval;
                            }

                            selectedData.ReportIntervalChanged = false;
                        }
                        catch { }
                    }
                }
            });
        }