文章来源:
http://www.visualstudioextensibility.com/2014/08/25/forcing-command-ui-refresh/
----AddIn的用法
As you know, whether you are an add-in developer or a package developer, Visual Studio calls your package or add-in to query the status of your commands when it requires to know it, for example, before showing the menu items of a menu, when the selected object has changed, etc. However, in rare occasions you may need to tell Visual Studio that you want it to query the status of your commands. A user of the MSDN VSX forum has asked it today, for example.
I was somewhat familiar with the solution for add-ins, which is to use the UpdateCommandUI method of the EnvDTE80.Commands2 interface (notice that the EnvDTE.Commands interface lacks that method, so you need to cast DTE.Commands to EnvDTE80.Commands2). Reviewing the code of my MZ-Tools add-in, certainly I needed to use it for a integration test.
----VSPackage的用法
I was also somewhat familiar with the solution for packages because I found the UpdateCommandUI method of the IVsUIShell by chance some time ago just perusing the MSDN documentation.

本文介绍了在特定情况下如何强制Visual Studio重新查询Add-In或VSPackage中命令的状态。对于Add-In,可以通过EnvDTE80.Commands2接口的UpdateCommandUI方法实现;而对于VSPackage,则可以通过IVsUIShell接口的同名方法来达到相同目的。

被折叠的 条评论
为什么被折叠?



