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


C# IVsHierarchy.GetProject方法代码示例

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


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

示例1: OnAfterOpenProject

 public int OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded)
 {
     var project = pHierarchy.GetProject().GetPythonProject();
     if (project != null) {
         if (_pyProjectCount++ == 0) {
             IronPythonToolsPackage.Instance.Analyzer.ImplicitProject = false;
         }
     }
     return VSConstants.S_OK;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:10,代码来源:SolutionAdvisor.cs

示例2: OnBeforeCloseProject

 public int OnBeforeCloseProject(IVsHierarchy pHierarchy, int fRemoved)
 {
     var project = pHierarchy.GetProject().GetPythonProject();
     if (project != null) {
         if (--_pyProjectCount == 0) {
             IronPythonToolsPackage.Instance.Analyzer.ImplicitProject = true;
         }
     }
     return VSConstants.S_OK;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:10,代码来源:SolutionAdvisor.cs

示例3: OnAfterOpenProject

        public override int OnAfterOpenProject(IVsHierarchy hierarchy, int added) {
            // If this is our project, notify it that it has been opened.
            if (hierarchy.GetProject() != null) {
                var oaProject = hierarchy.GetProject() as OAProject;
                if (oaProject != null && oaProject.Project is ProjectNode) {
                    ((ProjectNode)oaProject.Project).OnAfterProjectOpen();
                }
            }

            // If this is a new project and our project. We use here that it is only our project that will implemnet the "internal"  IBuildDependencyOnProjectContainer.
            if (added != 0 && hierarchy is IBuildDependencyUpdate) {
                IVsUIHierarchy uiHierarchy = hierarchy as IVsUIHierarchy;
                Debug.Assert(uiHierarchy != null, "The ProjectNode should implement IVsUIHierarchy");
                if (uiHierarchy == null) {
                    return VSConstants.E_FAIL;
                }
                // Expand and select project node
                IVsUIHierarchyWindow uiWindow = UIHierarchyUtilities.GetUIHierarchyWindow(this.ServiceProvider, HierarchyNode.SolutionExplorer);
                if (uiWindow != null) {
                    __VSHIERARCHYITEMSTATE state;
                    uint stateAsInt;
                    if (uiWindow.GetItemState(uiHierarchy, VSConstants.VSITEMID_ROOT, (uint)__VSHIERARCHYITEMSTATE.HIS_Expanded, out stateAsInt) == VSConstants.S_OK) {
                        state = (__VSHIERARCHYITEMSTATE)stateAsInt;
                        if (state != __VSHIERARCHYITEMSTATE.HIS_Expanded) {
                            int hr;
                            hr = uiWindow.ExpandItem(uiHierarchy, VSConstants.VSITEMID_ROOT, EXPANDFLAGS.EXPF_ExpandParentsToShowItem);
                            if (ErrorHandler.Failed(hr))
                                Trace.WriteLine("Failed to expand project node");
                            hr = uiWindow.ExpandItem(uiHierarchy, VSConstants.VSITEMID_ROOT, EXPANDFLAGS.EXPF_SelectItem);
                            if (ErrorHandler.Failed(hr))
                                Trace.WriteLine("Failed to select project node");

                            return hr;
                        }
                    }
                }
            }
            return VSConstants.S_OK;
        }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:39,代码来源:SolutionListenerForProjectOpen.cs


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