如何订阅 Visual Studio 2010 包开发中的适当事件?
我最近开始使用 Visual Studio 2010 SDK 进行 Visual Studio 2010 包开发。我已经设置好了调试环境,一切都正常工作。
但是,我的附加组件几乎需要知道何时有人打开项目 - 否则它不会刷新其数据,具体取决于打开的项目。
此外,如果能够看到用户何时将文档切换到其他内容或更改文档中的某些内容,那就太棒了。然而,第一件事(检测某人何时打开项目)是最重要的。
我有什么办法可以做到这一点吗? Visual Studio 中是否有事件允许我执行此操作?如果是这样,它们叫什么?我该如何利用它们?
I recently got into Visual Studio 2010 package development, with the Visual Studio 2010 SDK. I've got my debugging environment all set up, and everything is working as it should.
However, my add-on pretty much needs to know when somebody opens a project - or else it will not refresh its data, depending on which project is open.
Furthermore, it would be awesome to see when the user switches document to something else, or changes something in the document. However, the first thing (detect when somebody opens a project) is the most important.
Is there any way I can do this? Are there events in Visual Studio that will allow me to do this? If so, what are these called, and how do I utilize them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
宏模型和加载项模型都使用相同的界面,因此您可以使用宏示例来获取想法。使用工具->宏->宏 IDE ->样品-> EnvironmentEvents 查看 Visual Studio 扩展模型支持的所有事件。具体请查看
EnvDTE.DocumentEvents
和EnvDTE.ProjectsEvents
。The macro model and the add-in model both use the same interface so you can use the macro sample to get ideas. Use Tools -> Macro -> Macros IDE -> Samples -> EnvironmentEvents to see all the events the Visual Studio extension model supports. Specifically look at
EnvDTE.DocumentEvents
andEnvDTE.ProjectsEvents
.