[This post is part of the developer's manual preview published on this blog. You can find temporary TOC here.]
ProviderControlPanel is a specialized ControlPanel class which comes with built-in infrastructure for the modules that support multiple providers. If your module supports multiple providers (see provider model pattern), your control panel class should inherit from the ProviderControlPanel and not from ControlPanel class, as it is demonstrated in this sample:
The ProviderControlPanel class will give you the built-in selector for all the providers that have been defined for the module. The following image depicts this functionality:
|public class BlogsControlPanel : ProviderControlPanel<BlogsControlPanel> |
ProviderControlPanel inherits from ControlPanel class, which inherits from ViewModeControl class, so you can use references for these classes when working with ProviderControlPanel.
- string ProviderName
Gets or sets the name of the data provider that will be used to retrieve and manipulate data. The built-in selector will automatically set this property when user changes the provider through the user interface.
- string ProviderSelectorPanelTitle
Gets or sets the title of the panel containing the data provider selector. Usually this is the first command panel on the top right side of the control panel.
- ICommandPanel CreateProviderSelectorPanel()
This method is in charge of creating the provider selector panel and indicates the currently selected provider. This method can be overridden in case that implementation should be different.
- string GetDefaultProviderName()
Gets the default provider name for the module. This method should always be overridden on the actual implementation of the control panel and name of the default provider should be returned.
- string GetProviderNames()
Gets the array of all provider names supported by this module. This method should always be overridden on the actual implementation of the control panel and names of all providers supported by the module should be returned as an string array.