コード例 #1
0
        public static IDisposable BindTo(this IObservable <bool> This, IInputLayer inputLayer, string reason)
        {
            var disableDisposable = new SerialDisposable();

            return(new CompositeDisposable(
                       disableDisposable,
                       This.DistinctUntilChanged()
                       .Subscribe(x => disableDisposable.Disposable = x
                        ? null
                        : inputLayer.Disable(reason))));
        }
コード例 #2
0
 public static IObservable <T> DisableLayerUntilCompleted <T>(this IObservable <T> This, IInputLayer layer, string reason) =>
 Observable.Defer(() =>
 {
     var disposable = layer.Disable(reason);
     return(This.Finally(() => disposable.Dispose()));
 });