/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); if (!SetupMode) { // Ensure our settings are loaded GetDialogPage(typeof(SnippetPreviewWindowSettings)); // Create the preview window myPreviewWindow = new SnippetPreviewWindow(this); // Enable idle handling IOleComponentManager componentManager; if (myComponentId == 0 && null != (componentManager = (IOleComponentManager)GetService(typeof(SOleComponentManager)))) { OLECRINFO[] pcrinfo = new OLECRINFO[1]; pcrinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO)); pcrinfo[0].grfcrf = (uint)(_OLECRF.olecrfNeedIdleTime | _OLECRF.olecrfNeedPeriodicIdleTime); pcrinfo[0].grfcadvf = (uint)(_OLECADVF.olecadvfModal | _OLECADVF.olecadvfRedrawOff); // Not sure why here, just following the Xml Editor Package pcrinfo[0].uIdleTimeInterval = 1000; componentManager.FRegisterComponent(this, pcrinfo, out myComponentId); } } }