Loading Form, center integer columns, use sequence field, simplify, fix layout

This commit is contained in:
Jonathan Jenne
2022-07-14 11:49:41 +02:00
parent a9dcf0a7ed
commit 0958e46eab
15 changed files with 663 additions and 267 deletions

79
GUIs.Monitor/Validator.vb Normal file
View File

@@ -0,0 +1,79 @@
Imports DevExpress.Utils
Imports DevExpress.Utils.VisualEffects
Imports DevExpress.XtraLayout
Imports DigitalData.GUIs.Common
Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Logging
Public Class Validator
Inherits BaseClass
Public Sub New(pLogConfig As LogConfig, pLayoutControl As LayoutControl, pAdornerUIManager As AdornerUIManager, pControlHelper As ControlHelper)
MyBase.New(pLogConfig)
Me.LayoutControl = pLayoutControl
Me.AdornerUIManager = pAdornerUIManager
Me.ControlHelper = pControlHelper
End Sub
Public ReadOnly Property LayoutControl As LayoutControl
Public ReadOnly Property AdornerUIManager As AdornerUIManager
Public ReadOnly Property ControlHelper As ControlHelper
Public Function Validate(pSearch As Search) As Boolean
With AdornerUIManager.ValidationHintProperties
.State = ValidationHintState.Invalid
.InvalidState.ShowBorder = True
.InvalidState.ShowBackgroundMode = ValidationHintBackgroundMode.Target
End With
AdornerUIManager.Hide()
AdornerUIManager.Elements.Clear()
Dim oMissingParams As Boolean = False
Dim oControls As New List(Of Control)
For Each oItem As Control In LayoutControl.Controls
Dim oParam = pSearch.Parameters.
Where(Function(param) param.PatternTitle = oItem.Name).
FirstOrDefault()
If oParam Is Nothing Then
Continue For
End If
oControls.Add(oItem)
If oParam.Required And Not ControlHelper.HasValue(oItem) Then
AdornerUIManager.Elements.Add(New ValidationHint With {
.TargetElement = oItem,
.Visible = True
})
oMissingParams = True
End If
Next
AdornerUIManager.Show()
Return oMissingParams
End Function
Public Function GetControlsWithParams(pSearch As Search) As List(Of Control)
Dim oControls As New List(Of Control)
For Each oItem As Control In LayoutControl.Controls
Dim oParam = pSearch.Parameters.
Where(Function(param) param.PatternTitle = oItem.Name).
FirstOrDefault()
If oParam Is Nothing Then
Continue For
End If
oControls.Add(oItem)
Next
Return oControls
End Function
End Class