Beispiel #1
0
        protected bool ExecuteActionInternal(IUndoableAction action, bool clearRedoStack)
        {
            OnBeforeStateChanged();

            if (!action.Execute())
            {
                return(false);
            }

            if (clearRedoStack)
            {
                redoStack.Clear();
            }

            var undoGroup = action.GetUndoGroup();

            // Should we group together this undo step with more of the same kind?
            if (undoGroup != 0)
            {
                if (currentGroup == null || currentGroup.CaughtGroup != undoGroup)
                {
                    currentGroup = new UndoableActionGroup(undoGroup);
                    AddToUndoStack(currentGroup);
                }

                currentGroup.Actions.Add(action);
            }
            else
            {
                AddToUndoStack(action);
            }

            OnAfterStateChanged();
            return(true);
        }
Beispiel #2
0
 public void ExecuteAction(IUndoableAction action)
 {
     action.Execute();
     Push(_undoStack, action);
     _redoStack.Clear();
     EnforceLimit();
 }
Beispiel #3
0
 public void ExecuteAction(IUndoableAction action)
 {
     action.Execute();
     Push(_undoStack, action);
     _redoStack.Clear();
     EnforceLimit();
 }
 public void Execute(IUndoableAction action)
 {
     action.Execute();
     Push(UndoStack, action);
     RedoStack.Clear();
 }
Beispiel #5
0
 public void Execute(IUndoableAction action)
 {
     action.Execute();
     _undoableActions.Push(action);
     _redoableActions.Clear();
 }