Ejemplo n.º 1
0
 public ObserveOn_(ObserveOnObservable <T> parent, ISchedulerQueueing scheduler, IObserver <T> observer, IDisposable cancel) : base(observer, cancel)
 {
     this.parent     = parent;
     this.scheduler  = scheduler;
     this.isDisposed = new BooleanDisposable();
     this.onNext     = new Action <T>(OnNext_); // cache delegate
 }
Ejemplo n.º 2
0
 public ObserveOn_(ObserveOnObservable <T> parent, ISchedulerQueueing scheduler, IObserver <T> observer, IDisposable cancel)
     : base(observer, cancel)
 {
     this.parent    = parent;
     this.scheduler = scheduler;
     isDisposed     = new BooleanDisposable();
     onNext         = OnNext_;
 }
Ejemplo n.º 3
0
            private void ProcessNext()
            {
                object obj = this.actions;

                lock (obj)
                {
                    if (this.actions.Count != 0 && !this.isDisposed)
                    {
                        ObserveOnObservable <T> .ObserveOn.SchedulableAction action = this.actions.First.Value;
                        if (!action.IsScheduled)
                        {
                            action.schedule = this.parent.scheduler.Schedule(delegate()
                            {
                                try
                                {
                                    NotificationKind kind = action.data.Kind;
                                    if (kind != NotificationKind.OnNext)
                                    {
                                        if (kind != NotificationKind.OnError)
                                        {
                                            if (kind == NotificationKind.OnCompleted)
                                            {
                                                this.observer.OnCompleted();
                                            }
                                        }
                                        else
                                        {
                                            this.observer.OnError(action.data.Exception);
                                        }
                                    }
                                    else
                                    {
                                        this.observer.OnNext(action.data.Value);
                                    }
                                }
                                finally
                                {
                                    object obj2 = this.actions;
                                    lock (obj2)
                                    {
                                        action.Dispose();
                                    }
                                    if (action.data.Kind == NotificationKind.OnNext)
                                    {
                                        this.ProcessNext();
                                    }
                                    else
                                    {
                                        this.Dispose();
                                    }
                                }
                            });
                        }
                    }
                }
            }
Ejemplo n.º 4
0
            private void QueueAction(Notification <T> data)
            {
                ObserveOnObservable <T> .ObserveOn.SchedulableAction schedulableAction = new ObserveOnObservable <T> .ObserveOn.SchedulableAction
                {
                    data = data
                };
                object obj = this.actions;

                lock (obj)
                {
                    if (!this.isDisposed)
                    {
                        schedulableAction.node = this.actions.AddLast(schedulableAction);
                        this.ProcessNext();
                    }
                }
            }
Ejemplo n.º 5
0
 public ObserveOn(ObserveOnObservable <T> parent, IObserver <T> observer, IDisposable cancel) : base(observer,
                                                                                                     cancel)
 {
     this.parent = parent;
 }