Beispiel #1
0
        FontInfo?GetTextEditorFontInfo()
        {
            IVsFontAndColorStorage fontStorage = (IVsFontAndColorStorage)VSAsmPackage.GetGlobalService(typeof(SVsFontAndColorStorage));

            if (fontStorage == null)
            {
                return(null);
            }

            if (fontStorage.OpenCategory(TextEditorFontGuid, (uint)(__FCSTORAGEFLAGS.FCSF_LOADDEFAULTS)) != VSConstants.S_OK)
            {
                return(null);
            }

            FontInfo[] info   = new FontInfo[1];
            int        result = fontStorage.GetFont(null, info);

            fontStorage.CloseCategory();

            if (result != VSConstants.S_OK)
            {
                return(null);
            }

            return(info[0]);
        }
Beispiel #2
0
        void RegisterForTextManagerEvents()
        {
            IConnectionPointContainer container = (IConnectionPointContainer)VSAsmPackage.GetGlobalService(typeof(SVsTextManager));

            if (container == null)
            {
                return;
            }

            Guid eventsGuid = typeof(IVsTextManagerEvents).GUID;

            container.FindConnectionPoint(ref eventsGuid, out IConnectionPoint textManagerEventsConnection);

            TextManagerEventHandler handler = new TextManagerEventHandler()
            {
                View = this
            };

            textManagerEventsConnection.Advise(handler, out uint textManagerCookie);
        }