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 PluginStateHandler to determine this and returns true if no such handler is specified.
Declaration
bool CanDisable { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
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 |
---|---|
System.Boolean |
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 |
---|---|
System.Boolean |
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 |
---|---|
System.Boolean |
Name
Returns the friendly name of the plug-in.
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
System.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 |
---|---|
System.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 |
---|---|---|
System.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.InvalidCastException | 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 |
---|---|---|
System.Boolean | enabled | True to enable the plug-in. |
Returns
Type | Description |
---|---|
System.Boolean | True if disabling the plug-in does not require restarting the application, false otherwise. |
Validate()
Validates this plug-in.
Declaration
void Validate()