Esempio n. 1
0
        private void Update()
        {
            // Release the pedometer
            pedometer.Dispose();
            pedometer = null;

            for (int i = 0; i < options.Length; i++)
            {
                if (i == index)
                {
                    part.sprite = options[i];
                }
            }
        }
        /// <summary>
        /// Releases all resources used by the current instance
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    _sensor.DataUpdated -= OnSensorDataUpdated;
                    _sensor.Dispose();
                }

                _sensor   = null;
                _disposed = true;
            }
        }
Esempio n. 3
0
        public IObservable <int> WhenReadingTaken()
        => this.observable ??= Observable.Create <int>(ob =>
        {
            var handler = new EventHandler <PedometerDataUpdatedEventArgs>((sender, args) =>
                                                                           ob.OnNext((int)args.StepCount)
                                                                           );
            var sensor = new Pedometer
            {
                Interval = 1000
            };
            sensor.DataUpdated += handler;
            sensor.Start();

            return(() =>
            {
                sensor.Stop();
                sensor.DataUpdated -= handler;
                sensor.Dispose();
            });
        })
        .Publish()
        .RefCount();
Esempio n. 4
0
 private void OnDisable()
 {
     // Release the pedometer
     pedometer.Dispose();
     pedometer = null;
 }
Esempio n. 5
0
 public void MeterDispose()
 {
     _pedometer.Dispose();
 }