private string GetBranchPosition(string parentId, string name)
{
string methodName = "IOPCHDA_Browser.GetBranchPosition";
// need to move down to get the browse position.
if (!String.IsNullOrEmpty(name))
{
if (!ChangeBrowsePosition(OPCHDA_BROWSEDIRECTION.OPCHDA_BROWSE_DOWN, name))
{
return null;
}
}
string itemId = null;
try
{
IOPCHDA_Browser server = BeginComCall<IOPCHDA_Browser>(methodName, true);
server.GetBranchPosition(out itemId);
}
catch (Exception e)
{
ComCallError(methodName, e);
return null;
}
finally
{
EndComCall(methodName);
// restore browse position.
if (!String.IsNullOrEmpty(name))
{
ChangeBrowsePosition(OPCHDA_BROWSEDIRECTION.OPCHDA_BROWSE_DIRECT, parentId);
}
}
return itemId;
}