public NodeId ShowDialog(
Session session,
NodeId rootId,
string caption,
params NodeId[] referenceTypeIds)
{
// set the caption.
if (!String.IsNullOrEmpty(caption))
{
this.Text = caption;
}
// set default root.
if (NodeId.IsNull(rootId))
{
rootId = Opc.Ua.ObjectIds.ObjectsFolder;
}
// set default reference type.
if (referenceTypeIds == null)
{
referenceTypeIds = new NodeId[] { Opc.Ua.ReferenceTypeIds.HierarchicalReferences };
}
// initialize the control.
BrowseCTRL.Initialize(session, rootId, referenceTypeIds);
// display the dialog.
if (ShowDialog() != DialogResult.OK)
{
return null;
}
// convert to a node id.
ReferenceDescription reference = BrowseCTRL.SelectedNode;
if (reference != null && !reference.NodeId.IsAbsolute)
{
return (NodeId)reference.NodeId;
}
return null;
}