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)); }
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); }
public _(Using <TSource, TResource> parent, IObserver <TSource> observer, IDisposable cancel) : base(observer, cancel) { _parent = parent; }