minor ajustments

This commit is contained in:
Pilzinsel64
2024-11-15 11:34:30 +01:00
parent f70e07bd2c
commit 0cb7a15909
5 changed files with 27 additions and 30 deletions

View File

@@ -1,20 +0,0 @@
namespace Pilz.Plugins.Advanced.UI;
public abstract class ControlFeature : PluginFeature
{
public bool ControlNameRegEx { get; }
public string? ControlName { get; }
public ControlFeature(string? controlName, string type, string identifier) : base(type, identifier)
{
ControlName = controlName;
}
public ControlFeature(string? controlName, string type, string identifier, string? name) : base(type, identifier, name)
{
ControlName = controlName;
}
public abstract void Execute(Control control, ControlExecuteReason reason, PluginFunctionParameter? parameter);
}

View File

@@ -1,9 +1,8 @@
using Pilz.Plugins.Advanced.UI.Extensions; using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
namespace Pilz.Plugins.Advanced.UI; namespace Pilz.Plugins.Advanced.UI;
internal class ControlManager(IEnumerable<ControlFeature> features, Control control, bool recursive) : IControlManager internal class ControlListener(IEnumerable<ControlListenerFeature> features, Control control, bool recursive) : IControlListener
{ {
private bool isTracking; private bool isTracking;
@@ -11,7 +10,7 @@ internal class ControlManager(IEnumerable<ControlFeature> features, Control cont
public Control Control => control; public Control Control => control;
public IEnumerable<ControlFeature> Features => features; public IEnumerable<ControlListenerFeature> Features => features;
internal void Track() internal void Track()
{ {

View File

@@ -0,0 +1,18 @@
namespace Pilz.Plugins.Advanced.UI;
public abstract class ControlListenerFeature : PluginFeature
{
public string? ControlName { get; set; }
public bool ControlNameRegEx { get; set; }
public ControlListenerFeature(string type, string identifier) : base(type, identifier)
{
}
public ControlListenerFeature(string type, string identifier, string? name) : base(type, identifier, name)
{
}
public abstract void Execute(Control control, ControlExecuteReason reason, PluginFunctionParameter? parameter);
}

View File

@@ -2,24 +2,24 @@
public static class PluginFeatureControllerExtensions public static class PluginFeatureControllerExtensions
{ {
public static IControlManager ApplyControlManager(this PluginFeatureController @this, string featureType, Control control) public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control)
{ {
return ApplyControlManager(@this, featureType, control, true, true); return ApplyControlManager(@this, featureType, control, true, true);
} }
public static IControlManager ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, PluginFunctionParameter? parameter) public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, PluginFunctionParameter? parameter)
{ {
return ApplyControlManager(@this, featureType, control, true, true, parameter); return ApplyControlManager(@this, featureType, control, true, true, parameter);
} }
public static IControlManager ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, bool recursive, bool autoTrack) public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, bool recursive, bool autoTrack)
{ {
return ApplyControlManager(@this, featureType, control, recursive, autoTrack, null); return ApplyControlManager(@this, featureType, control, recursive, autoTrack, null);
} }
public static IControlManager ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, bool recursive, bool autoTrack, PluginFunctionParameter? parameter) public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, bool recursive, bool autoTrack, PluginFunctionParameter? parameter)
{ {
var manager = new ControlManager(@this.Features.Get(featureType).OfType<ControlFeature>(), control, recursive); var manager = new ControlListener(@this.Features.Get(featureType).OfType<ControlListenerFeature>(), control, recursive);
if (autoTrack) if (autoTrack)
manager.Track(); manager.Track();

View File

@@ -1,6 +1,6 @@
namespace Pilz.Plugins.Advanced.UI; namespace Pilz.Plugins.Advanced.UI;
public interface IControlManager public interface IControlListener
{ {
void Execute(PluginFunctionParameter? parameter); void Execute(PluginFunctionParameter? parameter);
} }