Esempio n. 1
0
 /// <summary>
 /// Redo the last undone command
 /// </summary>
 public void Redo()
 {
     if (redoStack.Count > 0)
     {
         IUndoable command = redoStack.Last.Value;
         if (command.CanRedo)
         {
             command.Do();
             redoStack.RemoveLast();
             undoStack.AddLast(command);
         }
     }
 }
Esempio n. 2
0
        public void Do(IUndoable undoable)
        {
            while (cursorPosition != null)
            {
                var nextNode = cursorPosition.Next;
                stack.Remove(cursorPosition);
                cursorPosition = nextNode;
            }

            while (stack.Count > MaxUndoElements)
            {
                stack.RemoveFirst();
            }

            stack.AddLast(undoable);
            undoable.Do();
        }
Esempio n. 3
0
 /// <summary>
 ///     Executes a command and adds it to the command history so it can
 ///     be undone/redone.
 /// </summary>
 /// <param name="command">The command to execute and keep history of.</param>
 public void Execute(IUndoable command)
 {
     command.Do();
     AddCommand(command);
 }
Esempio n. 4
0
 /// <summary>
 ///     Executes a command and adds it to the command history so it can
 ///     be undone/redone.
 /// </summary>
 /// <param name="command">The command to execute and keep history of.</param>
 public void Execute(IUndoable command)
 {
     command.Do();
     AddCommand(command);
 }
Esempio n. 5
0
 public void Undo()
 {
     _undoable.Do();
 }