Exemplo n.º 1
0
        public virtual IHistoryAction <TAction, TSender, TState> Redo()
        {
            if (_undoneActions.Count > 0)
            {
                _liveActions.Push(_undoneActions.Pop());

                var top = _undoneActions.Peek();
                top.RedoAction?.Invoke(top, _currentAction);
                RedoOccured?.Invoke(this, top);
                ActionOccured?.Invoke(this, EventArgs.Empty);
                _redoCommand.OnCanExecuteChanged();
                _currentAction = top;
                return(top);
            }
            return(null);
        }
Exemplo n.º 2
0
        public virtual IHistoryAction <TAction, TSender, TState> Undo()
        {
            var count = _liveActions.Count;

            if (count > 1)
            {
                var pop = _liveActions.Pop();
                if (!BackToActionOnUndo)
                {
                    _undoneActions.Push(pop);
                }

                var top = _liveActions.Peek();
                top.UndoAction?.Invoke(top, _currentAction);
                UndoOccured?.Invoke(this, top);
                ActionOccured?.Invoke(this, EventArgs.Empty);
                _undoCommand.OnCanExecuteChanged();
                _currentAction = top;
                return(top);
            }
            return(null);
        }
Exemplo n.º 3
0
 static Task Apply(Metadata meta, ActionOccured actionOccured, State s)
 {
     s.Value += 1;
     return(Task.CompletedTask);
 }