public void Undo() { if (_history.Count == 0) { throw new NothingToUndoException(); } IHistoryAction action = _history.Pop(); _future.Push(action); Past.RemoveAt(Past.Count - 1); Future.Insert(0, action); _acceptNew = false; action.Undo(); _acceptNew = true; CanUndo = _history.Count > 0; CanRedo = true; }