public Scenario2_Polling() { this.InitializeComponent(); Sensor = OrientationSensor.GetDefaultForRelativeReadings(); if (Sensor == null) { RootPage.NotifyUser("No relative orientation sensor found", NotifyType.ErrorMessage); GetDataButton.IsEnabled = false; } else { GetDataButton.IsEnabled = true; } }
public Scenario1_DataEvents() { this.InitializeComponent(); Sensor = OrientationSensor.GetDefaultForRelativeReadings(); if (Sensor != null) { // Select a report interval that is both suitable for the purposes of the app and supported by the sensor. // This value will be used later to activate the sensor. uint minReportInterval = Sensor.MinimumReportInterval; DesiredReportInterval = minReportInterval > 16 ? minReportInterval : 16; } else { rootPage.NotifyUser("No relative orientation sensor found", NotifyType.ErrorMessage); } }
private void InitializeTracker() { if (NorthAlign) { _sensor = OrientationSensor.GetDefault(SensorReadingType.Absolute, SensorOptimizationGoal.Precision); } else { _sensor = OrientationSensor.GetDefaultForRelativeReadings(); } if (_sensor == null) { _sensor = OrientationSensor.GetDefault(); } if (_sensor == null) { throw new NotSupportedException("No Orientation Sensor detected"); } _sensor.ReadingChanged += Sensor_ReadingChanged; StartCapturing(); }