private void Subservice_StateSet(object sender, StateSetEventArgs e) { if (!_isInternallySettingState) { var subserviceIndex = ((SubUndoService)sender).Index; _undoStack.DeleteLast(subserviceIndex); _redoStack.Push(subserviceIndex); } StateSet?.Invoke(this, e); }
/// <summary> /// /// </summary> public void Undo() { _undoServiceValidator.ValidateUndo(); //If tagging is used, the part of the state that will be changed by this will be tagged in _currentState (the change there will be undone). var args = new StateSetEventArgs { Tag = _currentState.Tag, SettingAction = StateSetAction.Undo }; var memento = _undoStack.Pop(); SetState(memento.State); _redoStack.Push(_currentState); _currentState = memento; StateSet?.Invoke(this, args); }
private void UndoService_StateSet(object sender, StateSetEventArgs e) { StateSet?.Invoke(this, e); }