Exemplo n.º 1
0
        public IObservable <Unit> EnableIdleTimer(bool enabled)
        {
            var mgr = (PowerManager)Application.Context.GetSystemService(Context.PowerService);

            if (enabled)
            {
                if (this.wakeLock == null)
                {
                    this.wakeLock = mgr.NewWakeLock(WakeLockFlags.Partial, this.GetType().FullName);
                    this.wakeLock.Acquire();
                }
            }
            else
            {
                this.wakeLock?.Release();
                this.wakeLock = null;
            }

            return(Observable.Return(Unit.Default));
        }
Exemplo n.º 2
0
 public static async Task RunWithStorageAsync(this IServiceProvider provider, Action <BlazorApplication> selector, string marker = null)
 => await provider.RunWithStorageAsync(() => Observable.Return(Unit.Default).Do(_ => selector(provider.GetApplication(marker))));
Exemplo n.º 3
0
 public override IObservable <IList <IGattCharacteristic> > GetCharacteristics() => Observable.Return(
     this.native
     .Characteristics
     .Select(native => new GattCharacteristic(this, this.context, native))
     .Cast <IGattCharacteristic>()
     .ToList()
     );