public GetNodeList ( IList |
||
nodes | IList |
|
namespaceUris | NamespaceTable | |
Результат | List |
public List<NodeId> GetNodeList(IList<TestNode> nodes, NamespaceTable namespaceUris)
{
List<NodeId> nodeIds = new List<NodeId>();
if (nodes != null)
{
for (int ii = 0; ii < nodes.Count; ii++)
{
TestNode node = nodes[ii];
if (node == null || String.IsNullOrEmpty(node.Id))
{
continue;
}
try
{
NodeId nodeId = NodeId.Parse(node.Id);
// translate namespace index.
if (nodeId.NamespaceIndex > 1 && namespaceUris != null)
{
string uri = null;
if (NamespaceUris != null && NamespaceUris.Count >= nodeId.NamespaceIndex-2)
{
uri = NamespaceUris[nodeId.NamespaceIndex-2];
}
if (uri != null)
{
int index = namespaceUris.GetIndex(uri);
if (index >= 0)
{
nodeId = new NodeId(nodeId.Identifier, (ushort)index);
}
}
}
nodeIds.Add(nodeId);
}
catch
{
// ignore parsing errors.
}
}
}
return nodeIds;
}
private void Test_BrowseRootsMI_Click(object sender, EventArgs e) { try { using (Session session = CreateSession()) { List <NodeId> nodeIds = m_testConfiguration.GetNodeList(m_testConfiguration.BrowseRoots, session.NamespaceUris); IList <ILocalNode> nodes = new SelectNodesDlg().ShowDialog(session, null, nodeIds); if (nodes != null) { if (m_testConfiguration.BrowseRoots == null) { m_testConfiguration.BrowseRoots = new ListOfTestNode(); } m_testConfiguration.ReplaceNodeList(m_testConfiguration.BrowseRoots, nodes, session.NamespaceUris); } } } catch (Exception exception) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception); } }