• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# OLECRINFO类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中OLECRINFO的典型用法代码示例。如果您正苦于以下问题:C# OLECRINFO类的具体用法?C# OLECRINFO怎么用?C# OLECRINFO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OLECRINFO类属于命名空间,在下文中一共展示了OLECRINFO类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: IdleTimeSource

        public IdleTimeSource() {
            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 = 200;

            var oleComponentManager = RPackage.GetGlobalService(typeof(SOleComponentManager)) as IOleComponentManager;
            oleComponentManager.FRegisterComponent(this, crinfo, out _componentID);
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:10,代码来源:IdleTimeSource.cs


示例2: FRegisterComponent

 public int FRegisterComponent(IOleComponent piComponent, OLECRINFO[] pcrinfo, out uint pdwComponentID) {
     var flags = (_OLECRF)pcrinfo[0].grfcrf;
     if (flags.HasFlag(_OLECRF.olecrfNeedIdleTime)) {
         _idleComponents[++_idleCount] = piComponent;
         pdwComponentID = _idleCount;
     } else {
         throw new NotImplementedException();
     }
     return VSConstants.S_OK;
 }
开发者ID:RussBaz,项目名称:PTVS,代码行数:10,代码来源:MockOleComponentManager.cs


示例3: AppEventsSource

        public AppEventsSource() {
            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 = 200;

            IOleComponentManager oleComponentManager = VsAppShell.Current.GetGlobalService<IOleComponentManager>(typeof(SOleComponentManager));
            int hr = oleComponentManager.FRegisterComponent(this, crinfo, out _componentID);
            Debug.Assert(ErrorHandler.Succeeded(hr));
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:11,代码来源:AppEventsSource.cs


示例4: RegisterForIdleTimeCallbacks

        public void RegisterForIdleTimeCallbacks(IOleComponentManager cmService)
        {
            _cmService = cmService;

            if (_cmService != null)
            {
                OLECRINFO[] pcrinfo = new OLECRINFO[1];
                pcrinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO));
                pcrinfo[0].grfcrf = (uint)_OLECRF.olecrfNeedIdleTime |
                                              (uint)_OLECRF.olecrfNeedPeriodicIdleTime;
                pcrinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal |
                                              (uint)_OLECADVF.olecadvfRedrawOff |
                                              (uint)_OLECADVF.olecadvfWarningsOff;
                pcrinfo[0].uIdleTimeInterval = 100;

                _cmService.FRegisterComponent(this, pcrinfo, out _wComponentID);
            }
        }
开发者ID:Rwing,项目名称:git-tools,代码行数:18,代码来源:SccOnIdleEvent.cs


示例5: EnsureInit

 private void EnsureInit() {
     if (_compId == VSConstants.VSCOOKIE_NIL) {
         lock (this) {
             if (_compId == VSConstants.VSCOOKIE_NIL) {
                 if (_compMgr == null) {
                     _compMgr = (IOleComponentManager)_serviceProvider.GetService(typeof(SOleComponentManager));
                     OLECRINFO[] crInfo = new OLECRINFO[1];
                     crInfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO));
                     crInfo[0].grfcrf = (uint)_OLECRF.olecrfNeedIdleTime;
                     crInfo[0].grfcadvf = (uint)0;
                     crInfo[0].uIdleTimeInterval = 0;
                     if (ErrorHandler.Failed(_compMgr.FRegisterComponent(this, crInfo, out _compId))) {
                         _compId = VSConstants.VSCOOKIE_NIL;
                     }
                 }
             }
         }
     }
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:19,代码来源:IdleManager.cs


示例6: Initialize

 protected override void Initialize() {
     base.Initialize();
     this.RegisterProjectFactory(CreateProjectFactory());
     var editFactory = CreateEditorFactory();
     if (editFactory != null) {
         this.RegisterEditorFactory(editFactory);
     }
     var encodingEditorFactory = CreateEditorFactoryPromptForEncoding();
     if (encodingEditorFactory != null) {
         RegisterEditorFactory(encodingEditorFactory);
     }
     var componentManager = _compMgr = (IOleComponentManager)GetService(typeof(SOleComponentManager));
     OLECRINFO[] crinfo = new OLECRINFO[1];
     crinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO));
     crinfo[0].grfcrf = (uint)_OLECRF.olecrfNeedIdleTime;
     crinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal | (uint)_OLECADVF.olecadvfRedrawOff | (uint)_OLECADVF.olecadvfWarningsOff;
     crinfo[0].uIdleTimeInterval = 0;
     ErrorHandler.ThrowOnFailure(componentManager.FRegisterComponent(this, crinfo, out _componentID));
 }
