check if feature enabled
This commit is contained in:
@@ -124,7 +124,7 @@ public static class Extensions
|
||||
|
||||
private static void RadMenuItem_RMMethod_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is RadMenuItem item)
|
||||
if (sender is RadMenuItem item && item.Enabled)
|
||||
{
|
||||
if (item.Tag is RadPluginModule radmodule)
|
||||
radmodule.ShowUI();
|
||||
@@ -135,7 +135,7 @@ public static class Extensions
|
||||
|
||||
private static void RadMenuItem_RMFunction_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is RadMenuItem item && item.Tag is PluginFunction function)
|
||||
if (sender is RadMenuItem item && item.Tag is PluginFunction function && function.Enabled)
|
||||
function.Execute();
|
||||
}
|
||||
}
|
||||
24
Pilz.Plugins.Advanced/Extensions.cs
Normal file
24
Pilz.Plugins.Advanced/Extensions.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace Pilz.Plugins.Advanced;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
public static T? Execute<T>(this PluginFunction @this, params object?[]? @params)
|
||||
{
|
||||
return @this.Enabled ? @this.Execute<T>(@params) : default;
|
||||
}
|
||||
|
||||
public static object? Execute(this PluginFunction @this, params object?[]? @params)
|
||||
{
|
||||
return @this.Enabled ? @this.Execute(@params) : default;
|
||||
}
|
||||
|
||||
public static T? Execute<T>(this PluginFunction @this, PluginFunctionSimpleParamter? @params)
|
||||
{
|
||||
return @this.Enabled ? @this.Execute<T>(@params) : default;
|
||||
}
|
||||
|
||||
public static object? Execute(this PluginFunction @this, PluginFunctionParameter? @params)
|
||||
{
|
||||
return @this.Enabled ? @this.Execute(@params) : default;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user