예제 #1
0
        private void NodeChanging(object sender, XmlNodeChangedEventArgs e)
        {
            if (this._Undoing)
            {
                return;
            }

            switch (e.Action)
            {
            case XmlNodeChangedAction.Insert:
                _pState = NodeInsertedUndo.PreviousState(e);
                break;

            case XmlNodeChangedAction.Remove:
                _pState = NodeRemovedUndo.PreviousState(e);
                break;

            case XmlNodeChangedAction.Change:
                _pState = NodeChangedUndo.PreviousState(e);
                break;

            default:
                throw new Exception("Unknown Action");
            }
        }
예제 #2
0
        private void NodeChanged(object sender, XmlNodeChangedEventArgs e)
        {
            if (this._Undoing)
            {
                // if we're undoing ignore the event since it is the result of an undo
                _pState  = null;
                _Undoing = false;
                return;
            }

            UndoItem undo = null;

            switch (e.Action)
            {
            case XmlNodeChangedAction.Insert:
                undo = new NodeInsertedUndo(e, _pState);
                break;

            case XmlNodeChangedAction.Remove:
                undo = new NodeRemovedUndo(e, _pState);
                break;

            case XmlNodeChangedAction.Change:
                undo = new NodeChangedUndo(e, _pState);
                break;

            default:
                throw new Exception("Unknown Action");
            }
            _pState = null;
            if (_currentUndoGroup != null)
            {
                _currentUndoGroup.AddUndoItem(undo);
            }
            else if (GroupsOnly)
            {
                _pState = null;
            }
            else
            {
                _actions.Push(undo);
            }
        }
예제 #3
0
        private void NodeChanged(object sender, XmlNodeChangedEventArgs e)
        {
            if (this._Undoing)
            {
                // if we're undoing ignore the event since it is the result of an undo
                _pState = null;
                _Undoing = false;
                return;
            }

            UndoItem undo = null;
            switch (e.Action)
            {
                case XmlNodeChangedAction.Insert:
                    undo = new NodeInsertedUndo(e, _pState);
                    break;
                case XmlNodeChangedAction.Remove:
                    undo = new NodeRemovedUndo(e, _pState);
                    break;
                case XmlNodeChangedAction.Change:
                    undo = new NodeChangedUndo(e, _pState);
                    break;
                default:
                    throw new Exception("Unknown Action");
            }
            _pState = null;
            if (_currentUndoGroup != null)
            {
                _currentUndoGroup.AddUndoItem(undo);
            }
            else if (GroupsOnly)
            {
                _pState = null;
            }
            else
            {
                _actions.Push(undo);
            }
        }