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


C# UIHierarchyItem类代码示例

本文整理汇总了C#中UIHierarchyItem的典型用法代码示例。如果您正苦于以下问题:C# UIHierarchyItem类的具体用法?C# UIHierarchyItem怎么用?C# UIHierarchyItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CollapseRecursively

        internal static void CollapseRecursively(UIHierarchyItem parentItem)
        {
            if (parentItem == null)
            {
                throw new ArgumentNullException("parentItem");
            }

            if (!parentItem.UIHierarchyItems.Expanded) return;

            // Recurse to all children first.
            foreach (UIHierarchyItem childItem in parentItem.UIHierarchyItems)
            {
                CollapseRecursively(childItem);
            }

            if (ShouldCollapseItem(parentItem))
            {
                // Attempt the direct collapse first.
                parentItem.UIHierarchyItems.Expanded = false;

                // If failed, solution folder oddity may be at play.  Try an alternate path.
                if (parentItem.UIHierarchyItems.Expanded)
                {
                    parentItem.Select(vsUISelectionType.vsUISelectionTypeSelect);
                    ((DTE2)parentItem.DTE).ToolWindows.SolutionExplorer.DoDefaultAction();
                }
            }
        }
开发者ID:hhahh2011,项目名称:CH.EasyCode,代码行数:28,代码来源:UIHierarchyHelper.cs

示例2: DisplayCommand

        /// <summary>
        /// Determines if the command should be displayed or not.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public override bool DisplayCommand(UIHierarchyItem item)
        {
            try
            {
                UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
                if (((System.Array)solExplorer.SelectedItems).Length != 1)
                    return false;

                UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0));
                ProjectItem pi = (ProjectItem)hierItem.Object;
                if (pi.Object is DataSourceView)
                {
                    Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)pi.ContainingProject;
                    return (projExt.Kind == BIDSProjectKinds.SSAS); //only show in an SSAS project, not in a report model or SSIS project (which also can have a DSV)
                }
                else if (pi.Object is Dimension)
                {
                    Dimension dim = pi.Object as Dimension;
                    if (dim != null && dim.IsParentChild)
                        return true;
                }
                return false;
            }
            catch
            {
                return false;
            }
        }
开发者ID:japj,项目名称:bidshelper,代码行数:33,代码来源:PCDimNaturalizerPlugin.cs

示例3: ToggleSolutionFoldersOpenTemporarily

        /// <summary>
        /// Toggles all solution folders open temporarily to workaround searches not working inside
        /// solution folders that have never been expanded.
        /// </summary>
        /// <param name="parentItem">The parent item to inspect.</param>
        private void ToggleSolutionFoldersOpenTemporarily(UIHierarchyItem parentItem)
        {
            if (parentItem == null)
            {
                throw new ArgumentNullException("parentItem");
            }

            const string solutionFolderGuid = "{66A26720-8FB5-11D2-AA7E-00C04F688DDE}";

            var project = parentItem.Object as Project;
            bool isCollapsedSolutionFolder = project != null && project.Kind == solutionFolderGuid && !parentItem.UIHierarchyItems.Expanded;

            // Expand the solution folder temporarily.
            if (isCollapsedSolutionFolder)
            {
                parentItem.Select(vsUISelectionType.vsUISelectionTypeSelect);
                Package.IDE.ToolWindows.SolutionExplorer.DoDefaultAction();
            }

            // Run recursively to children as well for nested solution folders.
            foreach (UIHierarchyItem childItem in parentItem.UIHierarchyItems)
            {
                ToggleSolutionFoldersOpenTemporarily(childItem);
            }

            // Collapse the solution folder.
            if (isCollapsedSolutionFolder)
            {
                parentItem.Select(vsUISelectionType.vsUISelectionTypeSelect);
                Package.IDE.ToolWindows.SolutionExplorer.DoDefaultAction();
            }
        }
开发者ID:Mediomondo,项目名称:codemaid,代码行数:37,代码来源:FindInSolutionExplorerCommand.cs