开发者ID:whuthj,项目名称:VisualRust,代码行数:19,代码来源:CommonProjectPackage.cs


示例7: Initialize

    /// 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 initilaization code that rely on services provided by VisualStudio.
    protected override void Initialize() {
      base.Initialize();
      // Proffer the service.
      var serviceContainer = this as IServiceContainer;
      var langService = new XSharpLanguageService();
      langService.SetSite(this);
      serviceContainer.AddService(typeof(XSharpLanguageService), langService, true);

      // Register a timer to call our language service during idle periods.
      var xMgr = GetService(typeof(SOleComponentManager)) as IOleComponentManager;
      if (mComponentID == 0 && xMgr != 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;
        xMgr.FRegisterComponent(this, crinfo, out mComponentID);
      }
    }
开发者ID:iSalva,项目名称:Cosmos,代码行数:21,代码来源:Package.cs


示例8: Initialize

            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);
                }
            }
开发者ID:John-Leitch,项目名称:Blue-Racer-CPU,代码行数:22,代码来源:AphidPackage.cs


示例9: BabelPackage

        protected BabelPackage()
        {
            ServiceCreatorCallback callback = new ServiceCreatorCallback(
                delegate(IServiceContainer container, Type serviceType)
                {
                    if (typeof(BlenXLanguageService) == serviceType)
                    {
                        BlenXLanguageService language = new BlenXLanguageService(this);
                        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(BlenXLanguageService), callback, true);
        }
开发者ID:ldematte,项目名称:BlenXVSP,代码行数:36,代码来源:BlenXPackage.cs


示例10: Initialize

        protected override void Initialize()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            IServiceContainer sc = (IServiceContainer)this;

            // Register Language
            languageService = new NeoLuaLanguageService();
            languageService.SetSite(this);
            sc.AddService(typeof(NeoLuaLanguageService), languageService, true);

            // Register timer for the language
            IOleComponentManager mgr = this.GetService(typeof(SOleComponentManager)) as IOleComponentManager;
            if (mgr != null && languageTimerComponent == 0)
            {
                OLECRINFO[] crinfo = new OLECRINFO[1];
                crinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO));
                crinfo[0].grfcrf = (uint)(_OLECRF.olecrfNeedIdleTime | _OLECRF.olecrfNeedPeriodicIdleTime);
                crinfo[0].grfcadvf = (uint)(_OLECADVF.olecadvfModal | _OLECADVF.olecadvfRedrawOff | _OLECADVF.olecadvfWarningsOff);
                crinfo[0].uIdleTimeInterval = 1000;
                Marshal.ThrowExceptionForHR(mgr.FRegisterComponent(this, crinfo, out languageTimerComponent));
            }
        }
开发者ID:strogo,项目名称:neoluavs,代码行数:24,代码来源:NeoLuaVSPackage.cs


