本文整理汇总了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);
}
示例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;
}
示例3: NodeTypeMatchesDataType
private bool NodeTypeMatchesDataType(ConfigurationNode node, Type t)
{
INodeCreationService nodeCreationService = NodeCreationService;
return (nodeCreationService.DoesNodeTypeMatchDataType(node.GetType(), t));
}
示例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);
}
}
示例5: OtherNodeTypesExists
private bool OtherNodeTypesExists(ConfigurationNode node)
{
ConfigurationNode[] nodes = CurrentHierarchy.FindNodesByType(node.GetType());
return (nodes != null && nodes.Length > 0);
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例12: NodeReadOnly
private static bool NodeReadOnly(ConfigurationNode node)
{
object[] attributes = node.GetType().GetProperty("Name").GetCustomAttributes(typeof(ReadOnlyAttribute), true);
return (attributes.Length > 0);
}
示例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);
}
示例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);
}
示例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;
}
}