private void btnCancel_Click(object sender, EventArgs e)
        {
            List <SchemaPropertyListItem> removeItems = new List <SchemaPropertyListItem>();

            // Restore selected items to the tree view
            foreach (object item in this.lstProps.SelectedItems)
            {
                SchemaPropertyListItem listItem = (SchemaPropertyListItem)item;
                RestoreNode(listItem.Name);

                removeItems.Add(listItem);
            }

            // Remove items from the list box
            foreach (SchemaPropertyListItem listItem in removeItems)
            {
                this.lstProps.Items.Remove(listItem);
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            TreeNode node = tvwSchemas.SelectedNode;

            // Bail out if there is no selected node(s)
            if (node == null)
            {
                return;
            }

            // If the selected node is a root node then add
            // all the children, otherwise add just the
            // selected node
            if (node.Nodes.Count > 0)
            {
                foreach (TreeNode propNode in node.Nodes)
                {
                    // Create a list item to hold the PropertyDefinition
                    SchemaPropertyListItem item = new SchemaPropertyListItem(
                        GetListItemName(propNode),
                        (PropertyDefinition)propNode.Tag);

                    lstProps.Items.Add(item);
                }

                // Remove all the selected nodes so they can't be
                // selected twice
                node.Nodes.Clear();
            }
            else
            {
                // Create a list item to hold the PropertyDefinition
                SchemaPropertyListItem item = new SchemaPropertyListItem(
                    GetListItemName(node),
                    (PropertyDefinition)node.Tag);

                lstProps.Items.Add(item);

                // Remove the selected node so it can't be
                // selected again
                node.Remove();
            }
        }