private void HookTextManagerEvents() { IVsTextManager4 textManager = VsAppShell.Current.GetGlobalService<IVsTextManager4>(typeof(SVsTextManager)); Debug.Assert(textManager != null); if (textManager != null) { // Hook into the "preferences changed" event so that I can update _langPrefs as needed _textManagerEventsCookie = new ConnectionPointCookie(textManager, this, typeof(IVsTextManagerEvents4)); } }
protected virtual void Dispose(bool disposing) { if (disposing) { if (_textManagerEventsCookie != null) { _textManagerEventsCookie.Dispose(); _textManagerEventsCookie = null; } } }