Example #1
0
        public void Undo(Command command)
        {
            if (!m_undoCommandStack.Contains(command))
                throw new Exception("The command is not in the undo stack");

            while (m_undoCommandStack.Peek() != command)
                Undo();

            Undo();
        }
Example #2
0
 public void UndoOrRedo(Command command)
 {
     if (m_undoCommandStack.Contains(command))
         Undo(command);
     else if (m_redoCommandStack.Contains(command))
         Redo(command);
     else
         throw new Exception("The command is not in the undo/redo command history");
 }
Example #3
0
 public void Do(Command command)
 {
     command.Do();
     m_undoCommandStack.Push(command);
     m_redoCommandStack.Clear();
 }