private void SortType()
{
TreeNode tn = this.treeView.SelectedNode;
DocType docType = (DocType)tn.Tag;
DocSchema docSchema = (DocSchema)tn.Parent.Parent.Tag;
int indexOld = docSchema.Types.IndexOf(docType);
docSchema.SortTypes();
int indexNew = docSchema.Types.IndexOf(docType);
if (indexNew != indexOld)
{
TreeNode tnParent = tn.Parent;
tn.Remove();
tnParent.Nodes.Insert(indexNew, tn);
this.treeView.SelectedNode = tn;
}
}