Example #1
0
 public IDisposable Run()
 {
     length = sources.Length;
     if (length == 0)
     {
         OnNext(new T[0]);
         try
         {
             base.observer.OnCompleted();
         }
         finally
         {
             Dispose();
         }
         return(Disposable.Empty);
     }
     completedCount = 0;
     values         = new T[length];
     IDisposable[] array = new IDisposable[length];
     for (int i = 0; i < length; i++)
     {
         UniRx.IObservable <T>     observable = sources[i];
         WhenAllCollectionObserver observer   = new WhenAllCollectionObserver(this, i);
         array[i] = observable.Subscribe(observer);
     }
     return(StableCompositeDisposable.CreateUnsafe(array));
 }
Example #2
0
            public IDisposable Run()
            {
                length = sources.Length;

                // fail safe...
                if (length == 0)
                {
                    OnNext(new T[0]);
                    try { observer.OnCompleted(); } finally { Dispose(); }
                    return(Disposable.Empty);
                }

                completedCount = 0;
                values         = new T[length];

                var subscriptions = new IDisposable[length];

                for (int index = 0; index < length; index++)
                {
                    var source   = sources[index];
                    var observer = new WhenAllCollectionObserver(this, index);
                    subscriptions[index] = source.Subscribe(observer);
                }

                return(StableCompositeDisposable.CreateUnsafe(subscriptions));
            }
Example #3
0
            public IDisposable Run()
            {
                _length = _sources.Length;

                if (_length == 0)
                {
                    OnNext(new T[0]);
                    try { Observer.OnComplete(); } finally { Dispose(); }

                    return(Disposable.Empty);
                }

                _completedCount = 0;
                _values         = new T[_length];

                var disposable = new CompositeDisposable();

                for (int index = 0; index < _length; index++)
                {
                    var source   = _sources[index];
                    var observer = new WhenAllCollectionObserver(this, index);
                    var d        = source.Subscribe(observer);

                    disposable.Add(d);
                }

                _cancel = disposable;
                return(disposable);
            }