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]); }
public void Save() { try { Directory.CreateDirectory(GetDirectory()); SaveToFile(GetPath()); } catch (Exception e) { VSAsmPackage.ShowError("VSAsm save settings", "Failed to save the extension settings to storage: " + e.Message); } }
public VSAsmPackage() { if (Instance != null) { ShowError("VSAsmPackage", "There are two instances of the package loaded."); } else { Instance = this; } }
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); }