示例4: DisplayCommand

        /// <summary>
        /// Determines if the command should be displayed or not.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public override bool DisplayCommand(UIHierarchyItem item)
        {
            try
            {
                UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
                if (((System.Array)solExplorer.SelectedItems).Length != 1)
                    return false;

                UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0));
                Project p = hierItem.Object as Project;
                SolutionClass solution = hierItem.Object as SolutionClass;
                if (p != null)
                {
                    Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)p;
                    return (projExt.Kind == BIDSProjectKinds.SSRS);
                }
                else if (solution != null)
                {
                    foreach (Project pp in solution.Projects)
                    {
                        Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)p;
                        if (projExt.Kind == BIDSProjectKinds.SSRS)
                            return true;
                    }
                }
                return false;
            }
            catch
            {
                return false;
            }
        }
开发者ID:sgtgold,项目名称:bids-helper-extension,代码行数:37,代码来源:DeleteDatasetCachePlugin.cs

示例5: Collapse

        private static void Collapse(UIHierarchyItem item, ref UIHierarchy solutionExplorer)
        {
            foreach (UIHierarchyItem innerItem in item.UIHierarchyItems)
            {
                if (innerItem.UIHierarchyItems.Count > 0)
                {

                    // Re-cursive call
                    Collapse(innerItem, ref solutionExplorer);

                    // Collapse
                    if (innerItem.UIHierarchyItems.Expanded)
                    {
                        innerItem.UIHierarchyItems.Expanded = false;
                        if (innerItem.UIHierarchyItems.Expanded == true)
                        {
                            // Bug in VS 2005
                            innerItem.Select(vsUISelectionType.vsUISelectionTypeSelect);
                            solutionExplorer.DoDefaultAction();
                        }

                    }
                }

            }
        }
开发者ID:nostlie,项目名称:Sandbox,代码行数:26,代码来源:Helper.cs

示例6: DisplayCommand

        /// <summary>
        /// Determines if the command should be displayed or not.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public override bool DisplayCommand(UIHierarchyItem item)
        {
            try
            {
                UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
                if (((System.Array)solExplorer.SelectedItems).Length != 1)
                    return false;

                UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0));
                string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower();
                foreach (string extension in DTS_FILE_EXTENSIONS)
                {
                    if (sFileName.EndsWith(extension))
                        return true;
                }
                foreach (string extension in SSAS_FILE_EXTENSIONS)
                {
                    if (sFileName.EndsWith(extension))
                        return true;
                }
                foreach (string extension in SSRS_FILE_EXTENSIONS)
                {
                    if (sFileName.EndsWith(extension))
                        return true;
                }
                return false;
            }
            catch
            {
                return false;
            }
        }
开发者ID:japj,项目名称:bidshelper,代码行数:37,代码来源:SmartDiffPlugin.cs

示例7: Collapse

 private static void Collapse(UIHierarchyItem item) {
     foreach (UIHierarchyItem hierarchyItem in item.UIHierarchyItems) {
         if (hierarchyItem.UIHierarchyItems.Count > 0) {
             Collapse(hierarchyItem);
             if (hierarchyItem.UIHierarchyItems.Expanded)
                 hierarchyItem.UIHierarchyItems.Expanded = false;
         }
     }
 }
开发者ID:kamchung322,项目名称:eXpand,代码行数:9,代码来源:SolutionExtension.cs

示例8: HasExpandedChildren

        internal static bool HasExpandedChildren(UIHierarchyItem parentItem)
        {
            if (parentItem == null)
            {
                throw new ArgumentNullException("parentItem");
            }

            return parentItem.UIHierarchyItems.Cast<UIHierarchyItem>().Any(
                childItem => childItem.UIHierarchyItems.Expanded || HasExpandedChildren(childItem));
        }
开发者ID:hhahh2011,项目名称:CH.EasyCode,代码行数:10,代码来源:UIHierarchyHelper.cs

示例9: DisplayCommand

        public override bool DisplayCommand(UIHierarchyItem item)
        {
            UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
            if (((System.Array)solExplorer.SelectedItems).Length != 1) return false;

            UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0));

            string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower();
            return (sFileName.EndsWith(".dtsx"));
        }
开发者ID:japj,项目名称:bidshelper,代码行数:10,代码来源:DesignPracticesPlugin.cs

