Пример #1
0
        IHelpService IHelpService.CreateLocalContext(HelpContextType contextType)
        {
            IVsUserContext localContext = null;
            uint           cookie       = 0;

            return(CreateLocalContext(contextType, false, out localContext, out cookie));
        }
Пример #2
0
        public IHelpService CreateLocalContext(HelpContextType contextType)
        {
            IVsUserContext newContext = null;
            int            cookie     = 0;

            return(CreateLocalContext(contextType, false, out newContext, out cookie));
        }
Пример #3
0
 /// <devdoc>
 /// </devdoc>
 private HelpService(HelpService parentService, IVsUserContext subContext, uint cookie, IServiceProvider provider, HelpContextType priority) {
     this.context = subContext;
     this.provider = provider;
     this.cookie = cookie;
     this.parentService = parentService;
     this.priority = priority;
 }
Пример #4
0
 private HelpService(HelpService parentService, IVsUserContext subContext, int cookie, IServiceProvider provider, HelpContextType priority)
 {
     this.context       = subContext;
     this.provider      = provider;
     this.cookie        = cookie;
     this.parentService = parentService;
     this.priority      = priority;
 }
Пример #5
0
        /// <devdoc>
        /// </devdoc>
        private IHelpService CreateLocalContext(HelpContextType contextType, bool recreate, out IVsUserContext localContext, out uint cookie) {
            cookie = 0;
            localContext = null;
            if (provider == null) {
                return null;
            }

            localContext = null;
            int hr = NativeMethods.S_OK;
            IVsMonitorUserContext muc = (IVsMonitorUserContext)provider.GetService(typeof(IVsMonitorUserContext));
            if (muc != null) {
                try {
                    hr = muc.CreateEmptyContext(out localContext);
                } catch (COMException e) {
                    hr = e.ErrorCode;
                }
            }
         
            if ( NativeMethods.Succeeded(hr) && (localContext != null) ) {
                VSUSERCONTEXTPRIORITY priority = 0;
                switch (contextType) {
                    case HelpContextType.ToolWindowSelection:
                        priority = VSUSERCONTEXTPRIORITY.VSUC_Priority_ToolWndSel;
                        break;
                    case HelpContextType.Selection:
                        priority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Selection;
                        break;
                    case HelpContextType.Window:
                        priority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Window;
                        break;
                    case HelpContextType.Ambient:
                        priority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Ambient;
                        break;
                }
                
                IVsUserContext cxt = GetUserContext();
                if (cxt != null)
                {
                    try {
                        hr = cxt.AddSubcontext(localContext, (int)priority, out cookie);
                    } catch (COMException e) {
                        hr = e.ErrorCode;
                    }
                }
                
                if (NativeMethods.Succeeded(hr) && (cookie != 0)) {
                    if (!recreate) {
                        HelpService newHs = new HelpService(this, localContext, cookie, provider, contextType);
                        if (subContextList == null) {
                            subContextList = new ArrayList();
                        }
                        subContextList.Add(newHs);
                        return newHs;
                    }
                }
            }
            return null;
        }
Пример #6
0
 // --------------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="HelpService"/> class.
 /// </summary>
 /// <param name="parentService">The parent service.</param>
 /// <param name="subContext">The sub context.</param>
 /// <param name="cookie">The cookie.</param>
 /// <param name="provider">The provider.</param>
 /// <param name="priority">The priority.</param>
 // --------------------------------------------------------------------------------------------
 private HelpService(HelpService parentService, IVsUserContext subContext, uint cookie,
                     IServiceProvider provider, HelpContextType priority)
 {
   _Context = subContext;
   _ServiceProvider = provider;
   _Cookie = cookie;
   _ParentService = parentService;
   _Priority = priority;
 }
Пример #7
0
 // --------------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="HelpService"/> class.
 /// </summary>
 /// <param name="parentService">The parent service.</param>
 /// <param name="subContext">The sub context.</param>
 /// <param name="cookie">The cookie.</param>
 /// <param name="provider">The provider.</param>
 /// <param name="priority">The priority.</param>
 // --------------------------------------------------------------------------------------------
 private HelpService(HelpService parentService, IVsUserContext subContext, uint cookie,
                     IServiceProvider provider, HelpContextType priority)
 {
     _Context         = subContext;
     _ServiceProvider = provider;
     _Cookie          = cookie;
     _ParentService   = parentService;
     _Priority        = priority;
 }
