public void UserPrefrencesChangedNotUpdateColorsForNotTextEditorCategory() { try { var textManagerEvents = new TextManagerEvents(); var fontResource = new FONTCOLORPREFERENCES { pguidFontCategory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Guid))), pguidColorService = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Guid))), pColorTable = Marshal.AllocHGlobal(1) }; Marshal.StructureToPtr(DefGuidList.guidPrinterFontCategory, fontResource.pguidFontCategory, true); Marshal.StructureToPtr(Guid.NewGuid(), fontResource.pguidColorService, true); var fontResources = new[] { fontResource }; var mockStore = new Mock <IVsFontAndColorStorage>(); FontAndColorStorage.Override = mockStore.Object; textManagerEvents.OnUserPreferencesChanged(null, null, null, fontResources); const uint flags = (uint)( __FCSTORAGEFLAGS.FCSF_LOADDEFAULTS | __FCSTORAGEFLAGS.FCSF_NOAUTOCOLORS | __FCSTORAGEFLAGS.FCSF_PROPAGATECHANGES); var textEditorGuid = DefGuidList.guidTextEditorFontCategory; mockStore.Verify(s => s.OpenCategory(ref textEditorGuid, flags), Times.Never()); } finally { FontAndColorStorage.Override = null; } }
public nHydrateDiagram(Microsoft.VisualStudio.Modeling.Partition partition, params Microsoft.VisualStudio.Modeling.PropertyAssignment[] propertyAssignments) : base(partition, propertyAssignments) { this.Store.UndoManager.AddCanUndoRedoCallback(CanUndoRedoCallback); this.Store.TransactionManager.AddCanCommitCallback(CanCommitCallback); //Custom code so need to override the constructor this.ShowGrid = false; this.DisplayType = true; this.IsLoading = true; this.DiagramAdded += new EventHandler <Microsoft.VisualStudio.Modeling.ElementAddedEventArgs>(nHydrateDiagram_DiagramAdded); TextManagerEvents.RegisterForTextManagerEvents(); }
public static void Start() { var textManager = ServiceProvider.GlobalProvider.GetService(typeof(SVsTextManager)) as IVsTextManager; var container = (IConnectionPointContainer)textManager; IConnectionPoint textManagerEventsConnection = null; var eventGuid = typeof(IVsTextManagerEvents).GUID; if (container != null) { container.FindConnectionPoint(ref eventGuid, out textManagerEventsConnection); } var textManagerEvents = new TextManagerEvents(); uint textManagerCookie; if (textManagerEventsConnection != null) { textManagerEventsConnection.Advise(textManagerEvents, out textManagerCookie); } }
public TextEditorFontProperties(SVsServiceProvider serviceProvider) { _serviceProvider = serviceProvider; _dte = (_DTE)_serviceProvider.GetService(typeof(_DTE)); _textManagerEvents = null; }