本文整理汇总了C#中HierarchyNode.GetRelationalName方法的典型用法代码示例。如果您正苦于以下问题:C# HierarchyNode.GetRelationalName方法的具体用法?C# HierarchyNode.GetRelationalName怎么用?C# HierarchyNode.GetRelationalName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HierarchyNode
的用法示例。
在下文中一共展示了HierarchyNode.GetRelationalName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddDependentFileNodeToNode
/// <summary>
/// Add a dependent file node to the hierarchy
/// </summary>
/// <param name="item">msbuild item to add</param>
/// <param name="parentNode">Parent Node</param>
/// <returns>Added node</returns>
private HierarchyNode AddDependentFileNodeToNode(MSBuild.ProjectItem item, HierarchyNode parentNode)
{
FileNode node = this.CreateDependentFileNode(new ProjectElement(this, item, false));
parentNode.AddChild(node);
// Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name
if (!node.HasParentNodeNameRelation && string.Compare(node.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0)
{
node.HasParentNodeNameRelation = true;
}
return node;
}
示例2: AddNewFileNodeToHierarchy
// KLiss: body of this method is copy/pasted from base one (and modified),
// as base implementation does not allow changing parent node on-the-fly.
protected override void AddNewFileNodeToHierarchy(HierarchyNode parentNode, string fileName)
{
HierarchyNode child;
HierarchyNode newParent;
// KLiss: try to find possible parent file (ie, Form3.n would be parent for Form3.designer.n
bool parentFound = TryFindParentFileNode(parentNode, fileName, out newParent);
if (parentFound)
{
parentNode = newParent;
// KLiss: when file is added to project, it is treated as code file,
// regardless of SubType value, specified in the template.
// SubType is assigned correct value later, and now we will make another
// attempt to find out, whether it is OK for an item to have designer, or not.
var nemerleParent = parentNode as NemerleFileNode;
if (nemerleParent != null)
{
nemerleParent.InferHasDesignerFromSubType();
}
}
// In the case of subitem, we want to create dependent file node
// and set the DependentUpon property
if (parentFound || parentNode is FileNode || parentNode is DependentFileNode)
{
child = this.CreateDependentFileNode(fileName);
child.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon, parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include));
// Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name
if (!child.HasParentNodeNameRelation && string.Compare(child.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0)
{
child.HasParentNodeNameRelation = true;
}
}
else
{
//Create and add new filenode to the project
child = this.CreateFileNode(fileName);
}
parentNode.AddChild(child);
var projectInfo = ProjectInfo;
if (projectInfo != null)
projectInfo.Engine.RequestOnBuildTypesTree();
//// TODO : Revisit the VSADDFILEFLAGS here. Can it be a nested project?
//this.tracker.OnItemAdded(fileName, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags);
}
示例3: AddNewFileNodeToHierarchy
/// <summary>
/// Adds a new file node to the hierarchy.
/// </summary>
/// <param name="parentNode">The parent of the new fileNode</param>
/// <param name="fileName">The file name</param>
protected virtual void AddNewFileNodeToHierarchy(HierarchyNode parentNode, string fileName)
{
if (parentNode == null)
{
throw new ArgumentNullException("parentNode");
}
HierarchyNode child;
// In the case of subitem, we want to create dependent file node
// and set the DependentUpon property
if (this.canFileNodesHaveChilds && (parentNode is FileNode || parentNode is DependentFileNode))
{
child = this.CreateDependentFileNode(fileName);
child.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon, parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include));
// Make sure to set the HasNameRelation flag on the dependent node if it is related to the parent by name
if (!child.HasParentNodeNameRelation && string.Compare(child.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0)
{
child.HasParentNodeNameRelation = true;
}
}
else
{
//Create and add new filenode to the project
child = this.CreateFileNode(fileName);
}
parentNode.AddChild(child);
// TODO : Revisit the VSADDFILEFLAGS here. Can it be a nested project?
this.tracker.OnItemAdded(fileName, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags);
}
示例4: AddNewLinkedFileNodeToHierarchy
// !EFW
/// <summary>
/// Adds a new linked file node to the hierarchy.
/// </summary>
/// <param name="parentNode">The parent of the new fileNode</param>
/// <param name="linkedFileName">The linked filename</param>
/// <param name="fileName">The file name in the project heirarchy</param>
protected virtual void AddNewLinkedFileNodeToHierarchy(
HierarchyNode parentNode, string linkedFileName, string fileName)
{
// NOTE: The general process should match that of
// AddNewFileNodeToHierarchy with the exception of the filename
// used and the addition of the Link metadata.
HierarchyNode child;
// In the case of subitem, we want to create dependent file node
// and set the DependentUpon property
if(this.canFileNodesHaveChilds && (parentNode is FileNode || parentNode is DependentFileNode))
{
child = this.CreateDependentFileNode(linkedFileName);
child.ItemNode.SetMetadata(ProjectFileConstants.Link,
PackageUtilities.MakeRelative(base.ProjectMgr.FileName, fileName));
child.ItemNode.SetMetadata(ProjectFileConstants.DependentUpon,
parentNode.ItemNode.GetMetadata(ProjectFileConstants.Include));
// Make sure to set the HasNameRelation flag on the dependent
// node if it is related to the parent by name
if(!child.HasParentNodeNameRelation && string.Compare(child.GetRelationalName(),
parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0)
{
child.HasParentNodeNameRelation = true;
}
}
else
{
//Create and add new filenode to the project
child = this.CreateFileNode(linkedFileName);
child.ItemNode.SetMetadata(ProjectFileConstants.Link,
PackageUtilities.MakeRelative(base.ProjectMgr.FileName, fileName));
}
parentNode.AddChild(child);
// TODO : Revisit the VSADDFILEFLAGS here. Can it be a nested project?
this.tracker.OnItemAdded(fileName, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags);
}