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)); }
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))));
public override IObservable <IList <IGattCharacteristic> > GetCharacteristics() => Observable.Return( this.native .Characteristics .Select(native => new GattCharacteristic(this, this.context, native)) .Cast <IGattCharacteristic>() .ToList() );