Пример #8
0
        private IHelpService CreateLocalContext(HelpContextType contextType, bool recreate, out IVsUserContext localContext, out int cookie)
        {
            cookie       = 0;
            localContext = null;
            if (provider == null)
            {
                return(null);
            }

            localContext = null;
            IVsMonitorUserContext muc = (IVsMonitorUserContext)provider.GetService(typeof(IVsMonitorUserContext));

            if (muc != null)
            {
                localContext = muc.CreateEmptyContext();
            }

            if (localContext != null)
            {
                int priority = 0;
                switch (contextType)
                {
                case HelpContextType.ToolWindowSelection:
                    priority = tagVsUserContextPriority.VSUC_Priority_ToolWndSel;
                    break;

                case HelpContextType.Selection:
                    priority = tagVsUserContextPriority.VSUC_Priority_Selection;
                    break;

                case HelpContextType.Window:
                    priority = tagVsUserContextPriority.VSUC_Priority_Window;
                    break;

                case HelpContextType.Ambient:
                    priority = tagVsUserContextPriority.VSUC_Priority_Ambient;
                    break;
                }

                cookie = GetUserContext().AddSubcontext(localContext, priority);

                if (cookie != 0)
                {
                    if (!recreate)
                    {
                        HelpService newHs = new HelpService(this, localContext, cookie, provider, contextType);
                        if (subContextList == null)
                        {
                            subContextList = new ArrayList();
                        }
                        subContextList.Add(newHs);
                        return(newHs);
                    }
                }
            }
            return(null);
        }
Пример #9
0
		public IHelpService CreateLocalContext(HelpContextType contextType)
		{
			return this;
		}
Пример #10
0
    private IHelpService CreateLocalContext(HelpContextType contextType, bool recreate, out IVsUserContext localContext,
                                            out uint cookie)
    {
      cookie = 0;
      localContext = null;
      if (_ServiceProvider != null)
      {
        localContext = null;
        int hr = 0;
        IVsMonitorUserContext context =
          (IVsMonitorUserContext) _ServiceProvider.GetService(typeof (IVsMonitorUserContext));
        if (context != null)
        {
          try
          {
            hr = context.CreateEmptyContext(out localContext);
          }
          catch (COMException exception)
          {
            hr = exception.ErrorCode;
          }
        }
        if (NativeMethods.Succeeded(hr) && (localContext != null))
        {
          VSUSERCONTEXTPRIORITY vsusercontextpriority = VSUSERCONTEXTPRIORITY.VSUC_Priority_None;
          switch (contextType)
          {
            case HelpContextType.Ambient:
              vsusercontextpriority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Ambient;
              break;

            case HelpContextType.Window:
              vsusercontextpriority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Window;
              break;

            case HelpContextType.Selection:
              vsusercontextpriority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Selection;
              break;

            case HelpContextType.ToolWindowSelection:
              vsusercontextpriority = VSUSERCONTEXTPRIORITY.VSUC_Priority_ToolWndSel;
              break;
          }
          IVsUserContext userContext = GetUserContext();
          if (userContext != null)
          {
            try
            {
              hr = userContext.AddSubcontext(localContext, (int) vsusercontextpriority, out cookie);
            }
            catch (COMException exception2)
            {
              hr = exception2.ErrorCode;
            }
          }
          if ((NativeMethods.Succeeded(hr) && (cookie != 0)) && !recreate)
          {
            HelpService service = new HelpService(this, localContext, cookie, _ServiceProvider, contextType);
            if (_SubContextList == null)
            {
              _SubContextList = new ArrayList();
            }
            _SubContextList.Add(service);
            return service;
          }
        }
      }
      return null;
    }
Пример #11
0
 IHelpService IHelpService.CreateLocalContext(HelpContextType contextType)
 {
   IVsUserContext localContext = null;
   uint cookie = 0;
   return CreateLocalContext(contextType, false, out localContext, out cookie);
 }
