Ejemplo n.º 1
0
 /// <inheritdoc/>
 public bool Redo()
 {
     if (Redos.Count > 0)
     {
         IsPaused = true;
         var state = Redos.Pop();
         if (Redos.Count == 0)
         {
             _canRedo.OnNext(false);
         }
         state.Redo.Invoke();
         Undos.Push(state);
         _canUndo.OnNext(true);
         _canClear.OnNext(true);
         IsPaused = false;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public void Snapshot(Action undo, Action redo)
        {
            if (undo == null)
            {
                throw new ArgumentNullException(nameof(undo));
            }

            if (redo == null)
            {
                throw new ArgumentNullException(nameof(redo));
            }

            if (Redos.Count > 0)
            {
                Redos.Clear();
                _canRedo.OnNext(false);
            }
            Undos.Push(new State(undo, redo));
            _canUndo.OnNext(true);
            _canClear.OnNext(true);
        }