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


C# ConfigurationNode.GetType方法代码示例

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


在下文中一共展示了ConfigurationNode.GetType方法的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);
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:7,代码来源:StorageCreationNodeCommand.cs

示例2: Create

 /// <devdoc>
 /// Creates a new intance of a ConfigurationTreeNode class and sets its ImageIndex and SelectedImageIndex property values.
 /// </devdoc>
 public static ConfigurationTreeNode Create(ConfigurationNode node)
 {
     Type nodeType = node.GetType();
     Type treeNodeType = GetTreeNodeType(nodeType);
     ConfigurationTreeNode treeNode = (ConfigurationTreeNode) Activator.CreateInstance(treeNodeType, new object[] {node});
     if (Current.imageContainer != null)
     {
         treeNode.ImageIndex = Current.imageContainer.GetImageIndex(nodeType);
         treeNode.SelectedImageIndex = Current.imageContainer.GetSelectedImageIndex(nodeType);
     }
     if (Current.treeNodeContainer != null)
     {
         Current.treeNodeContainer.AddTreeNode(treeNode);
     }
     return treeNode;
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:19,代码来源:TreeNodeFactory.cs

示例3: NodeTypeMatchesDataType

 private bool NodeTypeMatchesDataType(ConfigurationNode node, Type t)
 {
     INodeCreationService nodeCreationService = NodeCreationService;
     return (nodeCreationService.DoesNodeTypeMatchDataType(node.GetType(), t));
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:5,代码来源:RemoveXmlIncludeTypesCommand.cs

示例4: SetUniqueComponentName

 private void SetUniqueComponentName(ConfigurationNode node)
 {
     INodeNameCreationService service = ServiceHelper.GetNameCreationService(serviceProvider);
     string nameToUse = node.Name;
     if (string.IsNullOrEmpty(nameToUse)) nameToUse = node.GetType().Name;
     ConfigurationNode parent = GetParentToBeUsed(node);
     string newName = service.GetUniqueName(nameToUse, node, parent);
     if (node.Name != newName)
     {
         node.Rename(newName, false);
     }
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:12,代码来源:ConfigurationUIHierarchy.cs

示例5: OtherNodeTypesExists

 private bool OtherNodeTypesExists(ConfigurationNode node)
 {
     ConfigurationNode[] nodes = CurrentHierarchy.FindNodesByType(node.GetType());
     return (nodes != null && nodes.Length > 0);
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:5,代码来源:RemoveXmlIncludeTypesCommand.cs

示例6: FindNodesByType

        /// <devdoc>
        /// Finds nodes by it's type for a parent
        /// </devdoc>
        public ConfigurationNode[] FindNodesByType(ConfigurationNode parent, Type type)
        {
            ArgumentValidation.CheckForNullReference(type, "type");
            ArgumentValidation.CheckForNullReference(parent, "parent");

            ArrayList nodes = new ArrayList();
            if (type == parent.GetType())
            {
                nodes.Add(parent);
            }
            DoSearch(parent, type, nodes);
            return (ConfigurationNode[])nodes.ToArray(typeof(ConfigurationNode));
        }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:16,代码来源:UIHierarchy.cs

示例7: GetParentToBeUsed

 private ConfigurationNode GetParentToBeUsed(ConfigurationNode node)
 {
     PropertyInfo info = node.GetType().GetProperty("Name");
     object [] attributes = info.GetCustomAttributes(typeof(UniqueNameAttribute), true);
     if (attributes.Length == 0) return node.Parent;
     UniqueNameAttribute attr = (UniqueNameAttribute)attributes[0];
     return FindNodeByType(rootNode, attr.ContainerType);
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:8,代码来源:ConfigurationUIHierarchy.cs

示例8: RemoveNode

 /// <summary>
 /// Remove a node from the hierarchy.
 /// </summary>
 /// <param name="node">
 /// The node to remove.
 /// </param>
 public void RemoveNode(ConfigurationNode node)
 {
     string nodeTypeName = node.GetType().FullName;
     nodesByType.Remove(node.Id);
     if (node.Parent != null)
     {
         NodeTypeEntryArrayList childTypes = nodesByType[node.Parent.Id];
         NodeTypeEntry entryToRemove = new NodeTypeEntry(node, nodeTypeName);
         if (childTypes.Contains(entryToRemove))
         {
             childTypes.Remove(entryToRemove);
             RemoveBaseTypes(node, childTypes);
         }
     }
     node.Hierarchy = null;
     nodesById.Remove(node.Id);
     RemoveNodeByName(node);
     if (node.Id == rootNode.Id) rootNode = null;
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:25,代码来源:ConfigurationUIHierarchy.cs

示例9: AddBaseTypes

 private static void AddBaseTypes(ConfigurationNode node, ArrayList tableToAddTypes)
 {
     Type searchType = node.GetType().BaseType;
     while (searchType != null && searchType != typeof(ConfigurationNode))
     {
         tableToAddTypes.Add(new NodeTypeEntry(node, searchType.FullName));
         searchType = searchType.BaseType;
     }
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:9,代码来源:ConfigurationUIHierarchy.cs

示例10: AddMenus

        private void AddMenus(ConfigurationNode node, MenuItem[] menuItems)
        {
            Debug.Assert(node != null);
            ClearMenuItems(menuItems);
            IUICommandService service = (IUICommandService)designHost.GetService(typeof(IUICommandService));
            List<ConfigurationMenuItem> configMenuItems = new List<ConfigurationMenuItem>();
            service.ForEach(node.GetType(), delegate(ConfigurationUICommand command)
            {
                configMenuItems.Add(new ConfigurationMenuItem(node, command));
            });

            configMenuItems.Sort(delegate(ConfigurationMenuItem lhs, ConfigurationMenuItem rhs)
            {
                return lhs.Text.CompareTo(rhs.Text);
            });

            foreach (ConfigurationMenuItem menuItem in configMenuItems)
            {
                menuItem.Select += new EventHandler(OnMenuItemSelect);
                switch (menuItem.InsertionPoint)
                {
                    case InsertionPoint.Action:
                        menuItems[(int)MenuItemPosition.Action].MenuItems.Add(menuItem);
                        break;
                    case InsertionPoint.Help:
                        menuItems[(int)MenuItemPosition.Help].MenuItems.Add(menuItem);
                        break;
                    case InsertionPoint.New:
                        menuItems[(int)MenuItemPosition.New].MenuItems.Add(menuItem);
                        break;
                }
            }
            AddDefaultMenuItems(menuItems);
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:34,代码来源:MainForm.cs

示例11: AddNode

        /// <summary>
        /// Add a node to the hierarchy.
        /// </summary>
        /// <param name="node">
        /// The node to add to the hierarchy.
        /// </param>
        public void AddNode(ConfigurationNode node)
        {
            if (node == null) throw new ArgumentNullException("node");
            if (nodesById.ContainsKey(node.Id)) return; // we already own this one

            SetUniqueComponentName(node);
            AddSite(node, node.Name);
            node.Hierarchy = this;
            string nodeTypeName = node.GetType().FullName;
            if (!nodesByType.ContainsKey(node.Id))
            {
                nodesByType[node.Id] = new NodeTypeEntryArrayList();
            }
            if (node.Parent != null && nodesByType.ContainsKey(node.Parent.Id))
            {
                NodeTypeEntryArrayList childTypes = nodesByType[node.Parent.Id];
                NodeTypeEntry entry = new NodeTypeEntry(node, nodeTypeName);
                if (!childTypes.Contains(entry))
                {
                    childTypes.Add(entry);
                    AddBaseTypes(node, childTypes);
                }
            }
            nodesById[node.Id] = node;
            AddNodeByName(node);
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:32,代码来源:ConfigurationUIHierarchy.cs

示例12: NodeReadOnly

 private static bool NodeReadOnly(ConfigurationNode node)
 {
     object[] attributes = node.GetType().GetProperty("Name").GetCustomAttributes(typeof(ReadOnlyAttribute), true);
     return (attributes.Length > 0);
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:5,代码来源:MainForm.cs

示例13: ExecuteCore

 /// <summary>
 /// <para>Removes the <see cref="IUIHierarchy"/> (<see cref="ApplicationConfigurationNode"/> from the <see cref="IUIHierarchyService"/>.</para>
 /// </summary>
 /// <param name="node">
 /// <para>The node to execute the command upon.</para>
 /// </param>
 protected override void ExecuteCore(ConfigurationNode node)
 {
     Debug.Assert(node.GetType().Equals(typeof(ApplicationConfigurationNode)), "Expected an ApplicationConfigurationNode");
     UIHierarchyService.RemoveHierarchy(node.Hierarchy.Id);
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:11,代码来源:RemoveApplicationConfigurationNodeCommand.cs

示例14: RemoveNode

 /// <summary>
 /// <para>Remove a node from the hierarchy.</para>
 /// </summary>
 /// <param name="node">
 /// <para>The node to remove.</para>
 /// </param>
 public void RemoveNode(ConfigurationNode node)
 {
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     string nodeTypeName = node.GetType().FullName;
     nodesByType.Remove(node.Id);
     if (node.Parent != null)
     {
         NodeTypeEntryArrayList childTypes = (NodeTypeEntryArrayList)nodesByType[node.Parent.Id];
         NodeTypeEntry entryToRemove = new NodeTypeEntry(node, nodeTypeName);
         if (childTypes.Contains(entryToRemove))
         {
             childTypes.Remove(entryToRemove);
             RemoveBaseTypes(node, childTypes);
         }
     }
     node.Hierarchy = null;
     nodesById.Remove(node.Id);
     RemoveNodeByName(node);
     RemoveFromContainer(node);
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:29,代码来源:UIHierarchy.cs

示例15: ExecuteCore

 /// <summary>
 /// <para>Saves the application configuration.</para>
 /// </summary>
 /// <param name="node">
 /// <para>The node to execute the command upon.</para>
 /// </param>
 protected override void ExecuteCore(ConfigurationNode node)
 {
     Debug.Assert(node.GetType().Equals(typeof(ApplicationConfigurationNode)));
     if (!DoValidationCommand(node))
     {
         return;
     }
     if (!DoApplicationSave(node))
     {
         return;
     }
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:18,代码来源:SaveApplicationConfigurationNodeCommand.cs


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