• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UIHierarchyItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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));
                // this figures out if this is the dimensions node without using the name
                // by checking the type of the first child item. 
                return (hierItem.UIHierarchyItems.Count >= 1 
                    && ((ProjectItem)hierItem.UIHierarchyItems.Item(1).Object).Object is Dimension);
                //return (hierItem.Name == "Dimensions" && ((ProjectItem)hierItem.Object).Object == null);
            }
            catch
            {
                return false;
            }
        }
开发者ID:japj,项目名称:bidshelper,代码行数:25,代码来源:DataTypeDiscrepancyCheckPlugin.cs


示例17: 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 proj = hierItem.Object as Project;
         Project proj = this.GetSelectedProjectReference();
         SolutionClass solution = hierItem.Object as SolutionClass;
         if (proj != null)
         {
             return (proj.Kind == BIDSProjectKinds.SSIS && IsLegacyDeploymentMode(proj));
         }
         else if (solution != null)
         {
             foreach (Project p in solution.Projects)
             {
                 if (p.Kind != BIDSProjectKinds.SSIS || !IsLegacyDeploymentMode(proj)) return false;
             }
             return (solution.Projects.Count > 0);
         }
         else
         {
             proj = ((ProjectItem)hierItem.Object).ContainingProject;
             string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower();
             return (sFileName.EndsWith(".dtsx") && IsLegacyDeploymentMode(proj));
         }
     }
     else
     {
         foreach (object selected in ((System.Array)solExplorer.SelectedItems))
         {
             UIHierarchyItem hierItem = (UIHierarchyItem)selected;
             Project proj = ((ProjectItem)hierItem.Object).ContainingProject;
             string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower();
             if (!sFileName.EndsWith(".dtsx") || !IsLegacyDeploymentMode(proj)) return false;
         }
         return (((System.Array)solExplorer.SelectedItems).Length > 0);
     }
 }
开发者ID:japj,项目名称:bidshelper,代码行数:40,代码来源:DeployPackagesPlugin.cs


示例18: DisplayCommand

        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));
                if (!(hierItem.Object is ProjectItem)) return false;
                string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower();
                if (sFileName.EndsWith(".bim"))
                {
                    currentDB = (Database) (((Project) hierItem.Object).Object);
                    return true;
                }
            }
            catch
            {
            }
            return false;
        }
开发者ID:japj,项目名称:bidshelper,代码行数:22,代码来源:PowerShellWindowPlugin.cs


示例19: CollapseFolder

 internal static void CollapseFolder(VSProject2 hsa2, VSProject2 asa2, UIHierarchyItem folder)
 {
     foreach (UIHierarchyItem project in folder.UIHierarchyItems)
     {
         foreach (UIHierarchyItem projectItem in project.UIHierarchyItems)
         {
             if (projectItem.Name.Equals("References"))
             {
                 projectItem.UIHierarchyItems.Expanded = false;
             }
             else if (projectItem.Name.Equals("Generated Files") && (project.Name.Equals(hsa2.Project.Name) || project.Name.Equals(asa2.Project.Name)))
             {
                 projectItem.UIHierarchyItems.Expanded = false;
             }
             CollapseFolder(hsa2, asa2, projectItem);
         }
         if (project.Name.Equals(hsa2.Project.Name) || project.Name.Equals(asa2.Project.Name))
         {
             project.UIHierarchyItems.Expanded = false;
         }
     }
 }
开发者ID:PervasiveDigital,项目名称:PipelineBuilder,代码行数:22,代码来源:ProjectHelpers.cs


示例20: 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 == 0)
                    return false;

                foreach (object selectedItem in ((System.Array)solExplorer.SelectedItems))
                {
                    UIHierarchyItem hierItem = ((UIHierarchyItem)selectedItem);
                    if (!(((ProjectItem)hierItem.Object).Object is Dimension))
                    {
                        return false;
                    }
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
开发者ID:japj,项目名称:bidshelper,代码行数:28,代码来源:SyncDescriptionsPlugin.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UIImage类代码示例发布时间:2022-05-24
下一篇:
C# UIGrid类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap