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); }
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); }
static Task Apply(Metadata meta, ActionOccured actionOccured, State s) { s.Value += 1; return(Task.CompletedTask); }