本文整理汇总了C#中Microsoft.VisualStudio.Package.HierarchyNode.GetRelationalName方法的典型用法代码示例。如果您正苦于以下问题:C# HierarchyNode.GetRelationalName方法的具体用法?C# HierarchyNode.GetRelationalName怎么用?C# HierarchyNode.GetRelationalName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.VisualStudio.Package.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(Microsoft.Build.Evaluation.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
/// <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)
{
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);
}
示例3: AddNewFileNodeToHierarchyCore
private HierarchyNode AddNewFileNodeToHierarchyCore(HierarchyNode parentNode, string fileName, string linkPath)
{
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);
child.ItemNode.SetMetadata(ProjectFileConstants.Link, linkPath);
if (!String.IsNullOrEmpty(linkPath))
{
child.ExcludeNodeFromScc = true;
}
}
parentNode.AddChild(child);
return child;
}
示例4: AddNewFileNodeToHierarchy
/// <summary>
/// Adds the new file node to hierarchy.
/// </summary>
/// <param name="parentNode">The parent node.</param>
/// <param name="fileName">Name of the file.</param>
protected override void AddNewFileNodeToHierarchy(HierarchyNode parentNode, string path)
{
// If a lua file is being added, try to find a related FrameXML node
if (MultiverseInterfaceProjectNode.IsPythonFile(path))
{
// Try to find a FrameXML node with a matching relational name
string fileName = Path.GetFileNameWithoutExtension(path);
HierarchyNode childNode = this.FirstChild;
// Iterate through the children
while (childNode != null)
{
// If this child is an XML node and its relational name matches, break out of the loop
if (childNode is MultiverseInterfaceXmlFileNode && String.Compare(childNode.GetRelationalName(), fileName, StringComparison.OrdinalIgnoreCase) == 0)
{
parentNode = childNode;
break;
}
// Move over to the next sibling
childNode = childNode.NextSibling;
}
}
HierarchyNode child;
if (this.CanFileNodesHaveChilds && (parentNode is FileNode || parentNode is DependentFileNode))
{
child = this.CreateDependentFileNode(path);
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 (String.Compare(child.GetRelationalName(), parentNode.GetRelationalName(), StringComparison.OrdinalIgnoreCase) == 0)
{
child.HasParentNodeNameRelation = true;
}
}
else
{
//Create and add new filenode to the project
child = this.CreateFileNode(path);
}
parentNode.AddChild(child);
this.Tracker.OnItemAdded(path, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags);
}