Пример #1
0
        /// <summary>
        ///
        /// </summary>
        public void Redo()
        {
            _undoServiceValidator.ValidateRedo();

            var memento = _redoStack.Pop();

            SetState(memento.State);
            _undoStack.Push(_currentState);
            _currentState = memento;

            //If tagging is used, the part of the state that will be changed by this will be tagged in memento (the change there will be applied).
            var args = new StateSetEventArgs {
                Tag = memento.Tag, SettingAction = StateSetAction.Redo
            };

            StateSet?.Invoke(this, args);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        public void Redo()
        {
            _undoServiceValidator.ValidateRedo();

            var lastServiceIndex = _redoStack.Pop();

            _isInternallySettingState = true;
            try
            {
                _subUndoServices[lastServiceIndex].Redo();
            }
            catch
            {
                var resourceManager = new ResourceManager(typeof(StateManagement.Resources));
                throw new InvalidOperationException(resourceManager.GetString("SubServiceRedoFailure"));
            }
            _isInternallySettingState = false;
            _undoStack.Push(lastServiceIndex);
        }