add control manager for plugins
This commit is contained in:
@@ -2,29 +2,30 @@
|
||||
|
||||
public static class PluginFeatureControllerExtensions
|
||||
{
|
||||
public static ControlManager ApplyControlManager(this PluginFeatureController @this, Control control)
|
||||
public static IControlManager ApplyControlManager(this PluginFeatureController @this, string featureType, Control control)
|
||||
{
|
||||
return ApplyControlManager(@this, control, true, true);
|
||||
return ApplyControlManager(@this, featureType, control, true, true);
|
||||
}
|
||||
|
||||
public static ControlManager ApplyControlManager(this PluginFeatureController @this, Control control, bool recursive, bool autoTrack)
|
||||
public static IControlManager ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, PluginFunctionParameter? parameter)
|
||||
{
|
||||
var manager = new ControlManager(@this, autoTrack);
|
||||
goThrow(control);
|
||||
return ApplyControlManager(@this, featureType, control, true, true, parameter);
|
||||
}
|
||||
|
||||
public static IControlManager ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, bool recursive, bool autoTrack)
|
||||
{
|
||||
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)
|
||||
{
|
||||
var manager = new ControlManager(@this.Features.Get(featureType).OfType<ControlFeature>(), control, recursive);
|
||||
|
||||
if (autoTrack)
|
||||
manager.Track();
|
||||
|
||||
manager.Initialize(parameter);
|
||||
|
||||
return manager;
|
||||
|
||||
void goThrow(Control control)
|
||||
{
|
||||
manager.RegisterControl(control);
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
foreach (var child in control.Controls)
|
||||
{
|
||||
if (child is Control childControl)
|
||||
goThrow(childControl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user