IfcDoc.FormEdit.SortPropertyEnumeration C# (CSharp) Method

SortPropertyEnumeration() private method

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

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