Exemplo n.º 1
0
            public IDisposable Run(Using <TSource, TResource> parent)
            {
                var source     = default(IObservable <TSource>);
                var disposable = Disposable.Empty;

                try
                {
                    var resource = parent._resourceFactory();
                    if (resource != null)
                    {
                        disposable = resource;
                    }
                    source = parent._observableFactory(resource);
                }
                catch (Exception exception)
                {
                    return(StableCompositeDisposable.Create(Observable.Throw <TSource>(exception).SubscribeSafe(this), disposable));
                }

                return(StableCompositeDisposable.Create(source.SubscribeSafe(this), disposable));
            }
Exemplo n.º 2
0
            public void Run(Using <TSource, TResource> parent)
            {
                var source = default(IObservable <TSource>);

                try
                {
                    var resource = parent._resourceFactory();
                    if (resource != null)
                    {
                        Disposable.SetSingle(ref _disposable, resource);
                    }
                    source = parent._observableFactory(resource);
                }
                catch (Exception exception)
                {
                    SetUpstream(Observable.Throw <TSource>(exception).SubscribeSafe(this));

                    return;
                }

                base.Run(source);
            }
Exemplo n.º 3
0
 public _(Using <TSource, TResource> parent, IObserver <TSource> observer, IDisposable cancel)
     : base(observer, cancel)
 {
     _parent = parent;
 }