// private void ReParent (Node oldParent, Node newParent, Node node) { try { Node prev = null; Node next = null; prev = node.prevSibling; next = node.nextSibling; if (prev != null) { prev.nextSibling = next; } if (next != null) { next.prevSibling = prev; } if (oldParent.firstChild == node) { oldParent.firstChild = next; } if (oldParent.lastChild == node) { oldParent.lastChild = prev; } node.parent_ = newParent; node.prevSibling = newParent.lastChild; if (newParent.lastChild != null) { newParent.lastChild.nextSibling = node; } node.nextSibling = null; newParent.lastChild = node; if (node.prevSibling == null) { newParent.firstChild = node; } oldParent.numChildren--; newParent.numChildren++; oldParent.UpdateChildrenIndices (); oldParent.UpdateLevel (); newParent.UpdateChildrenIndices (); newParent.UpdateLevel (); } catch { } }