Esempio n. 1
0
                private IDisposable InvokeRec(IScheduler self, TState state)
                {
                    var time = default(DateTimeOffset);

                    if (_hasResult)
                    {
                        base._observer.OnNext(_result);
                    }

                    try
                    {
                        if (_first)
                        {
                            _first = false;
                        }
                        else
                        {
                            state = _parent._iterate(state);
                        }

                        _hasResult = _parent._condition(state);

                        if (_hasResult)
                        {
                            _result = _parent._resultSelector(state);
                            time    = _parent._timeSelector(state);
                        }
                    }
                    catch (Exception exception)
                    {
                        base._observer.OnError(exception);
                        base.Dispose();
                        return(Disposable.Empty);
                    }

                    if (!_hasResult)
                    {
                        base._observer.OnCompleted();
                        base.Dispose();
                        return(Disposable.Empty);
                    }

                    return(self.Schedule(state, time, InvokeRec));
                }
Esempio n. 2
0
                private IDisposable InvokeRec(IScheduler self, TState state)
                {
                    var time = default(DateTimeOffset);

                    if (_hasResult)
                    {
                        ForwardOnNext(_result);
                    }

                    try
                    {
                        if (_first)
                        {
                            _first = false;
                        }
                        else
                        {
                            state = _parent._iterate(state);
                        }

                        _hasResult = _parent._condition(state);

                        if (_hasResult)
                        {
                            _result = _parent._resultSelector(state);
                            time    = _parent._timeSelector(state);
                        }
                    }
                    catch (Exception exception)
                    {
                        ForwardOnError(exception);
                        return(Disposable.Empty);
                    }

                    if (!_hasResult)
                    {
                        ForwardOnCompleted();
                        return(Disposable.Empty);
                    }

                    return(self.Schedule((@this: this, state), time, (scheduler, tuple) => [email protected](scheduler, tuple.state)));
                }