protected bool GetNodesInHierarchy()
{
// get list of starting nodes.
IList<NodeId> nodesToBrowse = Configuration.GetNodeList(Configuration.BrowseRoots, this.Session.NamespaceUris);
if (nodesToBrowse.Count == 0)
{
nodesToBrowse.Add(Objects.RootFolder);
}
// follow tree from each starting node.
bool success = true;
double increment = MaxProgress/nodesToBrowse.Count;
double position = 0;
for (int ii = 0; ii < nodesToBrowse.Count; ii++)
{
ILocalNode node = Session.NodeCache.Find(nodesToBrowse[ii]) as ILocalNode;
if (node != null)
{
Log("Browsing children of '{0}'. NodeId = {1}", node, node.NodeId);
try
{
if (!Browse(Node.Copy(node), position, increment))
{
success = false;
}
}
catch (Exception e)
{
success = false;
Log(e, "HierarchicalBrowseTest Failed for Node '{0}'. NodeId = {1}", node, node.NodeId);
}
}
position += increment;
ReportProgress(position);
}
Log("HierarchicalBrowseTest found {0} Nodes", m_availableNodes.Values.Count);
return success;
}