Beispiel #1
0
        public void Execute()
        {
            if (!_action.CanExecute())
            {
                return;
            }

            _action.ExecuteDo();
            _undoableActions.Push(_action);
            _redoableActions.Clear();
        }
Beispiel #2
0
        /// <summary>
        /// Redo the last undone action.
        /// </summary>
        public void Redo()
        {
            if (_redoableActions.Count <= 0)
            {
                return;
            }

            IUndoable action = _redoableActions.Pop();

            action.ExecuteDo();
            _undoableActions.Push(action);
            _saveLoadManager.Unsaved = true;
        }
Beispiel #3
0
        /// <summary>
        /// Executes a specified action and adds it to the stack of undoable actions.
        /// </summary>
        /// <param name="action">
        /// The action to be executed.
        /// </param>
        public void NewAction(IUndoable action)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            if (!action.CanExecute())
            {
                return;
            }

            action.ExecuteDo();
            _undoableActions.Push(action);
            _redoableActions.Clear();
            _saveLoadManager.Unsaved = true;
        }
Beispiel #4
0
 public void Execute()
 {
     _undoableActions.Push(_action);
     _action.ExecuteDo();
 }