public override void redo() { // Remove the child from the parent if ((mParentNode != null) && (mDeletedNode != null)) { mDeletedNodeIndex = mParentNode.indexOf(mDeletedNode); mParentNode.removeChild(mDeletedNode); TreeNode parentTreeNode = findTreeNode(mParentNode); for (int i = 0; i < parentTreeNode.Nodes.Count; i++) { TreeNode curTreeNode = parentTreeNode.Nodes[i]; if (curTreeNode.Tag == mDeletedNode) { mDeletedTreeNodeIndex = i; parentTreeNode.Nodes.Remove(curTreeNode); break; } } // Update parent tree node text mParentNode.updateTreeNodeText(parentTreeNode); } }
public override void undo() { // Remove the child from the parent if ((mParentNode != null) && (mAddedNode != null)) { mParentNode.removeChild(mAddedNode); TreeNode parentTreeNode = findTreeNode(mParentNode); foreach (TreeNode curTreeNode in parentTreeNode.Nodes) { if (curTreeNode.Tag == mAddedNode) { parentTreeNode.Nodes.Remove(curTreeNode); break; } } // Update parent tree node text mParentNode.updateTreeNodeText(parentTreeNode); } }