示例11: Initialize

        protected override void Initialize()
        {
            //Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();
            nspackage = this;

            #if ivslang
            LangInfo = new VSNLanguageInfo();
            ((IServiceContainer)this).AddService(typeof(VSNLanguageInfo), LangInfo, true);
            #endif

            menucmds = new Dictionary<int, string>() {
                { 0x0100, "NSMenuCmdOptionsEdit"},
                { 0x0101, "NSMenuCmdOptionsLoad"}
            };

            // menu commands - .vsct file
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if (mcs != null) {
                foreach (int dkey in menucmds.Keys) {
                    CommandID cmdid = new CommandID(GuidList.NSMenuCmdTopGUID, dkey);
                    MenuCommand menucmd = new MenuCommand(MenuItemCallback, cmdid);
                    mcs.AddCommand(menucmd);
                }
            }

            IServiceContainer ServiceCnt = this as IServiceContainer;
            NSLangServ ServiceLng = new NSLangServ();
            ServiceLng.SetSite(this);
            ServiceCnt.AddService(typeof(NSLangServ), ServiceLng, true);

            IOleComponentManager mgr = GetService(typeof(SOleComponentManager)) as IOleComponentManager;
            if (m_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 m_ComponentID);
            }

            nimsettingsini = System.IO.Path.Combine(UserDataPath, "nimstudio.ini");
            NSIni.Init(nimsettingsini);
            NSSugInit();

            if (NSIni.Get("Main", "exttoolsadded") != "true") {
                NSIni.Add("Main", "exttoolsadded", "true");
                NSIni.Write();
                string reg_keyname = "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\12.0\\External Tools";
                object reg_ret;
                bool regstateok=false;
                reg_ret = Registry.GetValue(reg_keyname, "ToolNumKeys", -1);
                while (true) {
                    if (reg_ret==null) break;
                    if (reg_ret.GetType()!=typeof(int)) break;
                    int totkeys = (int)reg_ret;
                    if (totkeys==-1) break;
                    for (int rloop = 0; rloop < totkeys; rloop++) {
                        reg_ret = Registry.GetValue(reg_keyname, "ToolTitle" + rloop.ToString(), null);
                        if (reg_ret==null) break;
                        if (reg_ret.GetType()!=typeof(string)) break;
                        if (reg_ret=="NimStudio Compile+Run") break;
                        if (rloop==totkeys-1) regstateok=true;
                    }
                    if (regstateok) {
                        Registry.SetValue(reg_keyname, "ToolTitle" + totkeys.ToString(), "NimStudio Compile+Run", RegistryValueKind.String);
                        Registry.SetValue(reg_keyname, "ToolSourceKey" + totkeys.ToString(), "", RegistryValueKind.String);
                        Registry.SetValue(reg_keyname, "ToolOpt" + totkeys.ToString(), 26, RegistryValueKind.DWord);
                        Registry.SetValue(reg_keyname, "ToolDir" + totkeys.ToString(), "$(ItemDir)", RegistryValueKind.String);
                        Registry.SetValue(reg_keyname, "ToolCmd" + totkeys.ToString(), "cmd.exe", RegistryValueKind.String);
                        Registry.SetValue(reg_keyname, "ToolArg" + totkeys.ToString(), @"/c """"c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"" & del $(ItemDir)$(ItemFileName).exe 2>nul & ""c:\Nim\bin\nim.exe"" c $(ItemPath) & echo ****Running**** & $(ItemDir)$(ItemFileName).exe""", RegistryValueKind.String);
                        totkeys++;
                        Registry.SetValue(reg_keyname, "ToolTitle" + totkeys.ToString(), "NimStudio Compile", RegistryValueKind.String);
                        Registry.SetValue(reg_keyname, "ToolSourceKey" + totkeys.ToString(), "", RegistryValueKind.String);
                        Registry.SetValue(reg_keyname, "ToolOpt" + totkeys.ToString(), 26, RegistryValueKind.DWord);
                        Registry.SetValue(reg_keyname, "ToolDir" + totkeys.ToString(), "$(ItemDir)", RegistryValueKind.String);
                        Registry.SetValue(reg_keyname, "ToolCmd" + totkeys.ToString(), "cmd.exe", RegistryValueKind.String);
                        Registry.SetValue(reg_keyname, "ToolArg" + totkeys.ToString(), @"/c """"c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"" & del $(ItemDir)$(ItemFileName).exe 2>nul & ""c:\Nim\bin\nim.exe"" c $(ItemPath)""", RegistryValueKind.String);
                        totkeys++;
                        Registry.SetValue(reg_keyname, "ToolNumKeys", totkeys, RegistryValueKind.DWord);
                    }
                }
            }
        }
开发者ID:jianboqi,项目名称:NimStudio,代码行数:84,代码来源:NSPackage.cs


示例12: RegisterForIdleTime

 private void RegisterForIdleTime()
 {
     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);
     }
 }
开发者ID:kageyamaginn,项目名称:VSSDK-Extensibility-Samples,代码行数:16,代码来源:PythonProjectPackage.cs


