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


C# ApplicationConfiguration类代码示例

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


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

示例1: Execute

        public void Execute(ApplicationInstructions instructions, ApplicationConfiguration configuration)
        {
            Validate.ExecuteAlias(instructions.ExecuteAlias);

            var isTimedMode = instructions.TimedMode || configuration.IsTimedMode;
            var group = TaskCollection.SelectTaskGroup(instructions.ExecuteAlias.Alias);

            Validate.TaskGroup(group);

            try
            {
                PrintStartTime(isTimedMode);

                if (instructions.ParallelMode)
                {
                    ExecuteASync(group, instructions, configuration);
                }
                else
                {
                    ExecuteSync(group, instructions, configuration);
                }
            }
            finally
            {
                PrintEndTime(isTimedMode);
            }
        }
开发者ID:JonyTek,项目名称:RunForrest,代码行数:27,代码来源:ExecuteGroupTaskInstructions.cs

示例2: TestClient

 /// <summary>
 /// This constructor loads the configuration.
 /// </summary>
 /// <remarks> It loads Client configuration, test configuration and 
 /// initializes contexts for vendor namespaces. </remarks>
 public TestClient(ApplicationConfiguration configuration)
 {
     m_configuration = configuration;
     LoadTestConfiguration(null);
     m_messageContext = Compare.MessageContext = m_configuration.CreateMessageContext();
     TestUtils.InitializeContexts(m_messageContext);
 }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:12,代码来源:TestClient.cs

示例3: 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

