/// <summary> /// Displays the a root in the control. /// </summary> public void Initialize( Session session, NodeId rootId, NodeId viewId, NodeId referenceTypeId, BrowseDirection browseDirection) { m_session = session; m_rootId = rootId; m_viewId = viewId; m_referenceTypeId = referenceTypeId; m_browseDirection = browseDirection; NodesTV.Nodes.Clear(); if (m_session == null) { return; } if (NodeId.IsNull(m_rootId)) { m_rootId = Objects.RootFolder; } if (NodeId.IsNull(m_referenceTypeId)) { m_referenceTypeId = ReferenceTypeIds.HierarchicalReferences; } ReferenceTypeCTRL.Initialize(m_session, ReferenceTypeIds.HierarchicalReferences); ReferenceTypeCTRL.SelectedTypeId = m_referenceTypeId; ILocalNode root = m_session.NodeCache.Find(m_rootId) as ILocalNode; if (root == null) { return; } ReferenceDescription reference = new ReferenceDescription(); reference.ReferenceTypeId = referenceTypeId; reference.IsForward = true; reference.NodeId = root.NodeId; reference.NodeClass = root.NodeClass; reference.BrowseName = root.BrowseName; reference.DisplayName = root.DisplayName; reference.TypeDefinition = root.TypeDefinitionId; TreeNode rootNode = new TreeNode(reference.ToString()); rootNode.ImageKey = rootNode.SelectedImageKey = GuiUtils.GetTargetIcon(session, reference); rootNode.Tag = reference; rootNode.Nodes.Add(new TreeNode()); NodesTV.Nodes.Add(rootNode); }
/// <summary> /// Prompts the user to specify the browse options. /// </summary> public bool ShowDialog(Browser browser) { if (browser == null) { throw new ArgumentNullException("browser"); } m_browser = browser; ReferenceTypeCTRL.Initialize(m_browser.Session, null); ViewIdTB.Text = null; ViewTimestampDP.Value = ViewTimestampDP.MinDate; ViewVersionNC.Value = 0; if (browser.View != null) { ViewIdTB.Text = String.Format("{0}", browser.View.ViewId); ViewVersionNC.Value = browser.View.ViewVersion; ViewVersionCK.Checked = browser.View.ViewVersion != 0; if (browser.View.Timestamp > ViewTimestampDP.MinDate) { ViewTimestampDP.Value = browser.View.Timestamp; ViewTimestampCK.Checked = true; } } MaxReferencesReturnedNC.Value = browser.MaxReferencesReturned; BrowseDirectionCB.SelectedItem = browser.BrowseDirection; ReferenceTypeCTRL.SelectedTypeId = browser.ReferenceTypeId; IncludeSubtypesCK.Checked = browser.IncludeSubtypes; NodeClassMaskCK.Checked = browser.NodeClassMask != 0; NodeClassList.Items.Clear(); foreach (NodeClass value in Enum.GetValues(typeof(NodeClass))) { if (value == NodeClass.Unspecified) { continue; } int index = NodeClassList.Items.Add(value); NodeClassList.SetItemChecked(index, (browser.NodeClassMask & (int)value) != 0); } if (ShowDialog() != DialogResult.OK) { return(false); } return(true); }