示例10: ExpandCollapseNodes

        private void ExpandCollapseNodes(UIHierarchyItem node, bool expanded, UIHierarchy tree)
        {
            foreach(UIHierarchyItem subNode in node.UIHierarchyItems)
              {
            ExpandCollapseNodes(subNode, expanded, tree);
              }

              if (node.Object is SolutionFolder)
              {
            node.UIHierarchyItems.Expanded = true;
              }
              else if (node.Object is Solution)
              {
            node.UIHierarchyItems.Expanded = true;
              }
              else if (node.Object is Project)
              {
            if (((Project)node.Object).Object is SolutionFolder)
            {
              //are there projects in the solution folder
              SolutionFolder f = ((Project)node.Object).Object as SolutionFolder;
              bool expandit = false;
              foreach (ProjectItem pi in f.Parent.ProjectItems)
              {
                if (pi.Object is Project)
                {
                  //solutionfolder contains a child project, dont close
                  expandit = true;
                }
              }
              node.UIHierarchyItems.Expanded = expandit;
            }
            else
            {
              node.UIHierarchyItems.Expanded = false;
            }
              }
              else
              {
            node.UIHierarchyItems.Expanded = false;
            //bug in VS
            //if still expanded
            if (node.UIHierarchyItems.Expanded == true)
            {
              node.Select(vsUISelectionType.vsUISelectionTypeSelect);
              tree.DoDefaultAction();
            }
              }
        }
开发者ID:sunday-out,项目名称:SharePoint-Software-Factory,代码行数:49,代码来源:SolutionExplorerExpandProjects.cs

示例11: DisplayCommand

        public override bool DisplayCommand(UIHierarchyItem item)
        {
            UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
            foreach (object selected in ((System.Array)solExplorer.SelectedItems))
            {
                UIHierarchyItem hierItem = (UIHierarchyItem)selected;
                ProjectItem projectItem = hierItem.Object as ProjectItem;
                if (projectItem == null || !projectItem.Name.ToLower().EndsWith(".biml")) 
                {
                    return false;
                }
            }

            return (((System.Array)solExplorer.SelectedItems).Length > 0);
        }
开发者ID:japj,项目名称:bidshelper,代码行数:15,代码来源:BimlCheckForErrorsPlugin.cs

示例12: DisplayCommand

        /// <summary>
        /// Determines if the command should be displayed or not.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public override bool DisplayCommand(UIHierarchyItem item)
        {
            try
            {
                UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
                if (((System.Array)solExplorer.SelectedItems).Length != 1)
                    return false;

                UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0));
                return (((ProjectItem)hierItem.Object).Object is Dimension);
            }
            catch
            {
                return false;
            }
        }
开发者ID:japj,项目名称:bidshelper,代码行数:21,代码来源:VisualizeAttributeLatticePlugin.cs

示例13: ShouldCollapseItem

        private static bool ShouldCollapseItem(UIHierarchyItem parentItem)
        {
            if (parentItem.Object is Solution)
            {
                return false;
            }

            if (parentItem.Object is Project)
            {
                var solution = parentItem.DTE.Solution;
                if (solution != null && solution.Projects.Count <= 2)
                {
                    return false;
                }
            }

            return true;
        }
开发者ID:hhahh2011,项目名称:CH.EasyCode,代码行数:18,代码来源:UIHierarchyHelper.cs

示例14: DisplayCommand

 /// <summary>
 /// Determines if the command should be displayed or not.
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public override bool DisplayCommand(UIHierarchyItem item)
 {
     try
     {
         bool bFoundRightItem = false;
         UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
         foreach (UIHierarchyItem hierItem in ((System.Array)solExplorer.SelectedItems))
         {
             if (hierItem.Name.ToLower().EndsWith(".cube")) //checking the file extension is adequate because this feature is not needed for in online mode (when live connected to the server)
                 bFoundRightItem = true;
             else
                 return false;
         }
         return bFoundRightItem;
     }
     catch
     {
         return false;
     }
 }
开发者ID:japj,项目名称:bidshelper,代码行数:25,代码来源:DeployMDXScriptPlugin.cs

示例15: DisplayCommand

        public override bool DisplayCommand(UIHierarchyItem item)
        {
            UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
            if (((System.Array)solExplorer.SelectedItems).Length == 1)
            {
                UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0));
                Project project = hierItem.Object as Project;
                ProjectItem projectItem = hierItem.Object as ProjectItem;
                if (project != null)
                {
                    return (project.Kind == BIDSProjectKinds.SSIS);
                }
                else if (projectItem != null)
                {
                    return projectItem.ContainingProject.Kind == BIDSProjectKinds.SSIS;
                }
            }

            return false;
        }
开发者ID:sgtgold,项目名称:bids-helper-extension,代码行数:20,代码来源:BimlAddNewFilePlugin.cs


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