/// <summary> /// Updates the application after connecting to or disconnecting from the server. /// </summary> private void Server_ConnectComplete(object sender, EventArgs e) { try { m_session = ConnectServerCTRL.Session; // browse the instances in the server. BrowseCTRL.Initialize(m_session, ObjectIds.ObjectsFolder, ReferenceTypeIds.Organizes, ReferenceTypeIds.Aggregates); } catch (Exception exception) { ClientUtils.HandleException(this.Text, exception); } }
/// <summary> /// Updates the application after connecting to or disconnecting from the server. /// </summary> private void Server_ConnectComplete(object sender, EventArgs e) { try { m_session = ConnectServerCTRL.Session; // set a suitable initial state. if (m_session != null && !m_connectedOnce) { m_connectedOnce = true; BrowseDescription nodeToBrowse = new BrowseDescription(); nodeToBrowse.NodeId = Opc.Ua.ObjectIds.ViewsFolder; nodeToBrowse.ReferenceTypeId = Opc.Ua.ReferenceTypeIds.HierarchicalReferences; nodeToBrowse.IncludeSubtypes = true; nodeToBrowse.BrowseDirection = BrowseDirection.Forward; nodeToBrowse.NodeClassMask = 0; nodeToBrowse.ResultMask = (uint)BrowseResultMask.All; ReferenceDescriptionCollection references = ClientUtils.Browse(m_session, nodeToBrowse, false); ViewCB.Items.Clear(); ViewCB.Items.Add(new ReferenceDescription() { NodeId = ExpandedNodeId.Null, DisplayName = "None" }); if (references != null) { for (int ii = 0; ii < references.Count; ii++) { ViewCB.Items.Add(references[ii]); } } ViewCB.SelectedIndex = 0; } // browse the instances in the server. BrowseCTRL.Initialize(m_session, ObjectIds.ObjectsFolder, ReferenceTypeIds.Organizes, ReferenceTypeIds.Aggregates); } catch (Exception exception) { ClientUtils.HandleException(this.Text, exception); } }
/// <summary> /// Prompts the user to select a node. /// </summary> 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); }
/// <summary> /// Moves the sequence forward. /// </summary> public void Next() { if (m_state == DisplayState.ViewUpdates) { return; } if (m_state == DisplayState.SelectEventType) { UpdateFilter(); } SetDisplayState(++m_state); if (m_state == DisplayState.SelectEventType) { BrowseCTRL.Initialize(m_session, Opc.Ua.ObjectTypeIds.BaseEventType, Opc.Ua.ReferenceTypeIds.HasSubtype); BrowseCTRL.SelectNode((m_filter == null || m_filter.EventTypeId == null) ? Opc.Ua.ObjectTypeIds.BaseEventType : m_filter.EventTypeId); EventTypeCTRL.ShowType(Opc.Ua.ObjectTypeIds.BaseEventType); return; } if (m_state == DisplayState.SelectEventFields) { EventFilterCTRL.SetFilter(m_filter); return; } if (m_state == DisplayState.ApplyChanges) { UpdateItems(); return; } if (m_state == DisplayState.ViewUpdates) { EventsCTRL.SetFilter(m_filter); return; } }
private void Client_ConnectComplete(object sender, EventArgs e) { this.isServerReg.Checked = false; try { Opc.Ua.Client.Controls.ConnectServerCtrl client = (Opc.Ua.Client.Controls.ConnectServerCtrl)sender; this.isServerReg.Checked = m_server.isClientRegistered(client.ServerUrl); if (client.Session == null) { return; } BrowseCTRL.Initialize(client.Session, ObjectIds.ObjectsFolder, ReferenceTypeIds.Organizes, ReferenceTypeIds.Aggregates); BrowseCTRL.ChangeSession(client.Session); BrowseCTRL.Update(); } catch (Exception E) { Debug.WriteLine(E.Message); } }
/// <summary> /// Updates the application after connecting to or disconnecting from the server. /// </summary> private void Server_ConnectComplete(object sender, EventArgs e) { try { m_session = ConnectServerCTRL.Session; // set a suitable initial state. if (m_session != null && !m_connectedOnce) { m_connectedOnce = true; } // browse the instances in the server. BrowseCTRL.Initialize(m_session, ObjectIds.ObjectsFolder, ReferenceTypeIds.Organizes, ReferenceTypeIds.Aggregates); GetTanks(); } catch (Exception exception) { ClientUtils.HandleException(this.Text, exception); } }
/// <summary> /// Prompts the user to select a node. /// </summary> public ReferenceDescription ShowDialog( Session session, NodeId rootId, ViewDescription view, 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); BrowseCTRL.View = view; // display the dialog. if (ShowDialog() != DialogResult.OK) { return(null); } return(BrowseCTRL.SelectedNode); }
/// <summary> /// Updates the application after connecting to or disconnecting from the server. /// </summary> private void Server_ConnectComplete(object sender, EventArgs e) { try { m_session = ConnectServerCTRL.Session; // browse the instances in the server. BrowseCTRL.Initialize(m_session, ObjectIds.RootFolder, ReferenceTypeIds.Organizes, ReferenceTypeIds.Aggregates, ReferenceTypeIds.HierarchicalReferences); if (m_session != null) { var typeSystem = new ComplexTypeSystem(m_session); typeSystem.Load().Wait(); } } catch (Exception exception) { ClientUtils.HandleException(this.Text, exception); } }