DXCore Components – ContextProvider

September 25th, 2010

The ContextProvidercomponent provides a new context entry for the ContextPicker component. Context is automatically registered in the DXCore when a plug-in containing the corresponding ContextProvider is loaded.

It’s not a visual control, only its properties and events should be tweaked. Here’s the Properties window, containing available properties, their categories and default values:

and the Events list:

The ContextProvider component is located in the “DevExpress.CodeRush.Extensions” assembly. It is derived from the “ProviderBase” and “PlugInExtension” base types:

Here’s a list of properties in alphabetical order, without base types’ non-significant properties:

Property name

Description

Description

Text, describing the purpose or behavior of this plug-in extension. This text may appear inside the User Guide, configuration UI, or the About box.

DisplayName

The text name that identifies this extension. This text may appear inside the User Guide, configuration UI, or the About box.

Parameters

Parameters for this context provider. Users can specify parameters right-clicking the context picker.

ProviderName

The name of this provider.

Register

If true, this extension will be available to the DXCore. Otherwise, it will be hidden.

Events:

Event name

Description

ContextSatisfied

Handle this event to specify whether your context or state is satisfied (true or false).

LanguageSupported

Handle this optional event if you want to restrict your context to one or more programming languages. If you do not handle this event, the DXCore makes your context available in all programming languages.

There are only two important things to make the ContextProvider available and working:

Fill the ProviderName property

Handle the ContextSatisfied event

Using the ProviderName, you are able to access this context on the ContextPicker component, and once it’s going to be verified, the ContextSatisfied event will do its job – perform the check you added into the event handler. Contexts can also be verified programmatically inside your DXCore plug-in.