简体   繁体   中英

How do I subscribe to the proper events in Visual Studio 2010 package development?

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?

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 and EnvDTE.ProjectsEvents .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM