示例#1
0
 public void Redo()
 {
     if (RedoList.Count > 0)
     {
         IUndoableAction act = RedoList.Pop();
         act.Redo(this);
         OnRedoChanged(RedoChangedEventArgs.Empty);
         //UndoList.Clear();
         UndoList.Push(act);
         OnUndoChanged(UndoChangedEventArgs.Empty);
     }
 }
示例#2
0
        public IAction Redo()
        {
            if (redoStack.Count > 0)
            {
                IUndoableAction action = null;

                while (redoStack.Count > 0)
                {
                    action = redoStack.Pop();
                    Logger.Log(LOGKEY, "redo action: " + action.ToString());

                    if (BeforePerformAction != null)
                    {
                        var arg = new ActionEventArgs(action, ActionBehavior.Redo);
                        BeforePerformAction(this, arg);
                        if (arg.Cancel)
                        {
                            break;
                        }
                    }

                    action.Redo();
                    undoStack.Add(action);

                    AfterPerformAction?.Invoke(this, new ActionEventArgs(action, ActionBehavior.Redo));

                    if (!(action is ISerialUndoAction))
                    {
                        break;
                    }
                }

                return(action);
            }
            else
            {
                return(null);
            }
        }