public IDisposable Subscribe(UniRx.IObserver <T> observer) { if (lastException != null) { observer.OnError(lastException); return(Disposable.Empty); } if (isDisposed) { observer.OnCompleted(); return(Disposable.Empty); } if (publisher == null) { publisher = new Subject <T>(); } Subject <T> subject = publisher; if (subject != null) { IDisposable result = subject.Subscribe(observer); if (canPublishValueOnSubscribe) { observer.OnNext(value); } return(result); } observer.OnCompleted(); return(Disposable.Empty); }
public IDisposable Subscribe(UniRx.IObserver <T> observer) { if (observer == null) { throw new ArgumentNullException("observer"); } Exception ex = null; T value = default(T); bool flag = false; lock (observerLock) { ThrowIfDisposed(); if (!isStopped) { ListObserver <T> listObserver = outObserver as ListObserver <T>; if (listObserver != null) { outObserver = listObserver.Add(observer); } else { UniRx.IObserver <T> observer2 = outObserver; if (observer2 is EmptyObserver <T> ) { outObserver = observer; } else { outObserver = new ListObserver <T>(new ImmutableList <IObserver <T> >(new IObserver <T>[2] { observer2, observer })); } } return(new Subscription(this, observer)); } ex = lastError; value = lastValue; flag = hasValue; } if (ex != null) { observer.OnError(ex); } else if (flag) { observer.OnNext(value); observer.OnCompleted(); } else { observer.OnCompleted(); } return(Disposable.Empty); }
public override TResult Accept <TResult>(UniRx.IObserver <T, TResult> observer) { if (observer == null) { throw new ArgumentNullException("observer"); } return(observer.OnCompleted()); }
public override void Accept(UniRx.IObserver <T> observer) { if (observer == null) { throw new ArgumentNullException("observer"); } observer.OnCompleted(); }
public IDisposable Subscribe(UniRx.IObserver <T> observer) { if (observer == null) { throw new ArgumentNullException("observer"); } Exception ex = null; Subscription subscription = null; lock (observerLock) { ThrowIfDisposed(); if (!isStopped) { ListObserver <T> listObserver = outObserver as ListObserver <T>; if (listObserver != null) { outObserver = listObserver.Add(observer); } else { UniRx.IObserver <T> observer2 = outObserver; if (observer2 is EmptyObserver <T> ) { outObserver = observer; } else { outObserver = new ListObserver <T>(new ImmutableList <IObserver <T> >(new IObserver <T>[2] { observer2, observer })); } } subscription = new Subscription(this, observer); } ex = lastError; Trim(); foreach (TimeInterval <T> item in queue) { observer.OnNext(item.Value); } } if (subscription != null) { return(subscription); } if (ex != null) { observer.OnError(ex); } else { observer.OnCompleted(); } return(Disposable.Empty); }
public IDisposable Subscribe(UniRx.IObserver <T> observer) { observer.OnCompleted(); return(Disposable.Empty); }
public IDisposable Subscribe(UniRx.IObserver <bool> observer) { observer.OnNext(value: true); observer.OnCompleted(); return(Disposable.Empty); }
public IDisposable Subscribe(UniRx.IObserver <Unit> observer) { observer.OnNext(Unit.Default); observer.OnCompleted(); return(Disposable.Empty); }