version bump
This commit is contained in:
18
Pilz.Plugins.Advanced.UI/ControlFeature.cs
Normal file
18
Pilz.Plugins.Advanced.UI/ControlFeature.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace Pilz.Plugins.Advanced.UI;
|
||||
|
||||
public abstract class ControlFeature : PluginFeature
|
||||
{
|
||||
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, PluginFunctionParameter? parameter);
|
||||
}
|
||||
17
Pilz.Plugins.Advanced.UI/ControlManager.cs
Normal file
17
Pilz.Plugins.Advanced.UI/ControlManager.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Pilz.Plugins.Advanced.UI;
|
||||
|
||||
public class ControlManager(PluginFeatureController controller, bool autoTrack)
|
||||
{
|
||||
public PluginFeatureController Controller => controller;
|
||||
public bool AutoTrack => autoTrack;
|
||||
|
||||
public void RegisterControl(Control control)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Execute(object mode)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Pilz.Plugins.Advanced.UI.Extensions;
|
||||
|
||||
public static class ControlFeatureCollectoinExtensions
|
||||
{
|
||||
public static void ExecuteControlFeatures(this IEnumerable<ControlFeature> @this, Control control, bool recursive, PluginFunctionParameter? parameter)
|
||||
{
|
||||
if (control.Name is string name)
|
||||
{
|
||||
foreach (var feature in @this)
|
||||
{
|
||||
if (feature.ControlName is null || feature.ControlName.Equals(control.Name))
|
||||
feature.Execute(control, parameter);
|
||||
}
|
||||
}
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
foreach (var child in control.Controls)
|
||||
{
|
||||
if (child is Control childControl)
|
||||
ExecuteControlFeatures(@this, childControl, true, parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
namespace Pilz.Plugins.Advanced.UI.Extensions;
|
||||
|
||||
public static class PluginFeatureControllerExtensions
|
||||
{
|
||||
public static ControlManager ApplyControlManager(this PluginFeatureController @this, Control control)
|
||||
{
|
||||
return ApplyControlManager(@this, control, true, true);
|
||||
}
|
||||
|
||||
public static ControlManager ApplyControlManager(this PluginFeatureController @this, Control control, bool recursive, bool autoTrack)
|
||||
{
|
||||
var manager = new ControlManager(@this, autoTrack);
|
||||
goThrow(control);
|
||||
return manager;
|
||||
|
||||
void goThrow(Control control)
|
||||
{
|
||||
manager.RegisterControl(control);
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
foreach (var child in control.Controls)
|
||||
{
|
||||
if (child is Control childControl)
|
||||
goThrow(childControl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>annotations</Nullable>
|
||||
<Version>2.2.0</Version>
|
||||
<Version>2.3.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user