Пример #1
0
        /// <devdoc>
        ///     Recretes the context
        /// </devdoc>
        private void RecreateContext()
        {
            if (parentService != null && needsRecreate)
            {
                needsRecreate = false;
                if (this.context == null)
                {
                    parentService.CreateLocalContext(this.priority, true, out this.context, out this.cookie);
                }
                else
                {
                    VSUSERCONTEXTPRIORITY vsPriority = 0;
                    switch (priority)
                    {
                    case HelpContextType.ToolWindowSelection:
                        vsPriority = VSUSERCONTEXTPRIORITY.VSUC_Priority_ToolWndSel;
                        break;

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

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

                    case HelpContextType.Ambient:
                        vsPriority = VSUSERCONTEXTPRIORITY.VSUC_Priority_Ambient;
                        break;
                    }
                    IVsUserContext cxtParent = parentService.GetUserContext();
                    IVsUserContext cxt       = GetUserContext();

                    if (cxt != null && cxtParent != null)
                    {
                        NativeMethods.ThrowOnFailure(cxtParent.AddSubcontext(cxt, (int)vsPriority, out this.cookie));
                    }
                }
            }
        }