示例#1
0
        public void Merge(CompoundCommand cmd)
        {
            // Replace the current command without upsetting rest of the redo stack
            // and insert the current command into this compound command.
            Command current = Peek();

            if (current != null)
            {
                _stack.Insert(_pos - 1, cmd);
                _stack.RemoveAt(_pos);
                cmd.Do();
                cmd.Insert(current);
            }
            else
            {
                Push(cmd);
            }
        }
 public void Merge(CompoundCommand cmd)
 {
     // Replace the current command without upsetting rest of the redo stack
     // and insert the current command into this compound command.
     Command current = Peek();
     if (current != null) {
         stack.Insert(pos-1, cmd);
         stack.RemoveAt(pos);
         cmd.Do();
         cmd.Insert(current);
     } else {
         Push(cmd);
     }
 }