public IObservable <int> WhenReadingTaken() => this.stepOb ??= Observable.Create <int>(ob => { var scm = new CMStepCounter(); scm.StartStepCountingUpdates(NSOperationQueue.CurrentQueue ?? new NSOperationQueue(), 1, (steps, timestamp, error) => ob.OnNext((int)steps) ); return(() => { scm.StopStepCountingUpdates(); scm.Dispose(); }); }) .Publish() .RefCount();
public IObservable <int> WhenReadingTaken() { this.stepOb = this.stepOb ?? Observable.Create <int>(ob => { var scm = new CMStepCounter(); scm.StartStepCountingUpdates(NSOperationQueue.CurrentQueue, 10, (steps, timestamp, error) => { }); return(() => { scm.StopStepCountingUpdates(); scm.Dispose(); }); }); return(this.stepOb); }
public void Stop() { _stepCounter.StopStepCountingUpdates(); }