GetDefault() public static method

public static GetDefault ( ) : Accelerometer
return Accelerometer
        /// <summary>
        /// Stops this instance.
        /// </summary>
        partial void Stop()
        {
            var accelerometer = AccelerometerSensor.GetDefault();

            if (accelerometer != null)
            {
                accelerometer.ReadingChanged -= AccelerometerOnReadingChanged;
            }
        }
Example #2
0
 static Sensor GetSensor()
 {
     try
     {
         return(Sensor.GetDefault());
     }
     catch
     {
         return(null);
     }
 }
        /// <summary>
        /// Starts this instance.
        /// </summary>
        partial void Start()
        {
            var accelerometer = AccelerometerSensor.GetDefault();

            if (accelerometer == null)
            {
                return;
            }

            accelerometer.ReportInterval = (uint)this.Interval;

            accelerometer.ReadingChanged += AccelerometerOnReadingChanged;
        }