示例13: InitializeSourceOutlinerToolWindow

        /// <summary>
        /// Initializes the DTE and the code outline file manager, and hooks up events.
        /// </summary>
        private void InitializeSourceOutlinerToolWindow()
        {
            var dte = GetService(typeof(_DTE)) as DTE;
            sourceOutlinerWindow = (SourceOutlineToolWindow)FindToolWindow(typeof(SourceOutlineToolWindow), 0, true);
            sourceOutlinerWindow.Package = this;

            OLECRINFO[] crinfo = new OLECRINFO[1];
            crinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO));
            crinfo[0].grfcrf = (uint)_OLECRF.olecrfNeedIdleTime | (uint)_OLECRF.olecrfNeedPeriodicIdleTime
                               | (uint)_OLECRF.olecrfNeedAllActiveNotifs | (uint)_OLECRF.olecrfNeedSpecActiveNotifs;
            crinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal | (uint)_OLECADVF.olecadvfRedrawOff |
                                 (uint)_OLECADVF.olecadvfWarningsOff;
            crinfo[0].uIdleTimeInterval = 500;

            int hr = componentManager.FRegisterComponent(sourceOutlinerWindow, crinfo, out componentID);
            if (!ErrorHandler.Succeeded(hr))
            {
                Trace.WriteLine("Initialize->IOleComponent registration failed");
            }

            sourceOutlinerWindow.InitializeDTE(dte);
            sourceOutlinerWindow.AddWindowEvents();
            sourceOutlinerWindow.AddSolutionEvents();
        }
开发者ID:jda808,项目名称:NPL,代码行数:27,代码来源:NPLLanguageServicePackage.cs


示例14: Initialize

        protected override void Initialize()
        {
            base.Initialize();

            // Register the editor factory.
            RegisterEditorFactory(new CMakeEditorFactory(this));

            // Register the language service.
            IServiceContainer container = this as IServiceContainer;
            CMakeLanguageService service = new CMakeLanguageService();
            service.SetSite(this);
            container.AddService(typeof(CMakeLanguageService), service, true);

            // Register callbacks to respond to menu commands.
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService))
                as OleMenuCommandService;
            if (mcs != null)
            {
                RegisterMenuCallback(mcs, CMakeCmdIds.cmdidCMake, CMakeMenuCallback);
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelp,
                    "html\\index.html", "cmake.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpCommands,
                    "html\\manual\\cmake-commands.7.html", "cmake-commands.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpModules,
                    "html\\manual\\cmake-modules.7.html", "cmake-modules.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpProperties,
                    "html\\manual\\cmake-properties.7.html", "cmake-properties.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpVariables,
                    "html\\manual\\cmake-variables.7.html", "cmake-variables.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpCPack,
                    "html\\manual\\cpack.1.html", "cpack.html");
                RegisterHelpMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpCTest,
                    "html\\manual\\ctest.1.html", "ctest.html");
                RegisterMenuCallback(mcs, CMakeCmdIds.cmdidCMakeHelpWebSite,
                    CMakeHelpWebSiteMenuCallback);
            }

            // Register this object as an OLE component.  This is boilerplate code that
            // every language service package must have in order for the language
            // service's OnIdle method to be called.
            IOleComponentManager manager =
                (IOleComponentManager)GetService(typeof(SOleComponentManager));
            if (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 = 100;
                uint componentID = 0;
                manager.FRegisterComponent(this, crinfo, out componentID);
            }
        }
开发者ID:micst,项目名称:cmaketools,代码行数:56,代码来源:CMakePackage.cs


