Esempio n. 1
0
 /// <summary>
 /// Redoes the last undone command, popping it from the undone stack and pushing it onto the done stack.
 /// </summary>
 public void RedoLastUndoneCommand()
 {
     try
     {
         MapEditorCommand command = undone.Pop();
         command.Do();
         done.Push(command);
     }
     catch (InvalidOperationException)
     {
         // The stack was empty, do nothing.
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Executes a command, placing it on the stack.  This empties the Redo stack, losing those commands permanently.  This function does not check if a command
 /// can be done, so all code using the CommandStack should call CanBeDone() on the command before passing it to the CommandStack.
 /// </summary>
 /// <param name="command"></param>
 public void ExecuteCommand(MapEditorCommand command)
 {
     command.Do();
     done.Push(command);
     undone.Clear();
 }
 /// <summary>
 /// Executes a command, placing it on the stack.  This empties the Redo stack, losing those commands permanently.  This function does not check if a command
 /// can be done, so all code using the CommandStack should call CanBeDone() on the command before passing it to the CommandStack.
 /// </summary>
 /// <param name="command"></param>
 public void ExecuteCommand(MapEditorCommand command)
 {
     command.Do();
     done.Push(command);
     undone.Clear();
 }