本文整理汇总了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);
}
}
示例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);
}
示例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;
}
示例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;
}
}
}
}
示例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;
}
示例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);
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}