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
Post a Comment