我正在尝试制作一个扩展程序,需要从代码中调用两个命令:
- SolutionExplorer.SyncWithActiveDocument(将解决方案资源管理器与当前活动文档同步)
- The Collapse All command in the Solution Explorer.(在解决方案资源管理器中折叠所有内容)
我找不到任何方法来调用这些功能。
请问有人知道如何实现吗?
我正在尝试制作一个扩展程序,需要从代码中调用两个命令:
我找不到任何方法来调用这些功能。
请问有人知道如何实现吗?
dte.Windows.Item(EnvDTE.Constants.vsWindowKindSolutionExplorer).Activate();
// Sync with Active Document
dte.ExecuteCommand("SolutionExplorer.SyncWithActiveDocument");
// Collapse All
int cmdidSolutionExplorerCollapseAll = 29;
Guid guidCMDSETID_StandardCommandSet11 = new Guid("D63DB1F0-404E-4B21-9648-CA8D99245EC3");
dte.Commands.Raise(guidCMDSETID_StandardCommandSet11.ToString("B"), cmdidSolutionExplorerCollapseAll, null, null);
如果您需要识别其他命令的ID,可以打开VSIP日志记录:
http://blogs.msdn.com/b/dr._ex/archive/2007/04/17/using-enablevsiplogging-to-identify-menus-and-commands-with-vs-2005-sp1.aspx