plugin feature events
This commit is contained in:
@@ -9,6 +9,18 @@ namespace Pilz.Plugins.Advanced
|
||||
{
|
||||
public sealed class PluginFeatureController
|
||||
{
|
||||
public delegate void PluginFeatureEventHandler(PluginFeatureController controller, PluginFeature feature);
|
||||
|
||||
/// <summary>
|
||||
/// Fires when a new <see cref="PluginFeature"/> has been registred.
|
||||
/// </summary>
|
||||
public static event PluginFeatureEventHandler? OnPluginFeatureReistred;
|
||||
|
||||
/// <summary>
|
||||
/// Fires when a <see cref="PluginFeature"/> has been unregistred.
|
||||
/// </summary>
|
||||
public static event PluginFeatureEventHandler? OnPluginFeatureUnregistred;
|
||||
|
||||
/// <summary>
|
||||
/// The default public instance that can be used by plugins and the interface providing software.
|
||||
/// </summary>
|
||||
@@ -41,12 +53,16 @@ namespace Pilz.Plugins.Advanced
|
||||
public void Register(PluginFeature module)
|
||||
{
|
||||
if (!features.Contains(module))
|
||||
{
|
||||
features.Add(module);
|
||||
OnPluginFeatureReistred?.Invoke(this, module);
|
||||
}
|
||||
}
|
||||
|
||||
public void Unregister(PluginFeature module)
|
||||
{
|
||||
features.Remove(module);
|
||||
OnPluginFeatureUnregistred?.Invoke(this, module);
|
||||
}
|
||||
|
||||
public class FeatureController
|
||||
|
||||
Reference in New Issue
Block a user