Interface IPlugin
Represents a plug-in, which provides a number of extensions.
Namespace: Sdl.Core.PluginFramework
Assembly: Sdl.Core.PluginFramework.dll
Syntax
public interface IPlugin
Properties
CanDisable
Returns whether this plugin can be disabled. This uses the Plugin
Declaration
bool CanDisable { get; }
Property Value
Type | Description |
---|---|
Boolean |
CanEnable
Returns whether this plugin can be enabled. This uses the Plugin
Declaration
bool CanEnable { get; }
Property Value
Type | Description |
---|---|
Boolean |
Descriptor
Returns the descriptor through which this plug-in manifest was loaded.
Declaration
IPluginDescriptor Descriptor { get; }
Property Value
Type | Description |
---|---|
IPlugin |
Enabled
True if the plug-in is enabled.
Declaration
bool Enabled { get; }
Property Value
Type | Description |
---|---|
Boolean |
Extensions
Returns the collection of extensions this plug-in provides.
Declaration
ExtensionCollection Extensions { get; }
Property Value
Type | Description |
---|---|
Extension |
Id
Returns the unique id of the plug-in.
Declaration
PluginId Id { get; }
Property Value
Type | Description |
---|---|
Plugin |
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 |
---|---|
Boolean |
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 |
---|---|
Plugin |
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 IPlugin
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 |
---|---|
System. |
Thrown when the resource with the specified name is not of the required type. |
SetEnabled(Boolean)
Enables or disables the plug-in.
Declaration
bool SetEnabled(bool enabled)
Parameters
Type | Name | Description |
---|---|---|
Boolean | enabled | True to enable the plug-in. |
Returns
Type | Description |
---|---|
Boolean | True if disabling the plug-in does not require restarting the application, false otherwise. |
Validate()
Validates this plug-in.
Declaration
void Validate()