Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 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);
            }
        }