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


C# EnvDTE.Item方法代码示例

本文整理汇总了C#中EnvDTE.Item方法的典型用法代码示例。如果您正苦于以下问题:C# EnvDTE.Item方法的具体用法?C# EnvDTE.Item怎么用?C# EnvDTE.Item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EnvDTE的用法示例。


在下文中一共展示了EnvDTE.Item方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FromDteProperties

 public static TestRunnerOptions FromDteProperties(EnvDTE.Properties properties)
 {
     return new TestRunnerOptions
     {
         DetectMemoryLeaks = (bool) properties.Item("DetectMemoryLeaks").Value
     };
 }
开发者ID:planetmarshall,项目名称:boost_test_extension,代码行数:7,代码来源:TestRunnerOptions.cs

示例2: findFiles

        /// <summary>
        /// Find all .cs files in the project, including sub-folders.
        /// </summary>
        private void findFiles(EnvDTE.ProjectItems projectItems, HashSet<FileInfo> files)
        {
            // We look through the items...
            int numProjectItems = Utils.call(() => (projectItems.Count));
            for (int i = 1; i <= numProjectItems; ++i)
            {
                EnvDTE.ProjectItem projectItem = Utils.call(() => (projectItems.Item(i)));

                // We get the full-path...
                EnvDTE.Properties dteProperties = Utils.call(() => (projectItem.Properties));
                Dictionary<string, object> properties = getProperties(dteProperties);
                string fullPath = getStringProperty(properties, "FullPath");
                int copyToOutputFolder = getIntProperty(properties, "CopyToOutputDirectory");

                // We check if it is a file (it could be a folder instead)...
                if (File.Exists(fullPath) == true)
                {
                    // We add it to the list of files...
                    FileInfo fileInfo = new FileInfo();
                    fileInfo.AbsolutePath = fullPath;
                    fileInfo.RelativePath = Utils.makeRelativePath(m_projectInfo.RootFolderAbsolute, fullPath);
                    fileInfo.CopyToOutputFolder = (copyToOutputFolder != 0);
                    files.Add(fileInfo);
                }

                // We see if the item itself has sub-items...
                EnvDTE.ProjectItems subItems = Utils.call(() => (projectItem.ProjectItems));
                if (subItems != null)
                {
                    findFiles(subItems, files);
                }

                // We see if this item has a sub-project...
                EnvDTE.Project subProject = Utils.call(() => (projectItem.SubProject));
                if (subProject != null)
                {
                    EnvDTE.ProjectItems subProjectItems = Utils.call(() => (subProject.ProjectItems));
                    findFiles(subProjectItems, files);
                }
            }
        }
开发者ID:qqshow,项目名称:make-it-so,代码行数:44,代码来源:ProjectParser_CSharp.cs

示例3: getProperties

        /// <summary>
        /// Converts the collection of properties passed in into a map 
        /// of string -> object.
        /// </summary>
        private Dictionary<string, object> getProperties(EnvDTE.Properties dteProperties)
        {
            Dictionary<string, object> results = new Dictionary<string, object>();

            // Some properties do not seem to have valid values. These are
            // the main ones we have trouble with, so we will ignore them and
            // not try to retrieve their values...
            HashSet<string> slowProperties = new HashSet<string> { "WebServer", "ServerExtensionsVersion", "OfflineURL", "WebServerVersion", "WebAccessMethod", "ActiveFileSharePath", "AspnetVersion", "FileSharePath" };

            // We loop through the properties...
            int numProperties = Utils.call(() => (dteProperties.Count));
            for (int i = 1; i <= numProperties; ++i)
            {
                try
                {
                    EnvDTE.Property dteProperty = Utils.call(() => (dteProperties.Item(i)));
                    string propertyName = Utils.call(() => (dteProperty.Name));
                    if (slowProperties.Contains(propertyName) == true)
                    {
                        // This is one of the properties to ignore...
                        continue;
                    }

                    object propertyValue = Utils.call(() => (dteProperty.Value));
                    results[propertyName] = propertyValue;
                }
                catch (Exception)
                {
                    // Some of the properties don't seem to have valid values.
                    // I'm not really sure why this is. But we silently catch
                    // the exception, as they don't seem to be the properties
                    // we need anyway.
                }
            }

            return results;
        }
开发者ID:qqshow,项目名称:make-it-so,代码行数:41,代码来源:ProjectParser_CSharp.cs

示例4: parseProjects

 /// <summary>
 /// Parses projects in the collection of projects passed in.
 /// </summary>
 private void parseProjects(EnvDTE.Projects projects)
 {
     // We parse each project in the collection.
     // Note that this may end up recursing back into this function,
     // as there may be projects nested in other projects...
     int numProjects = Utils.call(() => (projects.Count));
     for (int i = 1; i <= numProjects; ++i)
     {
         EnvDTE.Project project = Utils.call(() => (projects.Item(i)));
         parseProject(project);
     }
 }
开发者ID:qqshow,项目名称:make-it-so,代码行数:15,代码来源:SolutionParser.cs

示例5: parseProjectItems

        /// <summary>
        /// Parses a collection of project-items checking for sub-projects.
        /// </summary><remarks>
        /// Project items can be things like files and folders, or sub-projects.
        /// So when we parse a project, we need to drill into the items as there
        /// may be projects nested inside folders etc.
        /// </remarks>
        private void parseProjectItems(EnvDTE.ProjectItems projectItems)
        {
            // We look through the items...
            int numProjectItems = Utils.call(() => (projectItems.Count));
            for (int i = 1; i <= numProjectItems; ++i)
            {
                EnvDTE.ProjectItem projectItem = Utils.call(() => (projectItems.Item(i)));

                // We see if the item itself has sub-items...
                EnvDTE.ProjectItems subItems = Utils.call(() => (projectItem.ProjectItems));
                if (subItems != null)
                {
                    parseProjectItems(subItems);
                }

                // We see if this item has a sub-project...
                EnvDTE.Project subProject = Utils.call(() => (projectItem.SubProject));
                if (subProject != null)
                {
                    parseProject(subProject);
                }
            }
        }
