Esempio n. 1
0
 public Command Undo()
 {
     if (_pos > 0)
     {
         _pos--;
         Command cmd = this.Current;
         if (cmd != null && !cmd.IsNoop)
         {
             Command saved = this._exec;
             try
             {
                 this._exec = cmd;
                 cmd.Undo();
             }
             finally
             {
                 this._exec = saved;
             }
             if (StateChanged != null)
             {
                 StateChanged(this, EventArgs.Empty);
             }
             if (CommandUndone != null)
             {
                 CommandUndone(this, new CommandEventArgs(cmd));
             }
         }
         return(cmd);
     }
     return(null);
 }
Esempio n. 2
0
 public override void Undo()
 {
     // Must undo in reverse order!
     for (int i = this.commands.Count - 1; i >= 0; i--)
     {
         Command cmd = this.commands[i];
         cmd.Undo();
     }
 }