private void ServerCTRL_ConnectComplete(object sender, EventArgs e)
        {
            try
            {
                Session session = ServerCTRL.Session;

                if (session != null)
                {
                    ushort   namespaceIndex   = (ushort)session.NamespaceUris.GetIndex(Opc.Ua.Namespaces.OpcUaGds);
                    NodeId   rootId           = new NodeId(GdsId_Directory_Applications, namespaceIndex);
                    NodeId[] referenceTypeIds = new NodeId[] { Opc.Ua.ReferenceTypeIds.Organizes, Opc.Ua.ReferenceTypeIds.HasChild };

                    BrowseCTRL.Initialize(session, rootId, referenceTypeIds);
                    SystemElementBTN.Session          = session;
                    SystemElementBTN.RootId           = rootId;
                    SystemElementBTN.ReferenceTypeIds = referenceTypeIds;
                }
                else
                {
                    BrowseCTRL.ChangeSession(session);
                    SystemElementBTN.Session = session;
                }
            }
            catch (Exception exception)
            {
                ClientUtils.HandleException(this.Text, exception);
            }
        }
예제 #2
0
        /// <summary>
        /// Changes the session used.
        /// </summary>
        public void ChangeSession(Session session)
        {
            if (!Object.ReferenceEquals(session, m_session))
            {
                m_session = session;

                BrowseCTRL.ChangeSession(m_session);
                EventTypeCTRL.ChangeSession(m_session);
                EventFilterCTRL.ChangeSession(m_session);
                EventsCTRL.ChangeSession(m_session);

                if (m_subscription != null)
                {
                    m_subscription.PublishStatusChanged -= m_PublishStatusChanged;
                    m_subscription.FastEventCallback     = null;
                    m_subscription = null;
                }

                if (m_session != null)
                {
                    // find new subscription.
                    foreach (Subscription subscription in m_session.Subscriptions)
                    {
                        if (Object.ReferenceEquals(subscription.Handle, this))
                        {
                            m_subscription = subscription;
                            m_subscription.PublishStatusChanged += m_PublishStatusChanged;
                            m_subscription.FastEventCallback     = OnEvent;
                            break;
                        }
                    }
                }
            }
        }
예제 #3
0
 private void ServerCTRL_ReconnectComplete(object sender, EventArgs e)
 {
     try {
         Session session = ServerCTRL.Session;
         BrowseCTRL.ChangeSession(session);
         SystemElementBTN.Session = session;
     } catch (Exception exception) {
         ClientUtils.HandleException(this.Text, exception);
     }
 }
예제 #4
0
 /// <summary>
 /// Updates the application after a communicate error was detected.
 /// </summary>
 private void Server_ReconnectStarting(object sender, EventArgs e)
 {
     try
     {
         BrowseCTRL.ChangeSession(null);
     }
     catch (Exception exception)
     {
         ClientUtils.HandleException(this.Text, exception);
     }
 }
예제 #5
0
 /// <summary>
 /// Updates the application after reconnecting to the server.
 /// </summary>
 private void Server_ReconnectComplete(object sender, EventArgs e)
 {
     try
     {
         m_session = ConnectServerCTRL.Session;
         BrowseCTRL.ChangeSession(m_session);
     }
     catch (Exception exception)
     {
         ClientUtils.HandleException(this.Text, exception);
     }
 }
예제 #6
0
        /// <summary>
        /// Updates the application after reconnecting to the server.
        /// </summary>
        private void Server_ReconnectComplete(object sender, EventArgs e)
        {
            try
            {
                m_session = ConnectServerCTRL.Session;
                BrowseCTRL.ChangeSession(m_session);

                #region Task #B3 - Subscribe Data
                if (m_SubscribeDataDlg != null)
                {
                    m_SubscribeDataDlg.ReconnectComplete(m_session);
                }
                #endregion
            }
            catch (Exception exception)
            {
                ClientUtils.HandleException(this.Text, exception);
            }
        }
예제 #7
0
        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);
            }
        }
예제 #8
0
 /// <summary>
 /// Changes the session used by the control.
 /// </summary>
 /// <param name="session">The session.</param>
 public void ChangeSession(Session session)
 {
     BrowseCTRL.ChangeSession(session);
 }