event for ui creation

This commit is contained in:
2023-12-08 09:10:37 +01:00
parent 7b04f6592c
commit 2322c04ca3

View File

@@ -8,6 +8,13 @@ namespace Pilz.Plugins.Advanced
{ {
public abstract class PluginModule : PluginFeature public abstract class PluginModule : PluginFeature
{ {
public delegate void PluginModuleUIEventHandler(PluginModule module, PluginModuleUI ui);
/// <summary>
/// Fires when a <see cref="PluginModuleUI"/> instance has been created.
/// </summary>
public static event PluginModuleUIEventHandler? OnUICreated;
public bool Visible { get; set; } = true; public bool Visible { get; set; } = true;
public bool AllowEmbedding { get; set; } = true; public bool AllowEmbedding { get; set; } = true;
@@ -26,7 +33,9 @@ namespace Pilz.Plugins.Advanced
public virtual PluginModuleUI CreateUI() public virtual PluginModuleUI CreateUI()
{ {
return CreateNewUI(); var ui = CreateNewUI();
OnUICreated?.Invoke(this, ui);
return ui;
} }
protected abstract PluginModuleUI CreateNewUI(); protected abstract PluginModuleUI CreateNewUI();