I wrote an addendum that takes the active document as a parameter. Therefore, every time an active document changes, I need to know. For this, I wanted to use the event "Events.DocumentEvents.DocumentOpened" of the DTE2 object. But the problem is that the event never fires, although I am changing the active document.
Below is a snippet of code
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _applicationObject = (DTE2)application; _applicationObject.Events.DocumentEvents.DocumentOpened += new _dispDocumentEvents_DocumentOpenedEventHandler(DocumentEvents_DocumentOpened); ... } void DocumentEvents_DocumentOpened(Document Document) { MessageBox.Show("Not called"); }
I also tried with DocumentEvents, but did not succeed. Any ideas?
source share