public void AddHandler(HistoryHandler handler) { handler.ActionPush += (sender, action) => { if (!_acceptNew) { return; } _history.Push(action); Past.Add(action); _future.Clear(); Future.Clear(); CanRedo = false; CanUndo = true; }; }
public void Redo() { if (_future.Count == 0) { throw new NothingToRedoException(); } IHistoryAction action = _future.Pop(); _history.Push(action); Future.RemoveAt(0); Past.Add(action); _acceptNew = false; action.Redo(); _acceptNew = true; CanUndo = true; CanRedo = _future.Count > 0; }