public int FDoIdle(uint grfidlef) { IronyLanguageService ls = GetService(typeof(IronyLanguageService)) as IronyLanguageService; if (ls != null) { ls.OnIdle((grfidlef & (uint)_OLEIDLEF.oleidlefPeriodic) != 0); } return(0); }
public IronyPackage() { ServiceCreatorCallback callback = new ServiceCreatorCallback( delegate(IServiceContainer container, Type serviceType) { if (typeof(IronyLanguageService) == serviceType) { IronyLanguageService language = new IronyLanguageService(); language.SetSite(this); // register for idle time callbacks IOleComponentManager mgr = GetService(typeof(SOleComponentManager)) as IOleComponentManager; if (componentID == 0 && mgr != null) { OLECRINFO[] crinfo = new OLECRINFO[1]; crinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO)); crinfo[0].grfcrf = (uint)_OLECRF.olecrfNeedIdleTime | (uint)_OLECRF.olecrfNeedPeriodicIdleTime; crinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal | (uint)_OLECADVF.olecadvfRedrawOff | (uint)_OLECADVF.olecadvfWarningsOff; crinfo[0].uIdleTimeInterval = 1000; int hr = mgr.FRegisterComponent(this, crinfo, out componentID); } return(language); } else { return(null); } }); // proffer the LanguageService (this as IServiceContainer).AddService(typeof(IronyLanguageService), callback, true); }