本文整理汇总了C#中Microsoft.VisualStudio.Package.ProjectElement.GetMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectElement.GetMetadata方法的具体用法?C# ProjectElement.GetMetadata怎么用?C# ProjectElement.GetMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.VisualStudio.Package.ProjectElement
的用法示例。
在下文中一共展示了ProjectElement.GetMetadata方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFileNode
/// <summary>
/// Creates a file node for a project element.
/// </summary>
/// <param name="element">The project element.</param>
/// <returns>An instance of the <see cref="FileNode"/> class.</returns>
public override FileNode CreateFileNode(ProjectElement element)
{
if (element == null)
throw new ArgumentNullException("element");
MultiverseInterfaceFileNode node = null;
// Get the SubType for the project element.
string subType = element.GetMetadata(ProjectFileConstants.SubType);
switch (subType)
{
case MultiverseInterfaceSubType.Code:
node = new MultiverseInterfacePythonFileNode(this, element);
break;
case MultiverseInterfaceSubType.Frame:
node = new MultiverseInterfaceXmlFileNode(this, element);
break;
case MultiverseInterfaceSubType.TableOfContents:
node = new MultiverseInterfaceTocFileNode(this, element);
break;
default:
// We could not recognize the file subtype, just create a WowFileNode
node = new MultiverseInterfaceFileNode(this, element);
break;
}
// Check whether this file should be added to the language service
if (subType == MultiverseInterfaceSubType.Frame || subType == MultiverseInterfaceSubType.Code)
{
IPythonLanguageService languageService = (IPythonLanguageService)this.GetService(typeof(IPythonLanguageService));
// Make sure the language service is available
if (languageService != null)
{
switch (subType)
{
case MultiverseInterfaceSubType.Frame:
languageService.AddFrameXmlFile(node.GetMkDocument());
break;
case MultiverseInterfaceSubType.Code:
languageService.AddPythonFile(node.GetMkDocument());
break;
}
}
}
return node;
}
示例2: CreateDependentFileNode
/// <summary>
/// Creates a file node for a project element.
/// </summary>
/// <param name="element">The project element.</param>
/// <returns>An instance of the <see cref="DependentFileNode"/> class.</returns>
public override DependentFileNode CreateDependentFileNode(ProjectElement element)
{
if (element == null)
throw new ArgumentNullException("element");
string subType = element.GetMetadata(ProjectFileConstants.SubType);
if (subType == MultiverseInterfaceSubType.Code)
{
DependentFileNode node = new MultiverseInterfaceIronPythonDependentFileNode(this, element);
IPythonLanguageService languageService = (IPythonLanguageService)this.GetService(typeof(IPythonLanguageService));
// Make sure the language service is available
if (languageService != null)
languageService.AddPythonFile(node.GetMkDocument());
return node;
}
return base.CreateDependentFileNode(element);
}
示例3: CreateDependentFileNode
public override DependentFileNode CreateDependentFileNode(ProjectElement item)
{
DependentFileNode node = base.CreateDependentFileNode(item);
if (null != node)
{
string include = item.GetMetadata(ProjectFileConstants.Include);
if (IsCodeFile(include))
{
node.OleServiceProvider.AddService(
typeof(SVSMDCodeDomProvider), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
}
}
return node;
}
示例4: CreateFileNode
/// <summary>
/// Create a file node based on an msbuild item.
/// </summary>
/// <param name="item">The msbuild item to be analyzed</param>
/// <returns>PythonFileNode or FileNode</returns>
public override FileNode CreateFileNode(ProjectElement item)
{
if (item == null)
{
throw new ArgumentNullException("item");
}
string include = item.GetMetadata(ProjectFileConstants.Include);
PythonFileNode newNode = new PythonFileNode(this, item);
newNode.OleServiceProvider.AddService(typeof(EnvDTE.Project), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
newNode.OleServiceProvider.AddService(typeof(EnvDTE.ProjectItem), newNode.ServiceCreator, false);
if (!string.IsNullOrEmpty(include) && Path.GetExtension(include).Equals(".xaml", StringComparison.OrdinalIgnoreCase))
{
//Create a DesignerContext for the XAML designer for this file
newNode.OleServiceProvider.AddService(typeof(DesignerContext), newNode.ServiceCreator, false);
}
newNode.OleServiceProvider.AddService(typeof(VSLangProj.VSProject), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
if (IsCodeFile(include))
{
newNode.OleServiceProvider.AddService(
typeof(SVSMDCodeDomProvider), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
}
return newNode;
}
示例5: CreateFileNode
public override FileNode CreateFileNode(ProjectElement item)
{
RubyFileNode newNode = new RubyFileNode(this, item);
string include = item.GetMetadata(ProjectFileConstants.Include);
newNode.OleServiceProvider.AddService(typeof(EnvDTE.Project), new OleServiceProvider.ServiceCreatorCallback(CreateServices), false);
newNode.OleServiceProvider.AddService(typeof(EnvDTE.ProjectItem), newNode.ServiceCreator, false);
newNode.OleServiceProvider.AddService(typeof(VSLangProj.VSProject), new OleServiceProvider.ServiceCreatorCallback(CreateServices), false);
if (IsCodeFile(include))
newNode.OleServiceProvider.AddService(typeof(SVSMDCodeDomProvider), newNode.ServiceCreator, false);
// new OleServiceProvider.ServiceCreatorCallback(CreateServices), false);
return newNode;
}