Interface IPlugin
Represents a plug-in, which provides a number of extensions.
Namespace: SdlSdl.CorePluginFramework
Assembly: Sdl.Core.PluginFramework.dll
Syntax
public interface IPlugin
Properties
CanDisable
Returns whether this plugin can be disabled. This uses the PluginStateHandler to determine this and returns true if no such handler is specified.
Declaration
bool CanDisable { get; }
Property Value
Type | Description |
---|---|
bool |
CanEnable
Returns whether this plugin can be enabled. This uses the PluginStateHandler to determine this and returns true if no such handler is specified.
Declaration
bool CanEnable { get; }
Property Value
Type | Description |
---|---|
bool |
Descriptor
Returns the descriptor through which this plug-in manifest was loaded.
Declaration
IPluginDescriptor Descriptor { get; }
Property Value
Type | Description |
---|---|
IPluginDescriptor |
Enabled
True if the plug-in is enabled.
Declaration
bool Enabled { get; }
Property Value
Type | Description |
---|---|
bool |
Extensions
Returns the collection of extensions this plug-in provides.
Declaration
ExtensionCollection Extensions { get; }
Property Value
Type | Description |
---|---|
ExtensionCollection |
Id
Returns the unique id of the plug-in.
Declaration
PluginId Id { get; }
Property Value
Type | Description |
---|---|
PluginId |
IsDynamic
True if the plug-in can be enabled or disabled without having to restart the application.
Declaration
bool IsDynamic { get; }
Property Value
Type | Description |
---|---|
bool |
Name
Returns the friendly name of the plug-in.
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
string |
Status
Gets the status of this plug-in.
Declaration
PluginStatus Status { get; }
Property Value
Type | Description |
---|---|
PluginStatus |
Remarks
Only plug-ins with status Initialized are fully functional and can instantiate their extensions. Plug-ins that have not been initialized must be initialized before use by using IPluginInitializer.
Version
Gets the version of the plug-in.
Declaration
string Version { get; }
Property Value
Type | Description |
---|---|
string |
Methods
GetPluginResource<T>(string)
Retrieves a resource of a specific type from the plug-ins resource file.
Declaration
T GetPluginResource<T>(string resourceName) where T : class
Parameters
Type | Name | Description |
---|---|---|
string | resourceName | The name of the resource in the resource file. |
Returns
Type | Description |
---|---|
T | The resource with the specified name, or null if the resource does not exist. |
Type Parameters
Name | Description |
---|---|
T | The type of the resource. |
Remarks
The plug-in resource file is a .Net resource file, with extension ".plugin.resources". For instance, when the plug-in manifest XML file is called "Myplugin.plugin.xml", the plug-in resource file should be called "MyPlugin.plugin.resources". Localized resources are supported by deploying additional resource files, following the naming convention "MyPlugin.plugin.LANGUAGECODE.resources".
Exceptions
Type | Condition |
---|---|
InvalidCastException | Thrown when the resource with the specified name is not of the required type. |
SetEnabled(bool)
Enables or disables the plug-in.
Declaration
bool SetEnabled(bool enabled)
Parameters
Type | Name | Description |
---|---|---|
bool | enabled | True to enable the plug-in. |
Returns
Type | Description |
---|---|
bool | True if disabling the plug-in does not require restarting the application, false otherwise. |
Validate()
Validates this plug-in.
Declaration
void Validate()