Ejemplo n.º 1
0
        public void Execute()
        {
            if (!_action.CanExecute())
            {
                return;
            }

            _action.ExecuteDo();
            _undoableActions.Push(_action);
            _redoableActions.Clear();
        }
Ejemplo n.º 2
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>
        /// <param name="clearRedo">
        /// A boolean representing whether to clear the redo stack.
        /// </param>
        public void Execute(IUndoable action)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            if (action.CanExecute())
            {
                action.Execute();
                UndoableActions.Push(action);
                RedoableActions.Clear();
            }
        }
Ejemplo n.º 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;
        }