/// <inheritdoc/>
        public void Transact(IReversableCommand command, object parameter)
        {
            RedoStack.Clear();
            Action undo = command.Execute(parameter);

            Action redo() => command.Execute(parameter);

            UndoStack.Push(new UndoRedo(undo, redo));
            Transacted?.Invoke();
        }
Example #2
0
 private Action Undo(object parameter) => () =>
 {
     if (!_hasBeenUndone)
     {
         _command.Execute(parameter);
         _hasBeenUndone = true;
     }
 };
 /// <inheritdoc/>
 public Action Execute(object parameter)
 {
     _command.Execute(parameter);
     return(() => _undoCommand.Execute(parameter));
 }
Example #4
0
 /// <inheritdoc/>
 public void Transact(IReversableCommand command, object parameter)
 {
     command.Execute(parameter);
     Transacted?.Invoke();
 }