Exemplo n.º 1
0
        /// <summary>Undo an action. Calls IHistoryAction.Undo().</summary>
        /// <remarks>Does nothing if there is no action to undo.</remarks>
        public void Undo()
        {
            if (undo.Count == 0)
            {
                return;
            }

            IHistoryAction action = undo.Pop();

            redo.Push(action);
            action.Undo();
        }
        public void Undo()
        {
            if (_history.Count == 0)
            {
                throw new NothingToUndoException();
            }

            IHistoryAction action = _history.Pop();

            _future.Push(action);
            _acceptNew = false;
            action.Undo();
            _acceptNew = true;

            CanUndo = _history.Count > 0;
            CanRedo = true;
        }