private void OnReadingChanged(object sender, AccelerometerChangedEventArgs e)
 {
     ReadingChanged?.Invoke(this, new AccelerometerChangeEventArgs()
     {
         X = e.Reading.Acceleration.X, Y = e.Reading.Acceleration.Y, Z = e.Reading.Acceleration.Z
     });
 }
Example #2
0
 internal static void OnChanged(OrientationSensorChangedEventArgs e)
 {
     if (useSyncContext)
     {
         MainThread.BeginInvokeOnMainThread(() => ReadingChanged?.Invoke(null, e));
     }
     else
     {
         ReadingChanged?.Invoke(null, e);
     }
 }
 static void OnChanged(BarometerChangedEventArgs e)
 {
     if (useSyncContext)
     {
         MainThread.BeginInvokeOnMainThread(() => ReadingChanged?.Invoke(null, e));
     }
     else
     {
         ReadingChanged?.Invoke(null, e);
     }
 }
Example #4
0
        void RaiseReadingChanged(BarometerData reading)
        {
            var args = new BarometerChangedEventArgs(reading);

            if (UseSyncContext)
            {
                MainThread.BeginInvokeOnMainThread(() => ReadingChanged?.Invoke(this, args));
            }
            else
            {
                ReadingChanged?.Invoke(this, args);
            }
        }
Example #5
0
        void RaiseReadingChanged(GyroscopeData data)
        {
            var args = new GyroscopeChangedEventArgs(data);

            if (UseSyncContext)
            {
                MainThread.BeginInvokeOnMainThread(() => ReadingChanged?.Invoke(null, args));
            }
            else
            {
                ReadingChanged?.Invoke(null, args);
            }
        }
        public bool Start()
        {
            _sensor.ReportInterval = Math.Max(_sensor.MinimumReportInterval, 16);


            if (ReadingChanged.GetInvocationList().Length < 1)
            {
                return(false);
            }
            _sensor.ReadingChanged += ReadingChanged;
            _IsRunning              = true;
            return(true);
        }
Example #7
0
        internal void RaiseReadingChanged(OrientationSensorData reading)
        {
            var args = new OrientationSensorChangedEventArgs(reading);

            if (UseSyncContext)
            {
                MainThread.BeginInvokeOnMainThread(() => ReadingChanged?.Invoke(null, args));
            }
            else
            {
                ReadingChanged?.Invoke(null, args);
            }
        }
Example #8
0
        internal void RaiseReadingChanged(CompassData data)
        {
            var args = new CompassChangedEventArgs(data);

            if (UseSyncContext)
            {
                MainThread.BeginInvokeOnMainThread(() => ReadingChanged?.Invoke(null, args));
            }
            else
            {
                ReadingChanged?.Invoke(null, args);
            }
        }
Example #9
0
        internal static void OnChanged(CompassChangedEventArgs e)
        {
            if (ReadingChanged == null)
            {
                return;
            }

            if (UseSyncContext)
            {
                Platform.BeginInvokeOnMainThread(() => ReadingChanged?.Invoke(e));
            }
            else
            {
                ReadingChanged?.Invoke(e);
            }
        }
Example #10
0
        internal static void OnChanged(AccelerometerChangedEventArgs e)
        {
            if (useSyncContext)
            {
                MainThread.BeginInvokeOnMainThread(() => ReadingChanged?.Invoke(null, e));
            }
            else
            {
                ReadingChanged?.Invoke(null, e);
            }

            if (ShakeDetected != null)
            {
                ProcessShakeEvent(e.Reading.Acceleration);
            }
        }
Example #11
0
 /// <summary>
 /// Raises the ReadingChanged event.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnReadingChanged(AccelerometerReadingChangedEventArgs e)
 {
     ReadingChanged?.Invoke(this, e);
 }
Example #12
0
 private void OnLuxChanged(double lux)
 {
     ReadingChanged?.Invoke(this, lux);
 }