public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom) { if (_listener == null) return; _listener.BeforeSave -= DocumentListener_BeforeSave; _listener.Dispose(); _listener = null; }
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _applicationObject = (DTE2)application; _addInInstance = (AddIn)addInInst; IServiceProvider serviceProvider = new ServiceProvider(_applicationObject as VSInterop.IServiceProvider); _listener = new DocumentListener(serviceProvider); _listener.BeforeSave += DocumentListener_BeforeSave; _listener.Start(); }