Exemple #1
0
        /// <summary>
        /// Adds an item that pauses sequencing until a given disposable is disposed.
        /// It returns that disposable immediately, so that you store it and dispose
        /// it at any point in time. You can even dispose it before the gate is
        /// reached in the sequence.
        /// </summary>
        public static IDisposable AddLapse(this ISequencer This)
        {
            var lapse = Lapse.Create();

            This.Add(lapse);
            return(lapse);
        }
        public void Complete()
        {
            if (!_isStarted)
            {
                return;
            }

            _subscriptionLapse.Dispose();
            _subscriptionLapse = null;
            _isStarted         = false;
            _currentExecution?.Dispose();
        }
        public IDisposable Subscribe(ICompletableObserver observer)
        {
            if (!_isStarted)
            {
                _subscriptionLapse = Lapse.Create();
                _isStarted         = true;
                StartNext();
            }

            return(new CompositeDisposable(
                       Disposable.Create(Complete),
                       _subscriptionLapse.Subscribe(observer)));
        }
Exemple #4
0
 /// <summary>
 /// Adds a gate that pauses sequencing until a given disposable is disposed.
 /// It passes that disposable to a lambda expression that will be invoked
 /// only when the gate is reached in the sequence, so that you may then
 /// invoke some operation/animation/tween and finally dispose the disposable
 /// once completed.
 /// </summary>
 public static object AddLapse(this ISequencer This, Action <IDisposable> action) =>
 This.Add(() => Lapse.Create(action));