Пример #12
0
        private IHelpService CreateLocalContext(HelpContextType contextType, bool recreate, out IVsUserContext localContext,
                                                out uint cookie)
        {
            cookie       = 0;
            localContext = null;
            if (_ServiceProvider != null)
            {
                localContext = null;
                int hr = 0;
                IVsMonitorUserContext context =
                    (IVsMonitorUserContext)_ServiceProvider.GetService(typeof(IVsMonitorUserContext));
                if (context != null)
                {
                    try
                    {
                        hr = context.CreateEmptyContext(out localContext);
                    }
                    catch (COMException exception)
                    {
                        hr = exception.ErrorCode;
                    }
                }
                if (NativeMethods.Succeeded(hr) && (localContext != null))
                {
                    VSUSERCONTEXTPRIORITY vsusercontextpriority = VSUSERCONTEXTPRIORITY.VSUC_Priority_None;
                    switch (contextType)
                    {
                    case HelpContextType.Ambient:
                        vsusercontextpriority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Ambient;
                        break;

                    case HelpContextType.Window:
                        vsusercontextpriority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Window;
                        break;

                    case HelpContextType.Selection:
                        vsusercontextpriority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Selection;
                        break;

                    case HelpContextType.ToolWindowSelection:
                        vsusercontextpriority = VSUSERCONTEXTPRIORITY.VSUC_Priority_ToolWndSel;
                        break;
                    }
                    IVsUserContext userContext = GetUserContext();
                    if (userContext != null)
                    {
                        try
                        {
                            hr = userContext.AddSubcontext(localContext, (int)vsusercontextpriority, out cookie);
                        }
                        catch (COMException exception2)
                        {
                            hr = exception2.ErrorCode;
                        }
                    }
                    if ((NativeMethods.Succeeded(hr) && (cookie != 0)) && !recreate)
                    {
                        HelpService service = new HelpService(this, localContext, cookie, _ServiceProvider, contextType);
                        if (_SubContextList == null)
                        {
                            _SubContextList = new ArrayList();
                        }
                        _SubContextList.Add(service);
                        return(service);
                    }
                }
            }
            return(null);
        }
Пример #13
0
 public IHelpService CreateLocalContext(HelpContextType contextType)
 {
     return(this);
 }
Пример #14
0
        /// <devdoc>
        /// </devdoc>
        private IHelpService CreateLocalContext(HelpContextType contextType, bool recreate, out IVsUserContext localContext, out uint cookie)
        {
            cookie       = 0;
            localContext = null;
            if (provider == null)
            {
                return(null);
            }

            localContext = null;
            int hr = NativeMethods.S_OK;
            IVsMonitorUserContext muc = (IVsMonitorUserContext)provider.GetService(typeof(IVsMonitorUserContext));

            if (muc != null)
            {
                try {
                    hr = muc.CreateEmptyContext(out localContext);
                } catch (COMException e) {
                    hr = e.ErrorCode;
                }
            }

            if (NativeMethods.Succeeded(hr) && (localContext != null))
            {
                VSUSERCONTEXTPRIORITY priority = 0;
                switch (contextType)
                {
                case HelpContextType.ToolWindowSelection:
                    priority = VSUSERCONTEXTPRIORITY.VSUC_Priority_ToolWndSel;
                    break;

                case HelpContextType.Selection:
                    priority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Selection;
                    break;

                case HelpContextType.Window:
                    priority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Window;
                    break;

                case HelpContextType.Ambient:
                    priority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Ambient;
                    break;
                }

                IVsUserContext cxt = GetUserContext();
                if (cxt != null)
                {
                    try {
                        hr = cxt.AddSubcontext(localContext, (int)priority, out cookie);
                    } catch (COMException e) {
                        hr = e.ErrorCode;
                    }
                }

                if (NativeMethods.Succeeded(hr) && (cookie != 0))
                {
                    if (!recreate)
                    {
                        HelpService newHs = new HelpService(this, localContext, cookie, provider, contextType);
                        if (subContextList == null)
                        {
                            subContextList = new ArrayList();
                        }
                        subContextList.Add(newHs);
                        return(newHs);
                    }
                }
            }
            return(null);
        }