Condividi tramite


IVsUserContext Interface

Manages attributes and keywords (context and subcontext) in the context or subcontext bag.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Dichiarazione
<InterfaceTypeAttribute()> _
<GuidAttribute("761081DF-D45F-4683-9B9E-1B7241E56F5C")> _
Public Interface IVsUserContext
'Utilizzo
Dim instance As IVsUserContext
[InterfaceTypeAttribute()]
[GuidAttribute("761081DF-D45F-4683-9B9E-1B7241E56F5C")]
public interface IVsUserContext
[InterfaceTypeAttribute()]
[GuidAttribute(L"761081DF-D45F-4683-9B9E-1B7241E56F5C")]
public interface class IVsUserContext
public interface IVsUserContext

Remarks

Context and subcontext are comprised of F1 keywords, lookup keywords, and attributes. Context and subcontext bags are COM objects (IVsUserContext objects) that are used to group keywords and attributes associated with a particular context provider. Context providers are environment components that are involved in selection, such as tool windows, editors, and language services. Subcontext is a selection within an editor, tool window or language service. Examples of subcontext elements include a key language term in a language service or a command in a tool window.

The context provider associates the context bag with the selection. The subcontext bag is a separate IVsUserContext object that is linked to the context bag. Because the context bag points to any subcontext bags that are linked to it, the keywords and attributes present in both the context and subcontext bags comprise the entire context for the component. The union of the context and subcontext bags for each context provider within the active selection describes the overall context in the environment at a particular time.

At the appropriate time (typically at idle time), the Dynamic Help window collects the context from each of the active context providers, looks up the keywords in the information provider, filters the topics that are returned based on attributes, and displays links to the topics in its window.

Before you can use the methods of IVsUserContext to manage the context bag, you first need to set up the environment component as a context provider by creating a context bag for it. To create a new context bag, call QueryService on the SVsMonitorUserContext service to get a pointer to the IVsMonitorUserContext interface. Once you have the pointer to this interface, call CreateEmptyContext to create a new context bag and to receive a pointer to IVsUserContext. You can then call the AddAttribute method to add attributes, lookup keywords, or F1 keywords to the context bag. Use this same procedure to create and populate a subcontext bag, and then call AddSubcontext to link the subcontext bag to the context bag. For more information about creating and managing context and subcontext bags for different types of environment components, see Integrating Context-Sensitive Help.

Notes to Callers:

Call this interface to add, remove, enumerate, or flag context and subcontext.

See Also

Concepts

Context-Sensitive Help Overview

Reference

IVsUserContext Members

Microsoft.VisualStudio.Shell.Interop Namespace