示例4: OverrideUaTcpImplementation

        /// <summary>
        /// Uses the command line to override the UA TCP implementation specified in the configuration.
        /// </summary>
        /// <param name="configuration">The configuration instance that stores the configurable information for a UA application.
        /// </param>
        public static void OverrideUaTcpImplementation(ApplicationConfiguration configuration)
        {
            // check if UA TCP configuration included.
            TransportConfiguration transport = null;

            for (int ii = 0; ii < configuration.TransportConfigurations.Count; ii++)
            {
                if (configuration.TransportConfigurations[ii].UriScheme == Utils.UriSchemeOpcTcp)
                {
                    transport = configuration.TransportConfigurations[ii];
                    break;
                }
            }

            // check if UA TCP implementation explicitly specified.
            if (transport != null)
            {
                string[] args = Environment.GetCommandLineArgs();

                if (args != null && args.Length > 1)
                {
                    if (String.Compare(args[1], "-uaTcpAnsiC", StringComparison.InvariantCultureIgnoreCase) == 0)
                    {
                        transport.TypeName = Utils.UaTcpBindingNativeStack;
                    }
                    else if (String.Compare(args[1], "-uaTcpDotNet", StringComparison.InvariantCultureIgnoreCase) == 0)
                    {
                        transport.TypeName = Utils.UaTcpBindingDefault;
                    }
                }
            }
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:37,代码来源:GuiUtils.cs

示例5: MainForm

 /// <summary>
 /// Creates a form which uses the specified client configuration.
 /// </summary>
 /// <param name="configuration">The configuration to use.</param>
 public MainForm(ApplicationConfiguration configuration)
 {
     InitializeComponent();
     ConnectServerCTRL.Configuration = m_configuration = configuration;
     ConnectServerCTRL.ServerUrl = "opc.tcp://localhost:62541/Quickstarts/ReferenceServer";
     this.Text = m_configuration.ApplicationName;
 }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:11,代码来源:MainForm.cs

示例6: ShouldMapAllConfigFields

        public void ShouldMapAllConfigFields()
        {
            var console = new string[0];
            var config = new ApplicationConfiguration
            {
                IsInGroupMode = true,
                IsTimedMode = true,
                IsVerbodeMode = true
            };
            config.DefaultArguments.ExecuteAlias = "alias";
            config.DefaultArguments.MethodArguments = new[] { "config" };
            config.DefaultArguments.ConstructorArguments = new[] { "config" };

            builder = new InstructionBuilder(console, config);
            var instructions = builder.Build();

            Assert.That(instructions.ExecuteAlias.Alias, Is.EqualTo("alias"));
            Assert.That(instructions.Instructions.ContainsKey(InstructionType.DisplayHelp), Is.False);
            Assert.That(instructions.Instructions.ContainsKey(InstructionType.DisplayList), Is.False);
            Assert.That(instructions.Instructions[InstructionType.Constructor].Arguments, Is.EqualTo(new[] { "config" }));
            Assert.That(instructions.Instructions[InstructionType.Method].Arguments, Is.EqualTo(new[] { "config" }));
            Assert.That(instructions.Instructions[InstructionType.Group], Is.Not.Null);
            Assert.That(instructions.Instructions[InstructionType.Timed], Is.Not.Null);
            Assert.That(instructions.Instructions[InstructionType.Verbose], Is.Not.Null);
        }
开发者ID:JonyTek,项目名称:RunForrest,代码行数:25,代码来源:InstructionBuilderSpecs.cs

示例7: Create

        /// <summary>
        /// Creates a new transport channel that supports the IRegistrationChannel service contract.
        /// </summary>
        /// <param name="configuration">The application configuration.</param>
        /// <param name="description">The description for the endpoint.</param>
        /// <param name="endpointConfiguration">The configuration to use with the endpoint.</param>
        /// <param name="clientCertificate">The client certificate.</param>
        /// <param name="messageContext">The message context to use when serializing the messages.</param>
        /// <returns></returns>
        public static ITransportChannel Create(
            ApplicationConfiguration configuration,
            EndpointDescription description,
            EndpointConfiguration endpointConfiguration,
            X509Certificate2 clientCertificate,
            ServiceMessageContext messageContext)
        {
            // create a UA binary channel.
            ITransportChannel channel = CreateUaBinaryChannel(
                configuration,
                description,
                endpointConfiguration,
                clientCertificate,
                messageContext);

            // create a WCF XML channel.
            if (channel == null)
            {
                Uri endpointUrl = new Uri(description.EndpointUrl);
                channel = new RegistrationChannel();

                TransportChannelSettings settings = new TransportChannelSettings();
                settings.Configuration = endpointConfiguration;
                settings.Description = description;
                settings.ClientCertificate = clientCertificate;
                channel.Initialize(endpointUrl, settings);
            }

            return channel;
        }
开发者ID:OPCFoundation,项目名称:UA-.NETStandardLibrary,代码行数:39,代码来源:RegistrationClient.cs

示例8: CreateMasterNodeManager

        /// <summary>
        /// Creates the node managers for the server.
        /// </summary>
        /// <remarks>
        /// This method allows the sub-class create any additional node managers which it uses. The SDK
        /// always creates a CoreNodeManager which handles the built-in nodes defined by the specification.
        /// Any additional NodeManagers are expected to handle application specific nodes.
        /// </remarks>
        protected override MasterNodeManager CreateMasterNodeManager(IServerInternal server, ApplicationConfiguration configuration)
        {
            Utils.Trace("Creating the Node Managers.");

            List<INodeManager> nodeManagers = new List<INodeManager>();

            // create the custom node managers.
            nodeManagers.Add(new TutorialNodeManager(server, configuration));

            #region Task #C4 - Add Support for COM Wrapper
            // manually configure the COM server to prevent unapproved wrappers.
            ComDaClientConfiguration wrapperConfig = new ComDaClientConfiguration();

            wrapperConfig.ServerName = "COM";
            wrapperConfig.ServerUrl = "opc.com://localhost/OPCSample.OpcDaServer";
            wrapperConfig.MaxReconnectWait = 10000;
            wrapperConfig.SeperatorChars = null;
            wrapperConfig.BrowseToNotSupported = false;
            wrapperConfig.ItemIdParser = new ItemIdParser();

            // create an instance of the wrapper node manager.
            TutorialDaComNodeManager manager = new TutorialDaComNodeManager(
                server,
                wrapperConfig.ServerUrl,
                wrapperConfig,
                true);

            nodeManagers.Add(manager);
            #endregion

            // create master node manager.
            return new MasterNodeManager(server, configuration, null, nodeManagers.ToArray());
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:41,代码来源:TutorialServer.cs

示例9: TestDataNodeManager

        /// <summary>
        /// Initializes the node manager.
        /// </summary>
        public TestDataNodeManager(Opc.Ua.Server.IServerInternal server, ApplicationConfiguration configuration)
        :
            base(server, configuration)
        {
            // update the namespaces.
            List<string> namespaceUris = new List<string>();

            namespaceUris.Add(Namespaces.TestData);
            namespaceUris.Add(Namespaces.TestData + "/Instance");

            NamespaceUris = namespaceUris;

            // get the configuration for the node manager.
            m_configuration = configuration.ParseExtension<TestDataNodeManagerConfiguration>();

            // use suitable defaults if no configuration exists.
            if (m_configuration == null)
            {
                m_configuration = new TestDataNodeManagerConfiguration();
            }

            m_lastUsedId = m_configuration.NextUnusedId-1;

            // create the object used to access the test system.
            m_system = new TestDataSystem(this, server.NamespaceUris, server.ServerUris);

            // update the default context.
            SystemContext.SystemHandle = m_system;
        }
开发者ID:OPCFoundation,项目名称:UA-.NETStandardLibrary,代码行数:32,代码来源:TestDataNodeManager.cs

示例10: btnSave_Click

        protected void btnSave_Click(object sender, EventArgs e)
        {
            lblError.Text = string.Empty;
            lblSave.Text = string.Empty;
            lblMessage.Text = string.Empty;
            lblMessage.Visible = false;
            lblError.Visible = false;
            lblSave.Visible = false;
            try {
                using (TransactionScope scope = new TransactionScope()) {
                    ApplicationConfigurationManager.UpdateAppConfigStatus();
                    ApplicationConfiguration objAppConfig = new ApplicationConfiguration();
                    objAppConfig.PrimaryProducerCommissionPercent = Convert.ToDecimal(txtPrimeryProducer.Text);
                    objAppConfig.SecondaryProducerCommissionPercent = Convert.ToDecimal(txtSecondaryProducer.Text);

                    objAppConfig.EmailNotificationSite1 = txtEmailSite1.Text.Trim();
                    objAppConfig.EmailNotificationSite2 = txtEmailSite2.Text.Trim();
                    objAppConfig.EmailNotificationSite3 = txtEmailSite3.Text.Trim();
                    objAppConfig.Status = 1;
                    ApplicationConfigurationManager.Save(objAppConfig);
                    fillRecord();
                    lblSave.Text = "Record Saved.";
                    lblSave.Visible = true;
                    scope.Complete();
                }
            }
            catch (Exception ex) {
                lblError.Text = "Record Not Saved.";
                lblError.Visible = true;
            }
        }
开发者ID:Antoniotoress1992,项目名称:asp,代码行数:31,代码来源:ucApplicationConfiguration.ascx.cs

示例11: OnServerStarting

        /// <summary>
        /// This method loads the configuration for the test server.
        /// </summary>
        protected override void OnServerStarting(ApplicationConfiguration configuration)
        {
            base.OnServerStarting(configuration);

            LoadTestConfiguration(null);
            TestUtils.InitializeContexts(base.MessageContext);
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:10,代码来源:TestServer.cs

示例12: CoreNodeManager

        /// <summary>
        /// Initializes the object with default values.
        /// </summary>
        public CoreNodeManager(
            IServerInternal          server,
            ApplicationConfiguration configuration,
            ushort                   dynamicNamespaceIndex)
        {
            if (server == null)        throw new ArgumentNullException("server");
            if (configuration == null) throw new ArgumentNullException("configuration");
                  
            m_server                         = server;
            m_nodes                          = new NodeTable(server.NamespaceUris, server.ServerUris, server.TypeTree);
            m_monitoredItems                 = new Dictionary<uint,MonitoredItem>();
            m_defaultMinimumSamplingInterval = 1000;
            m_namespaceUris                  = new List<string>();
            m_dynamicNamespaceIndex          = dynamicNamespaceIndex; 
            
            #if LEGACY_CORENODEMANAGER
            m_eventSources = new Dictionary<object,IEventSource>();
            #endif

            // use namespace 1 if out of range.
            if (m_dynamicNamespaceIndex == 0 || m_dynamicNamespaceIndex >= server.NamespaceUris.Count)
            {
                m_dynamicNamespaceIndex = 1;
            }

            m_samplingGroupManager = new SamplingGroupManager(
                server, 
                this,
                (uint)configuration.ServerConfiguration.MaxNotificationQueueSize,
                configuration.ServerConfiguration.AvailableSamplingRates);
        }
开发者ID:OPCFoundation,项目名称:UA-.NETStandardLibrary,代码行数:34,代码来源:CoreNodeManager.cs

示例13: 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

示例14: ShowDialog

        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public EndpointDescription ShowDialog(
            ApplicationConfiguration     configuration,
            ConfiguredEndpointCollection endpoints,
            X509Certificate2             clientCertificate)
        {
            m_configuration     = configuration;
            m_endpoints         = endpoints;
            m_messageContext    = configuration.CreateMessageContext();
            m_clientCertificate = clientCertificate;
            m_running           = false;
            m_filePath          = @".\perftest.csv";
                        
            EndpointSelectorCTRL.Initialize(m_endpoints, configuration);
            
            lock (m_lock)
            {
                OkBTN.Enabled = m_running = false;
            }

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

            return null;
        }
开发者ID:OPCFoundation,项目名称:UA-.NETStandardLibrary,代码行数:30,代码来源:PerformanceTestDlg.cs

示例15: PublisherForm

        public PublisherForm(
            ServiceMessageContext context,
            ApplicationInstance application,
            PublisherForm masterForm,
            ApplicationConfiguration configuration)
        {
            InitializeComponent();
            this.Icon = ClientUtils.GetAppIcon();

            m_masterForm = masterForm;
            m_context = context;
            m_application = application;
            m_server = application.Server as Opc.Ua.Server.StandardServer;

            if (m_masterForm == null)
            {
                m_forms = new List<PublisherForm>();
            }

            SessionsCTRL.Configuration  = m_configuration = configuration;
            SessionsCTRL.MessageContext = context;

            // get list of cached endpoints.
            m_endpoints = m_configuration.LoadCachedEndpoints(true);
            m_endpoints.DiscoveryUrls = configuration.ClientConfiguration.WellKnownDiscoveryUrls;
            EndpointSelectorCTRL.Initialize(m_endpoints, m_configuration);

            // initialize control state.
            Disconnect();
            //lth: initial MassTransit Publisher
            m_massTransitPublisher = new MassTransitPublisher();

            this.NotificationsCTRL.ItemsAdded += NotificationsCTRL_ItemsAdded;
        }
开发者ID:yuriik83,项目名称:opcesb,代码行数:34,代码来源:PublisherForm.cs


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