示例#1
0
 public void Undo()
 {
     for (int i = 0; i <= _commands.Count; i++)
     {
         if (_current > 0)
         {
             INGCommand command = _commands[--_current] as INGCommand;
             command.Undo();
         }
     }
 }
示例#2
0
 public void Execute(INGCommand command)
 {
     try
     {
         command.Execute();
         _commands.Add(command);
         _current++;
     }
     catch (Exception ex)
     {
         Undo();
         throw ex;
     }
 }