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