40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using Pilz.UI.Telerik;
|
|
using Pilz.UI.Telerik.Dialogs;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using Telerik.WinControls;
|
|
|
|
namespace Pilz.Plugins.Advanced
|
|
{
|
|
public abstract class PluginModule
|
|
{
|
|
public string Type { get; init; }
|
|
public string Name { get; init; }
|
|
public RadSvgImage? Icon { get; set; }
|
|
public bool Visible { get; set; } = true;
|
|
public bool RequiresRomManager { get; set; } = true;
|
|
public bool AllowEmbedding { get; set; } = true;
|
|
|
|
protected PluginModule(string moduleType, string moduleName)
|
|
{
|
|
Type = moduleType;
|
|
Name = moduleName;
|
|
}
|
|
|
|
public virtual void ShowUI()
|
|
{
|
|
if (CreateNewUI() is PluginModuleUI ui)
|
|
{
|
|
ui.BackColor = Color.Transparent;
|
|
DialogBaseForm.Show(ui, Name, Icon!.ToImage().ToIcon()!);
|
|
}
|
|
}
|
|
|
|
public PluginModuleUI CreateUI()
|
|
{
|
|
return CreateNewUI();
|
|
}
|
|
|
|
protected abstract PluginModuleUI CreateNewUI();
|
|
}
|
|
} |