问题
I'm using SimpleOrientationSensor to get the screen orientation information in my application. I'm testing this application in Windows Simulator but I always get the sensor object's value as null.
This is what I'm doing:
SimpleOrientationSensor sensor;
sensor = SimpleOrientationSensor.GetDefault();
if (sensor != null)
{
sensor.OrientationChanged += sensor_OrientationChanged;
}
I understand that SimpleOrientationSensor.GetDefault() will return null when there is no Sensor available. Should I tweak the Simulator to get the sensor information? Or does it even handle these changes?
回答1:
According to this article the simulator doesn't support the SimpleOrientationSensor class.
The Simulator doesn’t support the emulation of Orientation Sensor, and is only able to trigger a display orientation change.
来源:https://stackoverflow.com/questions/12853799/simpleorientationsensor-returning-null