예제 #1
0
        ISettings LoadSettings()
        {
            var settings = _vm.Container.Get <ISettings>();

            _sensors.InstallAccelerometer(AccelerometerPlot);
            _sensors.InstallGyrometer(GyrometerPlot);
            _sensors.InstallInclinometer(InclinometerPlot);
            _sensors.InstallAmbientLight(LightPlot);
            _sensors.InstallCompass(CompassPlot);

            if (settings == null)
            {
                _sensors.Set(AccelerometerPlot, true, 30);
                _sensors.Set(GyrometerPlot, true, 30);
                _sensors.Set(InclinometerPlot, true, 30);
                _sensors.Set(LightPlot, true, 30);
                _sensors.Set(CompassPlot, true, 30);
                MyConsole.ConsoleFontSize = 16f;
            }
            else
            {
                _sensors.Set(AccelerometerPlot, settings.Accelerometer, settings.LiveSensorHistory);
                _sensors.Set(GyrometerPlot, settings.Gyrometer, settings.LiveSensorHistory);
                _sensors.Set(InclinometerPlot, settings.Inclinometer, settings.LiveSensorHistory);
                _sensors.Set(LightPlot, settings.Light, settings.LiveSensorHistory);
                _sensors.Set(CompassPlot, settings.Compass, settings.LiveSensorHistory);
                MyConsole.ConsoleFontSize = settings.ConsoleFontSize;

                if (Kernel.IsWindows8)
                {
                    SensorsTab.Visibility = Visibility.Visible;

                    if (settings.LiveSensorData && !_sensors.IsRunning)
                    {
                        _sensors.Measure();
                    }
                    else if (!settings.LiveSensorData && _sensors.IsRunning)
                    {
                        _sensors.Cancel();
                    }
                }
                else
                {
                    SensorsTab.Visibility = Visibility.Collapsed;
                }
            }

            return(settings);
        }