• [VS Macro]CollaposeAll Projects in Solution


    From Here

    As Title .

    ---------------------------------Copy Start----------------------------------------------------

    Imports System
    Imports EnvDTE
    Imports System.Diagnostics

    Public Module CollapseAll
        Sub CollapseAll()
            ' Get the the Solution Explorer tree
            Dim UIHSolutionExplorer As UIHierarchy
            UIHSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
            ' Check if there is any open solution
            If (UIHSolutionExplorer.UIHierarchyItems.Count = 0) Then
                ' MsgBox("Nothing to collapse. You must have an open solution.")
                Return
            End If
            ' Get the top node (the name of the solution)
            Dim UIHSolutionRootNode As UIHierarchyItem
            UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)
            UIHSolutionExplorer = Nothing
            UIHSolutionRootNode.DTE.SuppressUI = True
            ' Collapse each project node
            Dim UIHItem As UIHierarchyItem
            For Each UIHItem In UIHSolutionRootNode.UIHierarchyItems
                'UIHItem.UIHierarchyItems.Expanded = False
                If UIHItem.UIHierarchyItems.Expanded Then
                    Collapse(UIHItem)
                End If
            Next
            ' Select the solution node, or else when you click
            ' on the solution window
            ' scrollbar, it will synchronize the open document
            ' with the tree and pop
            ' out the corresponding node which is probably not what you want.
            UIHSolutionRootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)
            UIHSolutionRootNode.DTE.SuppressUI = False
            UIHSolutionRootNode = Nothing
        End Sub

        Private Sub Collapse(ByVal item As UIHierarchyItem)
            For Each eitem As UIHierarchyItem In item.UIHierarchyItems
                If eitem.UIHierarchyItems.Expanded AndAlso eitem.UIHierarchyItems.Count > 0 Then
                    Collapse(eitem)
                End If
            Next
            item.UIHierarchyItems.Expanded = False
        End Sub
    End Module 

    ---------------------------------Copy End---------------------------------------------------- 

  • 相关阅读:
    moya
    语言是人脑中影像的表述工具
    Ad-hoc--拉丁文--for this purpose only
    语言是人类对自我意识的表述工具:对世界和事物多深刻的认识,就会有多丰富和符合 逻辑的语言表述
    知行合一:知其然知其所以然
    语言是世界观、方法论的重组和表述
    任何能用编程语言描述的东西都能够用人类语言描述
    面向对象的几个视角
    待解决问题 jscore 与 node.js jsbridge
    浅谈CSRF攻击方式
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1736946.html
Copyright © 2020-2023  润新知