move clientsuite to GUIs.ClientSuite folder

This commit is contained in:
Jonathan Jenne
2019-04-15 14:30:00 +02:00
parent b4151e8b81
commit ddec69bc05
124 changed files with 8 additions and 6 deletions

View File

@@ -0,0 +1,40 @@
''' <summary>
''' Applies Modifications to a certain type of controls
''' </summary>
''' <example>
''' Dim oGridPatcher = New ClassControlPatcher(Of GridControl)(Me)
''' oGridPatcher.
''' ProcessContainer(AddressOf ClassGridControl.DefaultGridSettings).
''' ProcessContainer(AddressOf ClassGridControl.ReadOnlyGridSettings).
''' ProcessControl(AddressOf ClassGridControl.CheckboxSelectGridSettings, GridNotAssignedToParent).
''' ProcessControl(AddressOf ClassGridControl.CheckboxSelectGridSettings, GridAssignedToParent)
''' </example>
''' <typeparam name="T">The control to Patch</typeparam>
Public Class ClassControlPatcher(Of T As Control)
Private ReadOnly _Container As Control
Public Sub New(Container As Control)
_Container = Container
End Sub
Public Function ProcessContainer(Action As Action(Of T, Control)) As ClassControlPatcher(Of T)
Return ProcessContainer(_Container, Action)
End Function
Public Function ProcessControl(Action As Action(Of T, Control), ByVal Control As Control) As ClassControlPatcher(Of T)
Action(Control, _Container)
Return Me
End Function
Private Function ProcessContainer(ByVal Container As Control, Action As Action(Of T, Control)) As ClassControlPatcher(Of T)
For Each oControl As Control In Container.Controls
If oControl.[GetType]() = GetType(T) Then
Action(oControl, Container)
Else
ProcessContainer(oControl, Action)
End If
Next
Return Me
End Function
End Class