示例15: Initialize

        /// <summary>
        /// Called after the WindowPane has been sited with an IServiceProvider from the environment
        /// 
        protected override void Initialize()
        {
            base.Initialize();

            // Create and initialize the editor
            #region Register with IOleComponentManager
            IOleComponentManager componentManager = (IOleComponentManager)GetService(typeof(SOleComponentManager));
            if (this._componentId == 0 && componentManager != 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 = 100;
                int hr = componentManager.FRegisterComponent(this, crinfo, out this._componentId);
                ErrorHandler.Succeeded(hr);
            }
            #endregion

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditorPane));

            #region Hook Undo Manager
            // Attach an IOleUndoManager to our WindowFrame. Merely calling QueryService
            // for the IOleUndoManager on the site of our IVsWindowPane causes an IOleUndoManager
            // to be created and attached to the IVsWindowFrame. The WindowFrame automaticall
            // manages to route the undo related commands to the IOleUndoManager object.
            // Thus, our only responsibilty after this point is to add IOleUndoUnits to the
            // IOleUndoManager (aka undo stack).
            _undoManager = (IOleUndoManager)GetService(typeof(SOleUndoManager));

            // In order to use the IVsLinkedUndoTransactionManager, it is required that you
            // advise for IVsLinkedUndoClient notifications. This gives you a callback at
            // a point when there are intervening undos that are blocking a linked undo.
            // You are expected to activate your document window that has the intervening undos.
            if (_undoManager != null)
            {
                IVsLinkCapableUndoManager linkCapableUndoMgr = (IVsLinkCapableUndoManager)_undoManager;
                if (linkCapableUndoMgr != null)
                {
                    linkCapableUndoMgr.AdviseLinkedUndoClient(this);
                }
            }
            #endregion

            // hook up our
            XmlEditorService es = GetService(typeof(XmlEditorService)) as XmlEditorService;
            _store = es.CreateXmlStore();
            _store.UndoManager = _undoManager;

            _model = _store.OpenXmlModel(new Uri(_fileName));

            // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
            // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
            // the object returned by the Content property.
            _vsDesignerControl = new VsDesignerControl(_service, new ViewModel(_store, _model, this, _textBuffer));
            base.Content = _vsDesignerControl;

            RegisterIndependentView(true);

            IMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as IMenuCommandService;
            if (null != mcs)
            {
                // Now create one object derived from MenuCommnad for each command defined in
                // the CTC file and add it to the command service.

                // For each command we have to define its id that is a unique Guid/integer pair, then
                // create the OleMenuCommand object for this command. The EventHandler object is the
                // function that will be called when the user will select the command. Then we add the
                // OleMenuCommand to the menu service.  The addCommand helper function does all this for us.
                AddCommand(mcs, VSConstants.GUID_VSStandardCommandSet97, (int)VSConstants.VSStd97CmdID.NewWindow,
                                new EventHandler(OnNewWindow), new EventHandler(OnQueryNewWindow));
                AddCommand(mcs, VSConstants.GUID_VSStandardCommandSet97, (int)VSConstants.VSStd97CmdID.ViewCode,
                                new EventHandler(OnViewCode), new EventHandler(OnQueryViewCode));
            }
        }
开发者ID:hkopparru,项目名称:VSPlugin,代码行数:78,代码来源:EditorPane.cs


示例16: Initialize

        protected override void Initialize() {
            var container = (IServiceContainer)this;
            UIThread.EnsureService(this);
            container.AddService(GetLibraryManagerType(), CreateService, true);

            var componentManager = _compMgr = (IOleComponentManager)GetService(typeof(SOleComponentManager));
            OLECRINFO[] crinfo = new OLECRINFO[1];
            crinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO));
            crinfo[0].grfcrf = (uint)_OLECRF.olecrfNeedIdleTime;
            crinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal | (uint)_OLECADVF.olecadvfRedrawOff | (uint)_OLECADVF.olecadvfWarningsOff;
            crinfo[0].uIdleTimeInterval = 0;
            ErrorHandler.ThrowOnFailure(componentManager.FRegisterComponent(this, crinfo, out _componentID));

            base.Initialize();
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:15,代码来源:CommonPackage.cs


示例17: SetSite

    public virtual int SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider site){
      this.site = new ServiceProvider(site);

      // register our independent view with the IVsTextManager so that it knows
      // the user is working with a view over the text buffer. this will trigger
      // the text buffer to prompt the user whether to reload the file if it is
      // edited outside of the development Environment.
      IVsTextManager textManager = (IVsTextManager)this.site.QueryService(VsConstants.SID_SVsTextManager, typeof(IVsTextManager));
      if (textManager != null) {
        IVsWindowPane windowPane = (IVsWindowPane)this;
        textManager.RegisterIndependentView(this, (VsTextBuffer)this.buffer);
      }

      //register with ComponentManager for Idle processing
      this.componentManager = (IOleComponentManager)this.site.QueryService(VsConstants.SID_SOleComponentManager, typeof(IOleComponentManager));
      if (componentID == 0){
        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;
        this.componentManager.FRegisterComponent(this, crinfo, out this.componentID);
      }
      return 0;
    }
开发者ID:hesam,项目名称:SketchSharp,代码行数:28,代码来源:EditorView.cs


