Ejemplo n.º 1
0
 private void NotifyContextChange(IVsUserContext cxt)
 {
     if ((_ServiceProvider != null) && (_ParentService == null))
     {
         IVsUserContext        ppContext = null;
         IVsMonitorUserContext service   =
             (IVsMonitorUserContext)_ServiceProvider.GetService(typeof(IVsMonitorUserContext));
         if (service != null)
         {
             NativeMethods.ThrowOnFailure(service.get_ApplicationContext(out ppContext));
         }
         if (ppContext != cxt)
         {
             IVsWindowFrame frame = (IVsWindowFrame)_ServiceProvider.GetService(typeof(IVsWindowFrame));
             if ((frame != null) && !IsToolWindow(frame))
             {
                 IVsTrackSelectionEx ex = (IVsTrackSelectionEx)_ServiceProvider.GetService(typeof(IVsTrackSelectionEx));
                 if (ex != null)
                 {
                     object varValue = cxt;
                     NativeMethods.ThrowOnFailure(ex.OnElementValueChange(5, 0, varValue));
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        /// <devdoc>
        ///     Called to notify the IDE that our user context has changed.
        /// </devdoc>
        private void NotifyContextChange(IVsUserContext cxt)
        {
            if (provider == null)
            {
                return;
            }

            IVsUserContext        currentContext = null;
            IVsMonitorUserContext muc            = (IVsMonitorUserContext)provider.GetService(typeof(IVsMonitorUserContext));

            if (muc != null)
            {
                NativeMethods.ThrowOnFailure(muc.get_ApplicationContext(out currentContext));
            }

            if (currentContext == cxt)
            {
                return;
            }


            IVsTrackSelectionEx ts = (IVsTrackSelectionEx)provider.GetService(typeof(IVsTrackSelectionEx));

            if (ts != null)
            {
                Object obj = cxt;

                NativeMethods.ThrowOnFailure(ts.OnElementValueChange(5 /* SEID_UserContext */, 0, obj));
            }
        }
Ejemplo n.º 3
0
        /// <include file='doc\HelpService.uex' path='docs/doc[@for="HelpService.NotifyContextChange"]/*' />
        /// <devdoc>
        ///     Called to notify the IDE that our user context has changed.
        /// </devdoc>
        private void NotifyContextChange(IVsUserContext cxt)
        {
            if (provider == null || !notifySelection)
            {
                return;
            }

            IVsTrackSelectionEx ts = (IVsTrackSelectionEx)provider.GetService(typeof(IVsTrackSelectionEx));

            if (ts != null)
            {
                Object obj = cxt;

                ts.OnElementValueChange(5 /* SEID_UserContext */, 0, obj);
            }
        }