Beispiel #1
0
 protected override void Execute()
 {
     if (_activeContent != null)
     {
         _activeContent.Undo();
     }
 }
Beispiel #2
0
        public void Undo()
        {
            if (undoStack.Count == 0)
            {
                return;
            }

            IUndoable <T> action = undoStack.Pop();
            T             obj    = action.Undo();

            if (ReferenceEquals(action, undoCleanAction))
            {
                fileIsClean.OnNext(Unit.Default);
            }

            affectedObject.OnNext(obj);
            AddRedo(action);

            if (undoStack.Count == 0)
            {
                NotifyUndoUnavailable();
            }
            else
            {
                undoDescription.OnNext(undoStack.Peek().Description);
            }
        }
 /// <summary>
 /// Undo the last action.
 /// </summary>
 public void Undo()
 {
     if (UndoableActions.Count > 0)
     {
         IUndoable action = UndoableActions.Pop();
         action.Undo();
         RedoableActions.Push(action);
     }
 }
Beispiel #4
0
 /// <summary>
 /// 执行撤销操作
 /// </summary>
 public virtual void Undo(XUndoEventArgs args)
 {
     for (int iCount = myItems.Count - 1; iCount >= 0; iCount--)
     {
         IUndoable undo = ( IUndoable )myItems[iCount];
         undo.InGroup = true;
         undo.Undo(args);
         //( ( IUndoable )myItems[ iCount ]).Undo();
     }
 }
Beispiel #5
0
    public bool Undo()
    {
        bool result = undoStack.Count > 0;

        if (result)
        {
            IUndoable c = undoStack.Pop();
            redoStack.Push(c);
            c.Undo();
        }
        return(result);
    }
        public void UndoCommand()
        {
            if (commandHistory.Count == 0)
            {
                return;
            }
            IUndoable lastCommand = commandHistory.Pop() as IUndoable;

            if (lastCommand != null)
            {
                lastCommand.Undo();
            }
        }
Beispiel #7
0
        /// <summary>
        /// Undoes the last done command
        /// </summary>
        public void Undo()
        {
            if (undoStack.Count > 0)
            {
                IUndoable command = undoStack.Last.Value;
                if (command.CanUndo)
                {
                    command.Undo();
                    undoStack.RemoveLast();
                    redoStack.AddLast(command);
                }
                else
                {
#if DEBUG
                    // WHY CANT UNDO?
                    System.Diagnostics.Debugger.Break();
#endif
                }
            }
        }
Beispiel #8
0
        /// <summary>
        /// If possible, undo the top action on the undo stack.
        /// The action is moved onto the redo stack
        /// If not possible, throws an InvalidOperationException
        /// </summary>
        public void Undo()
        {
            if (!CanUndo)
            {
                throw new InvalidOperationException();
            }

            IUndoable action = undos.Pop();

            action.Undo();
            redos.Push(action);

            if (savepoint.HasValue)
            {
                // it will now take one more "redo" to reach the save point
                savepoint++;
            }

            NotifyAllProps();
        }
Beispiel #9
0
        /// <summary>
        /// 执行一次撤销操作
        /// </summary>
        public void Undo(XUndoEventArgs args)
        {
            if (intPosition < 0)
            {
                return;
            }
            bool back = bolLock;

            this.bolLock = true;
            try
            {
                IUndoable undo = this.Current;
                intPosition--;
                if (undo != null)
                {
                    undo.Undo(args);
                }
                OnStateChanged();
            }
            finally
            {
                bolLock = back;
            }
        }
Beispiel #10
0
 public void Do()
 {
     _undoable.Undo();
 }
Beispiel #11
0
 public void Redo()
 {
     iud.Undo();
 }