开发者ID:qqshow,项目名称:make-it-so,代码行数:30,代码来源:SolutionParser.cs

示例6: GetAttributeArgumentForCodeModelEvent

        private EnvDTE.CodeElement GetAttributeArgumentForCodeModelEvent(CodeModelEvent codeModelEvent, EnvDTE.CodeElements parentAttributeArguments, object parentElement)
        {
            if (parentAttributeArguments == null)
            {
                return null;
            }

            CodeModelService.GetAttributeArgumentParentAndIndex(codeModelEvent.Node, out var attributeNode, out var ordinal);

            if (codeModelEvent.Type == CodeModelEventType.Remove)
            {
                var parentCodeElement = ComAggregate.TryGetManagedObject<CodeAttribute>(parentElement);
                if (parentCodeElement != null)
                {
                    return (EnvDTE.CodeElement)CodeAttributeArgument.Create(this.State, parentCodeElement, ordinal);
                }
            }
            else
            {
                return parentAttributeArguments.Item(ordinal + 1); // Needs to be 1-based to call back into code model
            }

            return null;
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:24,代码来源:FileCodeModel_Events.cs

示例7: GetParameterElementForCodeModelEvent

        private EnvDTE.CodeElement GetParameterElementForCodeModelEvent(CodeModelEvent codeModelEvent, EnvDTE.CodeElements parentParameters, object parentElement)
        {
            if (parentParameters == null)
            {
                return null;
            }

            var parameterName = this.CodeModelService.GetName(codeModelEvent.Node);

            if (codeModelEvent.Type == CodeModelEventType.Remove)
            {
                var parentCodeElement = ComAggregate.TryGetManagedObject<AbstractCodeMember>(parentElement);
                if (parentCodeElement != null)
                {
                    return (EnvDTE.CodeElement)CodeParameter.Create(this.State, parentCodeElement, parameterName);
                }
            }
            else
            {
                return parentParameters.Item(parameterName);
            }

            return null;
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:24,代码来源:FileCodeModel_Events.cs

示例8: HasProperty

		private static bool HasProperty(EnvDTE.Properties properties, string name)
		{
			try
			{
				return (((properties.Item(name) != null) && (properties.Item(name).Value != null)) && !string.IsNullOrEmpty(properties.Item(name).Value.ToString()));
			}
			catch
			{
				return false;
			}
		}
开发者ID:Phidiax,项目名称:open-wssf-2015,代码行数:11,代码来源:XsdElementBrowserControl.cs

示例9: ResolveAppNameCollisionWithUser

        private string ResolveAppNameCollisionWithUser(EnvDTE.ProjectItems items, string name, out bool cancel) {
            while (true) {
                try {
                    if (items.Item(name) == null) {
                        break;
                    }
                } catch (ArgumentException) {
                    break;
                }

                var td = new TaskDialog(new ServiceProvider(GetSite())) {
                    Title = Resources.PythonToolsForVisualStudio,
                    MainInstruction = string.Format(Resources.DjangoAppAlreadyExistsTitle, name),
                    Content = string.Format(Resources.DjangoAppAlreadyExistsInstruction, name),
                    AllowCancellation = true
                };
                var cont = new TaskDialogButton(
                    Resources.DjangoAppAlreadyExistsCreateAnyway,
                    Resources.DjangoAppAlreadyExistsCreateAnywaySubtitle
                );
                var retry = new TaskDialogButton(Resources.SelectAnotherName);
                td.Buttons.Add(cont);
                td.Buttons.Add(retry);
                td.Buttons.Add(TaskDialogButton.Cancel);

                var clicked = td.ShowModal();
                if (clicked == cont) {
                    break;
                } else if (clicked == retry) {
                    name = GetNewAppNameFromUser(name);
                    if (string.IsNullOrEmpty(name)) {
                        cancel = true;
                        return null;
                    }
                } else {
                    cancel = true;
                    return null;
                }
            }

            cancel = false;
            return name;
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:43,代码来源:DjangoProject.cs

示例10: GetPropertyValue

 public static object GetPropertyValue(EnvDTE.Properties properties, string name)
 {
     return properties.Item(name).Value;
 }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:4,代码来源:Utility.cs

示例11: GetDefaultNamespaceFromProperties

 /// <summary>
 /// Gets default namespace from properties (obtained from a Project or ProjectItem).
 /// </summary>
 /// <param name="properties">Properties from where to get the Default Namespace.</param>
 /// <returns></returns>
 public static string GetDefaultNamespaceFromProperties(EnvDTE.Properties properties)
 {
     return properties.Item(Resources.Properties_DefaultNamespace).Value.ToString();
 }
开发者ID:kzfabi,项目名称:EntitiesToDTOs,代码行数:9,代码来源:VisualStudioHelper.cs

示例12: GetPropertyValue

        /// <summary>
        /// Helper function to get the text from a project item
        /// </summary>
        private static string GetPropertyValue(EnvDTE.Properties source, string name)
        {
            if (source == null || string.IsNullOrEmpty(name))
                return string.Empty;

            EnvDTE.Property property = source.Item(name);
            return property != null ? property.Value.ToString() : String.Empty;
        }
开发者ID:kevinmiles,项目名称:dxcorecommunityplugins,代码行数:11,代码来源:PlugIn1.cs


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