Пример #1
0
        /// <summary>
        /// UI: connects to a specified server endpoint, and create subscription list according to configuration
        /// </summary>
        private async Task <bool> Connect(ConfiguredEndpoint endpoint)
        {
            bool result = false;

            if (endpoint == null)
            {
                return(false);
            }

            // connect dialogs
            Session session = await SessionsCTRL.Connect(endpoint, m_sessionConfig?.sessionname);

            if (session != null)
            {
                if (m_sessionConfig != null)
                {
                    NamespaceTable namespaceTable          = new NamespaceTable();
                    DataValue      namespaceArrayNodeValue = session.ReadValue(VariableIds.Server_NamespaceArray);
                    namespaceTable.Update(namespaceArrayNodeValue.GetValue <string[]>(null));

                    m_sessionConfig.endpoint = session.ConfiguredEndpoint;
                    foreach (MonitoredNode x in m_sessionConfig.monitoredlist)
                    {
                        CreateMonitoredItem(x.description,
                                            session, null, ExpandedNodeId.Parse(x.nodeid, namespaceTable), x.displayname, MonitoringMode.Reporting);
                    }
                }
                m_design_session = session;

                result = true;
            }
            return(result);
        }
Пример #2
0
        /// <summary>
        /// Connects to a server.
        /// </summary>
        public void Connect(ConfiguredEndpoint endpoint)
        {
            if (endpoint == null)
            {
                return;
            }

            Session session = SessionsCTRL.Connect(endpoint);

            if (session != null)
            {
                m_session            = session;
                m_session.KeepAlive += new KeepAliveEventHandler(StandardClient_KeepAlive);
                BrowseCTRL.SetView(m_session, BrowseViewType.Objects, null);
                StandardClient_KeepAlive(m_session, null);
            }
        }
Пример #3
0
        /// <summary>
        /// Connects to a server.
        /// </summary>
        public async Task <bool> Connect(ConfiguredEndpoint endpoint)
        {
            bool result = false;

            if (endpoint == null)
            {
                return(false);
            }

            // connect dialogs
            Session session = await SessionsCTRL.Connect(endpoint);

            if (session != null)
            {
                //hook up new session
                session.KeepAlive += new KeepAliveEventHandler(StandardClient_KeepAlive);
                StandardClient_KeepAlive(session, null);

                result = true;
            }

            return(result);
        }
Пример #4
0
        /// <summary>
        /// Connects to a server.
        /// </summary>
        public async void Connect(ConfiguredEndpoint endpoint)
        {
            if (endpoint == null)
            {
                return;
            }

            Session session = await SessionsCTRL.Connect(endpoint);

            if (session != null)
            {
                // stop any reconnect operation.
                if (m_reconnectHandler != null)
                {
                    m_reconnectHandler.Dispose();
                    m_reconnectHandler = null;
                }

                m_session            = session;
                m_session.KeepAlive += new KeepAliveEventHandler(StandardClient_KeepAlive);
                BrowseCTRL.SetView(m_session, BrowseViewType.Objects, null);
                StandardClient_KeepAlive(m_session, null);
            }
        }