本文整理汇总了C#中Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationNode类的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationNode类的具体用法?C# ConfigurationNode怎么用?C# ConfigurationNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurationNode类属于Microsoft.Practices.EnterpriseLibrary.Configuration.Design命名空间,在下文中一共展示了ConfigurationNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCommands
private void CreateCommands(ConfigurationNode node)
{
Type t = node.GetType();
PropertyInfo[] properties = t.GetProperties(BindingFlags.Public | BindingFlags.Instance);
CreateCommandsOnNode(node, properties);
CreateCommandsOnChildNodeProperties(node);
}
示例2: ExecuteCore
/// <summary>
/// Closes the application configuration.
/// </summary>
/// <param name="node">
/// The node to execute the command upon.
/// </param>
protected override void ExecuteCore(ConfigurationNode node)
{
try
{
UIService.BeginUpdate();
if (UIService.IsDirty(node.Hierarchy))
{
DialogResult result = UIService.ShowMessage(Resources.SaveApplicationRequest, Resources.SaveApplicationCaption, MessageBoxButtons.YesNo);
if (DialogResult.Yes == result)
{
if (!TryAndSaveApplication(node))
{
return;
}
}
}
if (ErrorLogService.ConfigurationErrorCount > 0)
{
UIService.DisplayErrorLog(ErrorLogService);
DialogResult result = UIService.ShowMessage(Resources.SaveApplicationErrorRequestMessage, Resources.SaveApplicationCaption, MessageBoxButtons.YesNo);
if (result == DialogResult.No) return;
}
ConfigurationUIHierarchyService.RemoveHierarchy(node.Hierarchy.Id);
}
finally
{
UIService.EndUpdate();
}
}
示例3: CreateCommandsOnChildNodeProperties
private void CreateCommandsOnChildNodeProperties(ConfigurationNode node)
{
foreach (ConfigurationNode childNode in node.Nodes)
{
CreateCommands(childNode);
}
}
示例4: ExecuteCore
protected override void ExecuteCore(ConfigurationNode node)
{
TypeSelectorUI selector = new TypeSelectorUI(
typeof(RijndaelManaged),
typeof(SymmetricAlgorithm),
TypeSelectorIncludeFlags.Default
);
DialogResult typeResult = selector.ShowDialog();
if (typeResult == DialogResult.OK)
{
KeySettings keySettings = new KeySettings(new SymmetricAlgorithmKeyCreator(selector.SelectedType.AssemblyQualifiedName));
KeyManagerEditorUI keyManager = new KeyManagerEditorUI(keySettings);
DialogResult keyResult = keyManager.ShowDialog();
if (keyResult == DialogResult.OK)
{
INodeNameCreationService service = GetService(typeof(INodeNameCreationService)) as INodeNameCreationService;
Debug.Assert(service != null, "Could not find the INodeNameCreationService");
base.ExecuteCore(node);
SymmetricAlgorithmProviderNode providerNode = (SymmetricAlgorithmProviderNode)ChildNode;
providerNode.AlgorithmType = selector.SelectedType.AssemblyQualifiedName;
providerNode.Name = service.GetUniqueDisplayName(providerNode.Parent, selector.SelectedType.Name);
providerNode.Key = keyManager.KeySettings;
}
}
}
示例5: ExecuteCore
/// <summary>
/// Creates the commands and adds them to the <see cref="IStorageService"/>.
/// </summary>
/// <param name="node">The node to execute the command upon.</param>
protected override void ExecuteCore(ConfigurationNode node)
{
// clear out the service first since we are going to refill it
IStorageService storageService = ServiceHelper.GetCurrentStorageService(ServiceProvider);
storageService.Clear();
CreateCommands(node);
}
示例6: ExecuteCore
/// <summary>
/// <para>Creates an instance of the child node class and adds it as a child of the parent node. The node will be a <see cref="SymmetricAlgorithmProviderNode"/>.</para>
/// </summary>
/// <param name="node">
/// <para>The parent node to add the newly created <see cref="AddChildNodeCommand.ChildNode"/>.</para>
/// </param>
protected override void ExecuteCore(ConfigurationNode node)
{
TypeSelectorUI selector = new TypeSelectorUI(
typeof(RijndaelManaged),
typeof(SymmetricAlgorithm),
TypeSelectorIncludes.None
);
DialogResult typeResult = selector.ShowDialog();
if (typeResult == DialogResult.OK)
{
Type algorithmType = selector.SelectedType;
CryptographicKeyWizard keyManager = new CryptographicKeyWizard(new SymmetricAlgorithmKeyCreator(algorithmType));
DialogResult keyResult = keyManager.ShowDialog();
if (keyResult == DialogResult.OK)
{
INodeNameCreationService service = ServiceHelper.GetNameCreationService(ServiceProvider);
Debug.Assert(service != null, "Could not find the INodeNameCreationService");
base.ExecuteCore(node);
SymmetricAlgorithmProviderNode providerNode = (SymmetricAlgorithmProviderNode)ChildNode;
providerNode.AlgorithmType = selector.SelectedType;
providerNode.Name = service.GetUniqueName(selector.SelectedType.Name, providerNode, providerNode.Parent);
providerNode.Key = keyManager.KeySettings;
}
}
}
示例7: ExecuteCore
/// <summary>
///
/// </summary>
/// <param name="node"></param>
protected override void ExecuteCore(ConfigurationNode node)
{
base.ExecuteCore(node);
RuleNode ruleNode = ChildNode as RuleNode;
if (ruleNode == null) return;
}
示例8: ExecuteCore
protected override void ExecuteCore(ConfigurationNode node)
{
ConfigurationSectionCollectionNode configurationSectionCollectionNode = node.Hierarchy.FindNodeByType(typeof(ConfigurationSectionCollectionNode)) as ConfigurationSectionCollectionNode;
if (configurationSectionCollectionNode == null) return;
IXmlIncludeTypeService service = GetService(typeof(IXmlIncludeTypeService)) as IXmlIncludeTypeService;
Type[] types = null;
XmlSerializerTransformerNode transformerNode = null;
foreach (ConfigurationNode configurationNode in configurationSectionCollectionNode.Nodes)
{
transformerNode = node.Hierarchy.FindNodeByType(configurationNode, typeof(XmlSerializerTransformerNode)) as XmlSerializerTransformerNode;
if (transformerNode == null) continue;
types = service.GetXmlIncludeTypes(configurationNode.Name);
if (types == null) continue;
foreach (Type t in types)
{
INodeCreationService nodeCreationService = (INodeCreationService)GetService(typeof(INodeCreationService));
if (!nodeCreationService.DoesNodeTypeMatchDataType(nodeType, t)) continue;
if (node.Hierarchy.FindNodeByName(transformerNode, t.Name) == null)
{
transformerNode.Nodes.Add(new XmlIncludeTypeNode(new XmlIncludeTypeData(t.Name, t.AssemblyQualifiedName)));
}
}
}
}
示例9: ExecuteCore
/// <summary>
/// Executes the moving the node before it's sibling.
/// </summary>
/// <param name="node">
/// The node to execute the command upon.
/// </param>
protected override void ExecuteCore(ConfigurationNode node)
{
if (node.PreviousSibling != null)
{
node.Parent.MoveBefore(node, node.PreviousSibling);
}
}
示例10: ExecuteCore
protected override void ExecuteCore(ConfigurationNode node)
{
TypeSelectorUI selector = new TypeSelectorUI(
typeof(Exception),
typeof(Exception),
TypeSelectorIncludeFlags.BaseType |
TypeSelectorIncludeFlags.AbstractTypes);
DialogResult result = selector.ShowDialog();
if (result == DialogResult.OK)
{
base.ExecuteCore(node);
ExceptionTypeNode typeNode = (ExceptionTypeNode) ChildNode;
typeNode.TypeName = selector.SelectedType.AssemblyQualifiedName;
typeNode.PostHandlingAction = PostHandlingAction.NotifyRethrow;
try
{
typeNode.Name = selector.SelectedType.Name;
}
catch (InvalidOperationException)
{
typeNode.Remove();
UIService.ShowError(SR.DuplicateExceptionTypeErrorMessage(selector.SelectedType.Name));
}
}
}
示例11: ExecuteCore
/// <summary>
/// Executes the moving the node after it's sibling.
/// </summary>
/// <param name="node">
/// The node to execute the command upon.
/// </param>
protected override void ExecuteCore(ConfigurationNode node)
{
if (node.NextSibling != null)
{
node.Parent.MoveAfter(node, node.NextSibling);
}
}
示例12: ExecuteCore
/// <summary>
/// Adds the <see cref="LoggingSettingsNode"/> and adds the default nodes.
/// </summary>
/// <param name="node">The <see cref="LoggingSettingsNode"/> added.</param>
protected override void ExecuteCore(ConfigurationNode node)
{
base.ExecuteCore(node);
ApplicationBlockSettingsNode blockSettingsNode = ChildNode as ApplicationBlockSettingsNode;
if (blockSettingsNode == null) return;
// TODO: Initialize your initial configuration settings for the MyNewApplicationBlock7 Design Time.
}
示例13: ConfigurationNodeChangedEventArgs
/// <summary>
/// <para>Initializes a new instance of the <see cref="ConfigurationNodeChangedEventArgs"/> class with an action, the node it was performed upon, and the parent node.</para>
/// </summary>
/// <param name="action">
/// <para>One of the <see cref="ConfigurationNodeChangedAction"/> values.</para>
/// </param>
/// <param name="node">
/// <para>The <see cref="ConfigurationNode"/> that the action occured upon.</para>
/// </param>
/// <param name="parent"><para>The parent node of the <paramref name="node"/>.</para></param>
public ConfigurationNodeChangedEventArgs(ConfigurationNodeChangedAction action,
ConfigurationNode node,
ConfigurationNode parent)
{
this.action = action;
this.node = node;
this.parent = parent;
}
示例14: ExecuteCore
/// <summary>
/// Saves the application configuration.
/// </summary>
/// <param name="node">
/// The node to execute the command upon.
/// </param>
protected override void ExecuteCore(ConfigurationNode node)
{
if (!DoValidationCommand())
{
return;
}
DoApplicationSave();
}
示例15: ExecuteCore
/// <summary>
/// After the <see cref="SecuritySettingsNode"/> is added, adds the default nodes.
/// </summary>
/// <param name="node">The <see cref="SecuritySettingsNode"/>.S</param>
protected override void ExecuteCore(ConfigurationNode node)
{
base.ExecuteCore(node);
SecuritySettingsNode securitySettingsNode = (SecuritySettingsNode)ChildNode;
securitySettingsNode.AddNode(new AuthorizationProviderCollectionNode());
securitySettingsNode.AddNode(new SecurityCacheProviderCollectionNode());
}