c# - ProjectItemsEvents.ItemAdded: how can I discover the item type? -


i'm beginning develop vspackage , know when new reference added project subscribing itemadded of projectitemsevents gives me projectitem object , don't know how check if reference. can me solve problem? in advance.

fortunately found class vslangproj.referencesevents fire referenceadded event need. so, i've done:

private static referencesevents _refevents; private static events2 _dteevents; public void subscribeevents() {  envdte.dte dte = (envdte.dte)serviceprovider.getservice(typeof(envdte.dte));  _dteevents = dte.events events2;  _refevents = (referencesevents)_dteevents.getobject("csharpreferencesevents");  _refevents.referenceadded += new _dispreferencesevents_referenceaddedeventhandler(referenceadded); }  private void referenceadded(reference preference) {   // stuff. } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -