Inheritance: ComProxyConfiguration
コード例 #1
0
ファイル: ComHdaProxy.cs プロジェクト: OPCFoundation/UA-.NET
        /// <summary>
        /// Called when a new session is created.
        /// </summary>
        protected override void OnSessionCreated()
        {
            lock (Lock)
            {
                // fetch the configuration.
                m_configuration = Endpoint.ParseExtension<ComHdaProxyConfiguration>(null);

                if (m_configuration == null)
                {
                    m_configuration = new ComHdaProxyConfiguration();
                }

                Session session = Session;

                // update the mapping and pass the new session to other objects.
                m_mapper.Initialize(session, m_configuration);
                
                // update the aggregate mappings.
                UpdateAggregateMappings(session);

                // save the configuration.
                Endpoint.UpdateExtension<ComHdaProxyConfiguration>(null, m_configuration);
                SaveConfiguration();
            }
        }
コード例 #2
0
        private void OkBTN_Click(object sender, EventArgs e)
        {
            if (m_endpoint == null)
            {
                EditBTN_Click(sender, e);

                if (m_endpoint == null)
                {
                    return;
                }
            }

            try
            {
                EndpointComIdentity comIdentity = new PseudoComServerDlg().ShowDialog(m_endpoint);

                if (comIdentity == null)
                {
                    return;
                }

                m_endpoint.ComIdentity = comIdentity;

                // set a default configuration.
                if (comIdentity.Specification != ComSpecification.HDA)
                {
                    ComProxyConfiguration configuration = m_endpoint.ParseExtension<ComProxyConfiguration>(null);

                    if (configuration == null)
                    {
                        configuration = new ComProxyConfiguration();
                        configuration.BrowseBlockSize = 1000;
                    }

                    m_endpoint.UpdateExtension<ComProxyConfiguration>(null, configuration);
                }
                else
                {
                    ComHdaProxyConfiguration configuration = m_endpoint.ParseExtension<ComHdaProxyConfiguration>(null);

                    if (configuration == null)
                    {
                        configuration = new ComHdaProxyConfiguration();
                        configuration.BrowseBlockSize = 1000;
                        configuration.MaxReturnValues = 10000;
                    }

                    m_endpoint.UpdateExtension<ComHdaProxyConfiguration>(null, configuration);
                }

                PseudoComServer.Save(m_endpoint);

                DialogResult = DialogResult.OK;
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.Text, System.Reflection.MethodBase.GetCurrentMethod(), exception);
            }
        }