Пример #1
0
        public override IObservable <AdapterStatus> WhenStatusChanged()
        {
            this.statusOb = this.statusOb ?? BluetoothObservables
                            .WhenAdapterStatusChanged()
                            .StartWith(this.Status)
                            .Select(x => this.Status)
                            .Replay(1)
                            .RefCount();

            return(this.statusOb);
        }
Пример #2
0
        public IObservable <AdapterStatus> WhenStatusChanged()
        {
            this.statusOb = this.statusOb ?? Observable.Create <AdapterStatus>(ob =>
            {
                ob.OnNext(this.Status);
                var aob = BluetoothObservables
                          .WhenAdapterStatusChanged()
                          .Subscribe(_ => ob.OnNext(this.Status));

                return(aob.Dispose);
            })
                            .Replay(1)
                            .RefCount();

            return(this.statusOb);
        }