本文整理汇总了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;
}
示例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;
}
示例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;
}