当前位置: 首页>>代码示例>>C#>>正文


C# ConfiguredEndpoint类代码示例

本文整理汇总了C#中ConfiguredEndpoint的典型用法代码示例。如果您正苦于以下问题:C# ConfiguredEndpoint类的具体用法?C# ConfiguredEndpoint怎么用?C# ConfiguredEndpoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConfiguredEndpoint类属于命名空间,在下文中一共展示了ConfiguredEndpoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowDialog

        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public ConfiguredEndpoint ShowDialog(ApplicationConfiguration configuration, bool createNew)
        {
            m_configuration = configuration;
            m_endpoint = null;

            // create a default collection if none provided.
            if (createNew)
            {
                ApplicationDescription server = new DiscoveredServerListDlg().ShowDialog(null, m_configuration);

                if (server != null)
                {
                    return new ConfiguredEndpoint(server, EndpointConfiguration.Create(configuration));
                }

                return null;
            }
            
            ServersCTRL.Initialize(null, configuration);
            
            OkBTN.Enabled = false;

            if (ShowDialog() != DialogResult.OK)
            {
                return null;
            }
  
            return m_endpoint;
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:32,代码来源:ConfiguredServerListDlg.cs

示例2: ShowDialog

        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public EndpointComIdentity ShowDialog(ConfiguredEndpoint endpoint)
        {
            if (endpoint == null) throw new ArgumentNullException("endpoint");

            m_comIdentity = endpoint.ComIdentity;

            // assign a default prog id/clsid.
            if (String.IsNullOrEmpty(m_comIdentity.ProgId))
            {
                m_comIdentity.ProgId = PseudoComServer.CreateProgIdFromUrl(ComSpecification.DA, endpoint.EndpointUrl.ToString());
                m_comIdentity.Clsid = ConfigUtils.CLSIDFromProgID(m_comIdentity.ProgId);

                if (m_comIdentity.Clsid == Guid.Empty)
                {
                    m_comIdentity.Clsid = Guid.NewGuid();
                }
            }

            SpecificationCB.SelectedItem = m_comIdentity.Specification;
            ClsidTB.Text  = m_comIdentity.Clsid.ToString();
            ProgIdTB.Text = m_comIdentity.ProgId;

            if (ShowDialog() != DialogResult.OK)
            {
                return null;
            }
                        
            return m_comIdentity;      
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:32,代码来源:PseudoComServerDlg.cs

示例3: ConfigureEndpoint

        private void ConfigureEndpoint(ConfiguredEndpoint endpoint)
        {
            EndpointComIdentity comIdentity = endpoint.ComIdentity;

            if (comIdentity == null)
            {
                comIdentity = new EndpointComIdentity();
                comIdentity.Specification = ComSpecification.DA;
                endpoint.ComIdentity = comIdentity;
            }

            string oldProgId = PseudoComServer.CreateProgIdFromUrl(endpoint.ComIdentity.Specification, endpoint.EndpointUrl.ToString());

            endpoint = new ConfiguredServerDlg().ShowDialog(endpoint, m_configuration);

            if (endpoint == null)
            {
                return;
            }

            if (String.IsNullOrEmpty(comIdentity.ProgId) || oldProgId == comIdentity.ProgId)
            {
                comIdentity.ProgId = PseudoComServer.CreateProgIdFromUrl(endpoint.ComIdentity.Specification, endpoint.EndpointUrl.ToString());

                if (comIdentity.Clsid == Guid.Empty)
                {
                    comIdentity.Clsid = Guid.NewGuid();
                }
            }

            m_endpoint = endpoint;
            EndpointTB.Text = m_endpoint.EndpointUrl.ToString();
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:33,代码来源:NewEndpointDlg.cs

示例4: ShowDialog

        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public ConfiguredEndpoint ShowDialog(ApplicationConfiguration configuration, bool createNew)
        {
            m_configuration = configuration;
            m_endpoint = null;

            // create a default collection if none provided.
            if (createNew)
            {
                ApplicationDescription server = new DiscoveredServerListDlg().ShowDialog(null, m_configuration);

                if (server != null)
                {
                    return new ConfiguredEndpoint(server, EndpointConfiguration.Create(configuration));
                }

                return null;
            }
            
            ServersCTRL.Initialize(null, configuration);
            
            OkBTN.IsEnabled = false;

            Popup myPopup = new Popup();
            myPopup.Child = this;
            myPopup.IsOpen = true;

            return m_endpoint;
        }
开发者ID:OPCFoundation,项目名称:UA-.NETStandardLibrary,代码行数:31,代码来源:ConfiguredServerListDlg.xaml.cs

示例5: Session

 /// <summary>
 /// Constructs a new instance of the session.
 /// </summary>
 /// <param name="channel">The channel used to communicate with the server.</param>
 /// <param name="configuration">The configuration for the client application.</param>
 /// <param name="endpoint">The endpoint use to initialize the channel.</param>
 public Session(
     ISessionChannel channel,
     ApplicationConfiguration configuration,
     ConfiguredEndpoint endpoint)
 :
     this(channel as ITransportChannel, configuration, endpoint, null)
 {
 }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:14,代码来源:Session.cs

示例6: Load

        /// <summary>
        /// Loads the endpoint information from the registry.
        /// </summary>
        public static ConfiguredEndpoint Load(Guid clsid)
        {
            // load the configuration.
            ConfiguredEndpoint endpoint = LoadConfiguredEndpoint(clsid);

            // create a dummy configuration.
            if (endpoint == null)
            {
                ApplicationDescription server = new ApplicationDescription();

                server.ApplicationName = "(Missing Configuration File)";
                server.ApplicationType = ApplicationType.Server;
                server.ApplicationUri  = clsid.ToString();

                endpoint = new ConfiguredEndpoint(server, null);
            }

            // update the COM identity based on what is actually in the registry.
            endpoint.ComIdentity = new EndpointComIdentity();
            endpoint.ComIdentity.Clsid  = clsid;
            endpoint.ComIdentity.ProgId = ConfigUtils.ProgIDFromCLSID(clsid);
            
            List<Guid> categories = ConfigUtils.GetImplementedCategories(clsid);

            for (int ii = 0; ii < categories.Count; ii++)
            {
                if (categories[ii] == ConfigUtils.CATID_OPCDAServer20)
                {
                    endpoint.ComIdentity.Specification = ComSpecification.DA;
                    break;
                }

                if (categories[ii] == ConfigUtils.CATID_OPCDAServer30)
                {
                    endpoint.ComIdentity.Specification = ComSpecification.DA;
                    break;
                }

                if (categories[ii] == ConfigUtils.CATID_OPCAEServer10)
                {
                    endpoint.ComIdentity.Specification = ComSpecification.AE;
                    break;
                }

                if (categories[ii] == ConfigUtils.CATID_OPCHDAServer10)
                {
                    endpoint.ComIdentity.Specification = ComSpecification.HDA;
                    break;
                }
            }

            return endpoint;
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:56,代码来源:PseudoComServer.cs

示例7: AggregationNodeManager

        /// <summary>
        /// Initializes the node manager.
        /// </summary>
        public AggregationNodeManager(IServerInternal server, ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, bool ownsTypeModel)
        :
            base(server, configuration, Namespaces.Aggregation, AggregationModel.Namespaces.Aggregation)
        {
            SystemContext.NodeIdFactory = this;

            m_configuration = configuration;
            m_endpoint = endpoint;
            m_ownsTypeModel = ownsTypeModel;
            m_clients = new Dictionary<NodeId, Opc.Ua.Client.Session>();
            m_mapper = new NamespaceMapper();
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:15,代码来源:AggregationNodeManager.cs

示例8: ShowDialog

        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public ConfiguredEndpoint ShowDialog(ApplicationConfiguration configuration, ConfiguredEndpoint endpoint)
        {
            m_configuration = configuration;
            m_endpoint = endpoint;

            if (ShowDialog() != DialogResult.OK)
            {
                return null;
            }

            return m_endpoint;
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:15,代码来源:NewEndpointDlg.cs

示例9: ShowDialog

        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public ConfiguredEndpoint ShowDialog(ApplicationConfiguration configuration)
        {
            m_configuration = configuration;
            m_endpoint = null;

            ServersCTRL.Initialize(configuration);
            
            OkBTN.Enabled = false;
            ButtonsPN.Visible = true;
            
            if (ShowDialog() != DialogResult.OK)
            {
                return null;
            }
  
            return m_endpoint;
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:20,代码来源:PseudoComServerListDlg.cs

示例10: Save

        /// <summary>
		/// Saves the endpoint information in the registry.
		/// </summary>
		public static void Save(ConfiguredEndpoint endpoint)
		{
            if (endpoint == null) throw new ArgumentNullException("endpoint");

			if (endpoint.ComIdentity == null)
			{
				throw new ApplicationException("Endpoint does not have a COM identity specified.");
			}
            
            // choose the clsid for the host process.
            Guid hostClsid = GetServerHostClsid(endpoint.ComIdentity.Specification);
            
            // check of COM host process registered.
            string wrapperPath = ConfigUtils.GetExecutablePath(hostClsid);

            if (String.IsNullOrEmpty(wrapperPath))
            {
				throw new ApplicationException("The UA COM Host process is not registered on the machine.");
            }

			// verify prog id.
			string progId = endpoint.ComIdentity.ProgId;

			if (String.IsNullOrEmpty(progId))
			{
				throw new ApplicationException("Endpoint does not have a valid ProgId.");
			}

            // remove existing CLSID.
            Guid existingClsid = ConfigUtils.CLSIDFromProgID(progId);

            if (existingClsid != Guid.Empty)
            {
                ConfigUtils.UnregisterComServer(existingClsid);
            }

            // determine CLSID to use.
            Guid clsid = endpoint.ComIdentity.Clsid;

            if (clsid == Guid.Empty)
            {
                clsid = existingClsid;

                if (clsid == Guid.Empty)
                {
                    clsid = Guid.NewGuid();
                }

                endpoint.ComIdentity.Clsid = clsid;
            }
            
            // remove existing clsid.
            ConfigUtils.UnregisterComServer(clsid);

			string clsidKey = String.Format(@"CLSID\{{{0}}}", clsid.ToString().ToUpper());

			// create new entries.					
			RegistryKey key = Registry.ClassesRoot.CreateSubKey(clsidKey);
			
			if (key == null)
			{
				throw new ApplicationException("Could not create key: " + clsidKey);
			}

			// save description.
            if (endpoint.Description.Server.ApplicationName != null)
            {
                key.SetValue(null, endpoint.Description.Server.ApplicationName);
            }

			try
			{
				// create local server key.
				RegistryKey subkey = key.CreateSubKey("LocalServer32");

				if (subkey == null)
				{
					throw new ApplicationException("Could not create key: LocalServer32");
				}

				subkey.SetValue(null, wrapperPath);
				subkey.Close();

				// create prog id key.
				subkey = key.CreateSubKey("ProgId");

				if (subkey == null)
				{
					throw new ApplicationException("Could not create key: ProgId");
				}

				subkey.SetValue(null, progId);
				subkey.Close();
			}
			finally
			{
				key.Close();
//.........这里部分代码省略.........
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:101,代码来源:PseudoComServer.cs

示例11: ConnectButton_Click

        private void ConnectButton_Click(object sender, EventArgs e)
        {
            try
            {
                // get selected endpoint.
                ConfiguredEndpoint endpoint = SelectedEndpoint;

                if (endpoint == null)
                {
                    return;
                }

                // raise event.
                if (m_ConnectEndpoint != null)
                {
                    ConnectEndpointEventArgs args = new ConnectEndpointEventArgs(endpoint, true);

                    m_ConnectEndpoint(this, args);

                    // save endpoint in drop down.
                    if (args.UpdateControl)
                    {
                        // must update the control because the display text may have changed.
                        Initialize(m_endpoints, m_configuration);
                        SelectedEndpoint = endpoint;
                    }
                }              
            }
            catch (Exception exception)
            {
				GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:33,代码来源:EndpointSelectorCtrl.cs

示例12: ConnectEndpointEventArgs

 /// <summary>
 /// Initializes the object.
 /// </summary>
 public ConnectEndpointEventArgs(ConfiguredEndpoint endpoint, bool updateControl)
 {
     m_endpoint  = endpoint;
     m_updateControl = updateControl;
 }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:8,代码来源:EndpointSelectorCtrl.cs

示例13: Main

        static void Main(string[] args)
        {
            VariableBrowsePaths = new List<string>();
            VariableBrowsePaths.Add("/6:Data/6:Dynamic/6:Scalar/6:Int32Value");
            // VariableBrowsePaths.Add("/7:MatrikonOpc Sim Server/7:Simulation Items/7:Bucket Brigade/7:Int1");
            // VariableBrowsePaths.Add("/7:MatrikonOPC Sim Server/7:Simulation Items/7:Bucket Brigade/7:Int2");


            try
            { 
                // create the configuration.     
                ApplicationConfiguration configuration = Helpers.CreateClientConfiguration();

                // create the endpoint description.
                EndpointDescription endpointDescription = Helpers.CreateEndpointDescription();

                // create the endpoint configuration (use the application configuration to provide default values).
                EndpointConfiguration endpointConfiguration = EndpointConfiguration.Create(configuration);

                // the default timeout for a requests sent using the channel.
                endpointConfiguration.OperationTimeout = 600000;

                // use the pure XML encoding on the wire.
                endpointConfiguration.UseBinaryEncoding = true;

                // create the endpoint.
                ConfiguredEndpoint endpoint = new ConfiguredEndpoint(null, endpointDescription, endpointConfiguration);

                // create the binding factory.
                ServiceMessageContext messageContext = configuration.CreateMessageContext();
                BindingFactory bindingFactory = BindingFactory.Create(configuration, messageContext);

                // update endpoint description using the discovery endpoint.
                if (endpoint.UpdateBeforeConnect)
                {
                    endpoint.UpdateFromServer(bindingFactory);

                    Console.WriteLine("Updated endpoint description for url: {0}", endpointDescription.EndpointUrl);

                    endpointDescription = endpoint.Description;
                    endpointConfiguration = endpoint.Configuration;
                }

                X509Certificate2 clientCertificate = configuration.SecurityConfiguration.ApplicationCertificate.Find();

                // set up a callback to handle certificate validation errors.
                configuration.CertificateValidator.CertificateValidation += new CertificateValidationEventHandler(CertificateValidator_CertificateValidation);

                // Initialize the channel which will be created with the server.
                ITransportChannel channel = SessionChannel.Create(
                    configuration,
                    endpointDescription,
                    endpointConfiguration,
                    clientCertificate,
                    messageContext);

                // Wrap the channel with the session object.
                // This call will fail if the server does not trust the client certificate.
                Session session = new Session(channel, configuration, endpoint, null);
                
                session.ReturnDiagnostics = DiagnosticsMasks.All;

                // register keep alive callback.
                // session.KeepAlive += new KeepAliveEventHandler(Session_KeepAlive);

                // passing null for the user identity will create an anonymous session.
                UserIdentity identity = null; // new UserIdentity("iamuser", "password");        

                // create the session. This actually connects to the server.
                session.Open("My Session Name", identity);

                //Read some history values:
                string str = "";
                do
                {
                    Console.WriteLine("Select action from the menu:\n");
                    Console.WriteLine("\t 0 - Browse");
                    Console.WriteLine("\t 1 - Update");
                    Console.WriteLine("\t 2 - ReadRaw");
                    Console.WriteLine("\t 3 - ReadProcessed");
                    Console.WriteLine("\t 4 - ReadAtTime");
                    Console.WriteLine("\t 5 - ReadAttributes");
                    Console.WriteLine("\t 6 - DeleteAtTime");
                    Console.WriteLine("\t 7 - DeleteRaw");


                    Console.WriteLine("\n\tQ - exit\n\n");

                    str = Console.ReadLine();
                    Console.WriteLine("\n");

                    try
                    {
                        if (str == "0")
                        {
                            Browse(session);
                        }
                        else if (str == "1")
                            HistoryUpdate(session);
                        else if (str == "2")
//.........这里部分代码省略.........
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:101,代码来源:Program.cs

示例14: NewMI_Click

        private void NewMI_Click(object sender, EventArgs e)
        {
            try
            {
                ApplicationDescription server = new DiscoveredServerListDlg().ShowDialog(null, m_configuration);

                if (server == null)
                {
                    return;
                }

                ConfiguredEndpoint endpoint = new ConfiguredEndpoint(server, null);

                endpoint.ComIdentity = new EndpointComIdentity();
                endpoint.ComIdentity.Specification = ComSpecification.DA;

                endpoint = new ConfiguredServerDlg().ShowDialog(endpoint, m_configuration);

                if (endpoint == null)
                {
                    return;
                }
                
                EndpointComIdentity comIdentity = new PseudoComServerDlg().ShowDialog(endpoint);

                if (comIdentity == null)
                {
                    return;
                }

                endpoint.ComIdentity = comIdentity;
                PseudoComServer.Save(endpoint);

                AddItem(endpoint);
                AdjustColumns();
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:41,代码来源:PseudoComServerListCtrl.cs

示例15: Connect

        /// <summary>
        /// Connects to a server.
        /// </summary>
        public void Connect(ConfiguredEndpoint endpoint)
        {
            if (endpoint == null)
            {
                return;
            }

            Session session = 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);
            }
        }
开发者ID:yuriik83,项目名称:opcesb,代码行数:27,代码来源:PublisherForm.cs


注:本文中的ConfiguredEndpoint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。