Class Plugin
Represents a plugin
public class Plugin : CorePropertyChanged, IDisposable
- Inheritance
-
objectCorePropertyChangedPlugin
- Implements
Properties
Assembly
The assembly the plugin code lives in
public Assembly? Assembly { get; }
Property Value
Bootstrapper
Gets the plugin bootstrapper
public PluginBootstrapper? Bootstrapper { get; }
Property Value
ConfigurationDialog
Gets or sets a configuration dialog for this plugin that is accessible in the UI under Settings > Plugins
public IPluginConfigurationDialog? ConfigurationDialog { get; set; }
Property Value
Container
Gets the IOC container of the plugin, only use this for advanced IOC operations, otherwise see Resolve(Type, params object?[]) and Resolve<T>(params object?[])
public IContainer? Container { get; }
Property Value
- IContainer
Directory
The plugins root directory
public DirectoryInfo Directory { get; }
Property Value
Features
Gets a read-only collection of all features this plugin provides
public ReadOnlyCollection<PluginFeatureInfo> Features { get; }
Property Value
Guid
Gets the plugin GUID
public Guid Guid { get; }
Property Value
Info
Gets the plugin info related to this plugin
public PluginInfo Info { get; }
Property Value
IsEnabled
Indicates whether the user enabled the plugin or not
public bool IsEnabled { get; }
Property Value
Profilers
Gets a read-only collection of profiles running on the plugin
public ReadOnlyCollection<Profiler> Profilers { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by the object and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposingbooltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
GetFeatureInfo<T>()
Looks up the feature info the feature of type T
public PluginFeatureInfo GetFeatureInfo<T>() where T : PluginFeature
Returns
- PluginFeatureInfo
Feature info of the feature
Type Parameters
TThe type of feature to find
GetFeature<T>()
Looks up the instance of the feature of type T
public T? GetFeature<T>() where T : PluginFeature
Returns
- T
If found, the instance of the feature
Type Parameters
TThe type of feature to find
GetProfiler(string)
Gets a profiler with the provided name, if it does not yet exist it will be created.
public Profiler GetProfiler(string name)
Parameters
namestringThe name of the profiler
Returns
- Profiler
A new or existing profiler with the provided
name
OnDisabled()
Invokes the Disabled event
protected virtual void OnDisabled()
OnEnabled()
Invokes the Enabled event
protected virtual void OnEnabled()
OnFeatureAdded(PluginFeatureInfoEventArgs)
Invokes the FeatureAdded event
protected virtual void OnFeatureAdded(PluginFeatureInfoEventArgs e)
Parameters
OnFeatureRemoved(PluginFeatureInfoEventArgs)
Invokes the FeatureRemoved event
protected virtual void OnFeatureRemoved(PluginFeatureInfoEventArgs e)
Parameters
Register<TImplementation>(PluginServiceScope)
Registers implementation type TImplementation with itself as service type.
public void Register<TImplementation>(PluginServiceScope scope = PluginServiceScope.Singleton)
Parameters
scopePluginServiceScopeThe scope in which the service should live, if you are not sure leave it on singleton.
Type Parameters
TImplementationThe implementation of the service to register.
Register<TService, TImplementation>(PluginServiceScope)
Registers service of TService type implemented by TImplementation type.
public void Register<TService, TImplementation>(PluginServiceScope scope = PluginServiceScope.Singleton) where TImplementation : TService
Parameters
scopePluginServiceScopeThe scope in which the service should live, if you are not sure leave it on singleton.
Type Parameters
TServiceThe service to register.
TImplementationThe implementation of the service to register.
RemoveProfiler(Profiler)
Removes a profiler from the plugin
public void RemoveProfiler(Profiler profiler)
Parameters
profilerProfilerThe profiler to remove
Resolve(Type, params object?[])
Gets an instance of the specified service using the plugins dependency injection container.
public object Resolve(Type type, params object?[] arguments)
Parameters
typeTypeThe type of service to resolve.
argumentsobject[]Arguments to supply to the service.
Returns
- object
An instance of the service.
- See Also
ResolveRelativePath(string?)
Resolves the relative path provided in the path parameter to an absolute path
public string? ResolveRelativePath(string? path)
Parameters
pathstringThe path to resolve
Returns
- string
An absolute path pointing to the provided relative path
Resolve<T>(params object?[])
Gets an instance of the specified service using the plugins dependency injection container.
public T Resolve<T>(params object?[] arguments)
Parameters
argumentsobject[]Arguments to supply to the service.
Returns
- T
An instance of the service.
Type Parameters
TThe service to resolve.
- See Also
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Events
Disabled
Occurs when the plugin is disabled
public event EventHandler? Disabled
Event Type
Enabled
Occurs when the plugin is enabled
public event EventHandler? Enabled
Event Type
FeatureAdded
Occurs when an feature is loaded and added to the plugin
public event EventHandler<PluginFeatureInfoEventArgs>? FeatureAdded
Event Type
FeatureRemoved
Occurs when an feature is disabled and removed from the plugin
public event EventHandler<PluginFeatureInfoEventArgs>? FeatureRemoved