IfcDoc.FormEdit.SortPset C# (CSharp) Method

SortPset() private method

private SortPset ( ) : void
return void
        private void SortPset()
        {
            TreeNode tn = this.treeView.SelectedNode;
            DocPropertySet docEntity = (DocPropertySet)tn.Tag;

            DocSchema docSchema = (DocSchema)this.treeView.SelectedNode.Parent.Parent.Tag;
            int indexOld = docSchema.PropertySets.IndexOf(docEntity);
            docSchema.SortPropertySets();
            int indexNew = docSchema.PropertySets.IndexOf(docEntity);
            if (indexNew != indexOld)
            {
                TreeNode tnParent = tn.Parent;
                tn.Remove();
                tnParent.Nodes.Insert(indexNew, tn);
                this.treeView.SelectedNode = tn;
            }
        }
FormEdit