Esempio n. 1
0
            protected override void Initialize()
            {
                base.Initialize();

                IServiceContainer serviceContainer = this as IServiceContainer;
                AphidLanguageService langService = new AphidLanguageService();
                langService.SetSite(this);
                serviceContainer.AddService(typeof(AphidLanguageService), langService, true);
                IOleComponentManager manager = GetService(typeof(SOleComponentManager)) as IOleComponentManager;

                if (_componentID == 0 && manager != 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 = 500;
                    int hr = manager.FRegisterComponent(this, crinfo, out _componentID);
                }
            }
Esempio n. 2
0
            protected override void Initialize()
            {
                base.Initialize();

                var serviceContainer = this as IServiceContainer;
                var langService      = new AphidLanguageService();

                langService.SetSite(this);
                serviceContainer.AddService(typeof(AphidLanguageService), langService, true);
                var manager = GetService(typeof(SOleComponentManager)) as IOleComponentManager;

                if (_componentID == 0 && manager != null)
                {
                    var 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 = 500;
                    var hr = manager.FRegisterComponent(this, crinfo, out _componentID);
                }
            }