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


C# ProjectElement.GetMetadata方法代码示例

本文整理汇总了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;
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:54,代码来源:MultiverseInterfaceProjectNode.cs

示例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);
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:27,代码来源:MultiverseInterfaceProjectNode.cs

示例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;
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:15,代码来源:PythonProjectNode.cs

示例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;
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:30,代码来源:PythonProjectNode.cs

示例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;
        }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:16,代码来源:RubyProjectNode.cs


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