change UI to UI.WinForms
This commit is contained in:
52
Pilz.Plugins.Advanced.UI.WinForms/PluginModule{T}.cs
Normal file
52
Pilz.Plugins.Advanced.UI.WinForms/PluginModule{T}.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||
|
||||
public abstract class PluginModule<TPluginModuleUI> : PluginModuleBase where TPluginModuleUI : Control
|
||||
{
|
||||
public bool Visible { get; set; } = true;
|
||||
public bool AllowEmbedding { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper for the <see cref="PluginFeature.Icon"/> property to directly use it as <see cref="System.Drawing.Image"/>.
|
||||
/// </summary>
|
||||
public Image? Image
|
||||
{
|
||||
get => base.Icon as Image;
|
||||
set => base.Icon = value;
|
||||
}
|
||||
|
||||
protected PluginModule(string type, string identifier) : base(type, identifier)
|
||||
{
|
||||
}
|
||||
|
||||
protected PluginModule(string type, string identifier, string? name) : base(type, identifier, name)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void ShowUI()
|
||||
{
|
||||
ShowUI(null);
|
||||
}
|
||||
|
||||
public virtual void ShowUI(PluginFunctionParameter? @params)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual TPluginModuleUI? CreateUI()
|
||||
{
|
||||
return CreateUI(null);
|
||||
}
|
||||
|
||||
public virtual TPluginModuleUI? CreateUI(PluginFunctionParameter? @params)
|
||||
{
|
||||
object? ui = default;
|
||||
|
||||
if (OnPreExecute(@params, ref ui))
|
||||
ui = CreateNewUI(@params);
|
||||
|
||||
OnPostExecute(@params, ref ui);
|
||||
|
||||
return ui as TPluginModuleUI;
|
||||
}
|
||||
|
||||
protected abstract TPluginModuleUI? CreateNewUI(PluginFunctionParameter? @params);
|
||||
}
|
||||
Reference in New Issue
Block a user