Example #1
0
 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);
 }
Example #2
0
        /// <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);
        }
Example #3
0
 private void UndoService_StateSet(object sender, StateSetEventArgs e)
 {
     StateSet?.Invoke(this, e);
 }