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


C# ConfigurationNode.AddNode方法代码示例

本文整理汇总了C#中Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationNode.AddNode方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationNode.AddNode方法的具体用法?C# ConfigurationNode.AddNode怎么用?C# ConfigurationNode.AddNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationNode的用法示例。


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

示例1: AddTraceListeners

		private void AddTraceListeners(ConfigurationNode node, TraceSourceData data)
		{
			foreach (TraceListenerReferenceData refData in data.TraceListeners)
			{
				TraceListenerReferenceNode referenceNode = new TraceListenerReferenceNode(refData);
				foreach(TraceListenerNode listenerNode in listeners.Nodes)
				{
					if (listenerNode.Name == referenceNode.Name)
					{
						referenceNode.ReferencedTraceListener = listenerNode;
					}
				}
				node.AddNode(referenceNode);
			}			
		}
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:15,代码来源:SpecialTraceSourcesNodeBuilder.cs

示例2: CreateEncryptionNode

        private void CreateEncryptionNode(ConfigurationNode storageNode, string storageEncryption)
        {
            if (string.IsNullOrEmpty(storageEncryption)) return;

            StorageEncryptionProviderData encryptionProviderData = cacheManagerSettings.EncryptionProviders.Get(storageEncryption);
            if (null == encryptionProviderData)
            {
                LogError(storageNode, string.Format(CultureInfo.CurrentUICulture, Resources.ExceptionNoEncrypitonProviderDefined, storageEncryption));
                return;
            }

            ConfigurationNode encyrptionNode = NodeCreationService.CreateNodeByDataType(encryptionProviderData.GetType(), new object[] { encryptionProviderData });
            if (null == encyrptionNode)
            {
                LogNodeMapError(storageNode, encryptionProviderData.GetType());
                return;
            }
            storageNode.AddNode(encyrptionNode);
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:19,代码来源:CacheManagerSettingsNodeBuilder.cs

示例3: 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="HashAlgorithmProviderNode"/>.</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)
        {
            INodeNameCreationService service = ServiceHelper.GetNameCreationService(ServiceProvider);
            Debug.Assert(service != null, "Could not find the INodeNameCreationService");

            TypeSelectorUI selector = new TypeSelectorUI(
                typeof(SHA1Managed),
                typeof(HashAlgorithm),
                TypeSelectorIncludes.None
                );

            DialogResult typeResult = selector.ShowDialog();
            if (typeResult == DialogResult.OK)
            {

                Type selectedAlgorithmType = selector.SelectedType;
                if (selector.SelectedType.IsSubclassOf(typeof(KeyedHashAlgorithm)))
                {
                    CryptographicKeyWizard keyWizard = new CryptographicKeyWizard(new KeyedHashAlgorithmKeyCreator(selector.SelectedType));
                    DialogResult keyResult = keyWizard.ShowDialog();

                    if (keyResult == DialogResult.OK)
                    {
                        KeyedHashAlgorithmProviderNode providerNode = new KeyedHashAlgorithmProviderNode();

                        providerNode.Key = keyWizard.KeySettings;
                        providerNode.AlgorithmType = selector.SelectedType;

                        node.AddNode(providerNode);
                        providerNode.Name = service.GetUniqueName(selector.SelectedType.Name, providerNode, providerNode.Parent);
                    }
                }
                else
                {
                    base.ExecuteCore(node);
                    HashAlgorithmProviderNode providerNode = (HashAlgorithmProviderNode)ChildNode;
                    providerNode.AlgorithmType = selectedAlgorithmType;
                    providerNode.Name = service.GetUniqueName(selector.SelectedType.Name, providerNode, providerNode.Parent);
                }
            }
        }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:47,代码来源:AddHashAlgorithmProviderNodeCommand.cs

示例4: ExecuteCore

        protected override void ExecuteCore(ConfigurationNode node)
        {
            IUIService uiService = ServiceHelper.GetUIService(ServiceProvider);

            using (OpenFileDialog fileDialog = new OpenFileDialog())
            {
                fileDialog.Filter = Resources.EnvironmentDeltaFileDialogFilter;
                fileDialog.CheckFileExists = true;
                fileDialog.CheckPathExists = true;
                fileDialog.AddExtension = true;
                fileDialog.DefaultExt = Resources.DefaultEnvironmentDeltaFileExtension;
                fileDialog.RestoreDirectory = true;

                if (DialogResult.OK == uiService.ShowOpenDialog(fileDialog))
                {

                    uiService.BeginUpdate();

                    try
                    {
                        EnvironmentNodeBuilder nodeBuilder = new EnvironmentNodeBuilder(ServiceProvider);
                        EnvironmentNode childNode = nodeBuilder.Build(fileDialog.FileName, node.Hierarchy);

                        node.AddNode(childNode);
                        uiService.SetUIDirty(node.Hierarchy);
                        uiService.ActivateNode(childNode);
                    }
                    catch (Exception e)
                    {
                        uiService.ShowError(e, Resources.ErrorOpeningEnvironmentMergeFile);
                    }
                    finally
                    {
                        uiService.EndUpdate();
                    }
                }
            }
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:38,代码来源:OpenEnvironmentDeltaCommand.cs

示例5: ExecuteCore

 /// <summary>
 /// Creates an instance of the child node class and adds it as a child of the parent node.
 /// </summary>
 /// <param name="node">
 /// The parent node to add the newly created <see cref="ChildNode"/>.
 /// </param>
 protected override void ExecuteCore(ConfigurationNode node)
 {
     try
     {
         UIService.BeginUpdate();
         childNode = CreateChild();
         node.AddNode(childNode);
         UIService.SetUIDirty(node.Hierarchy);
         UIService.ActivateNode(childNode);
     }
     finally
     {
         UIService.EndUpdate();
     }
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:21,代码来源:AddChildNodeCommand.cs

示例6: ExecuteCore

        /// <summary>
        /// Adds either a <see cref="FieldNode"/>, <see cref="MethodNode"/> or <see cref="PropertyNode"/> to the current <see cref="RuleSetNode"/>,
        /// based on the selected member.
        /// </summary>
        /// <param name="node">The parent node to newly added configuration node.</param>
        protected override void ExecuteCore(ConfigurationNode node)
        {
            try
            {
                UIService.BeginUpdate();
                Type type = FindType(node);
                if (type != null)
                {
                    IUIService uiService = ServiceHelper.GetUIService(serviceProvider);
                    TypeMemberChooser memberChooser = new TypeMemberChooser(uiService);
                    foreach (MemberInfo memberInfo in memberChooser.ChooseMembers(type))
                    {
                        if (memberInfo != null)
                        {
                            if (node.Nodes.Contains(memberInfo.Name)) continue;

                            ConfigurationNode childNode = null;
                            if (memberInfo is PropertyInfo)
                            {
                                childNode = new PropertyNode(memberInfo.Name);
                            }
                            else if (memberInfo is MethodInfo)
                            {
                                childNode = new MethodNode(memberInfo.Name);
                            }
                            else if (memberInfo is FieldInfo)
                            {
                                childNode = new FieldNode(memberInfo.Name);
                            }
                            else
                            {
                                Debug.Assert(false, "memberInfo should be either PropertyInfo, MethodInfo or FieldInfo");
                            }

                            node.AddNode(childNode);
                            UIService.SetUIDirty(node.Hierarchy);
                        }
                    }
                }
            }
            finally
            {
                UIService.EndUpdate();
            }
        }
开发者ID:rentianhua,项目名称:AgileMVC,代码行数:50,代码来源:AddMemberNodeCommand.cs


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