示例18: SetSite

    public virtual void SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider site){

      this.site = new ServiceProvider(site);
      this.editorFactory = CreateEditorFactory();
      if (this.editorFactory != null) {
        this.editorFactory.SetSite(site);
        Guid editorGuid = this.editorFactory.GetType().GUID;
        IVsRegisterEditors vre = (IVsRegisterEditors)this.site.QueryService( VsConstants.SID_SVsRegisterEditors, typeof(IVsRegisterEditors));
        vre.RegisterEditor(ref editorGuid, editorFactory, out this.editorFactoryCookie);
      }

      this.projectFactory = CreateProjectFactory();
      if (this.projectFactory != null) {
        this.projectFactory.SetSite(site);
        IVsRegisterProjectTypes rpt = (IVsRegisterProjectTypes)this.site.QueryService(VsConstants.SID_IVsRegisterProjectTypes, typeof(IVsRegisterProjectTypes));
        if (rpt != null) {
          Guid projectType = this.projectFactory.GetType().GUID;
          rpt.RegisterProjectType(ref projectType, this.projectFactory, out this.projectFactoryCookie);          
        }
      }

      uint lcid = VsShell.GetProviderLocale(this.site);

      languageServices = new Hashtable();
      string thisPackage = "{"+this.GetType().GUID.ToString() + "}";
      ServiceProvider thisSite = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)this);

      ILocalRegistry3 localRegistry = (ILocalRegistry3)this.site.QueryService( VsConstants.SID_SLocalRegistry, typeof(ILocalRegistry3));
      string root = null;        
      if (localRegistry != null) {
        localRegistry.GetLocalRegistryRoot(out root);
      }
      using (RegistryKey rootKey = Registry.LocalMachine.OpenSubKey(root)) {
        if (rootKey != null) {
          using (RegistryKey languages = rootKey.OpenSubKey("Languages\\Language Services")) {
            if (languages != null) {
              foreach (string languageName in languages.GetSubKeyNames()) {
                using (RegistryKey langKey = languages.OpenSubKey(languageName)) {
                  object pkg = langKey.GetValue("Package");
                  if (pkg is string && (string)pkg == thisPackage) {
                    object guid = langKey.GetValue(null);
                    if (guid is string) {
                      Guid langGuid = new Guid((string)guid);
                      if (!this.languageServices.Contains(langGuid.ToString())){
                        LanguageService svc = CreateLanguageService(ref langGuid);
                        if (svc != null) {
                          svc.Init(thisSite, ref langGuid, lcid, GetFileExtensions(rootKey, (string)guid));
                          this.languageServices.Add(langGuid.ToString(), svc);
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }

      //register with ComponentManager for Idle processing
      this.componentManager = (IOleComponentManager)this.site.QueryService(VsConstants.SID_SOleComponentManager, typeof(IOleComponentManager));
      if (componentID == 0)
      {
          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;
          this.componentManager.FRegisterComponent(this, crinfo, out componentID);
      }

    }
开发者ID:hesam,项目名称:SketchSharp,代码行数:75,代码来源:Package.cs


示例19: RegisterIdleLoop

        private static uint RegisterIdleLoop(SVsServiceProvider serviceProvider, IOleComponent component)
        {
            var oleComponentManager = serviceProvider.GetService(typeof(SOleComponentManager)) as IOleComponentManager;
            if (oleComponentManager != null)
            {
                uint pwdId;
                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;
                oleComponentManager.FRegisterComponent(component, crinfo, out pwdId);

                return pwdId;
            }
            return uint.MinValue;
        }
开发者ID:XewTurquish,项目名称:vsminecraft,代码行数:20,代码来源:JavaEditorConnectionListener.cs


示例20: RegisterLanguageService

        private void RegisterLanguageService(Type languageServiceType)
        {
            ServiceCreatorCallback callback = new ServiceCreatorCallback(
                delegate (IServiceContainer container, Type serviceType)
                {
                    if (languageServiceType == serviceType)
                    {
                        LanguageService language = (LanguageService)Activator.CreateInstance(languageServiceType);
                        language.SetSite(this);

                        // register for idle time callbacks
                        IOleComponentManager mgr = GetService(typeof(SOleComponentManager)) as IOleComponentManager;
                        uint componentID = 0;
                        if (!this.componentIDs.TryGetValue(languageServiceType, out componentID) && 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);
                            this.componentIDs.Add(languageServiceType, componentID);
                        }

                        return language;
                    }
                    else
                    {
                        return null;
                    }
                });
            (this as IServiceContainer).AddService(languageServiceType, callback, true);
        }
开发者ID:Bubesz,项目名称:meta-cs,代码行数:36,代码来源:MetaDslxLanguagePackage.cs



注:本文中的OLECRINFO类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# OLVColumn类代码示例发布时间:2022-05-24
下一篇:
C# OLECMD类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap