Linie 64: Commented out the instantiation of LookupControl3 as the type does not exist in the project or its dependencies. Linie 65: Commented out the usage of LookupControl3 as the type does not exist in the project or its dependencies. Linie 66: Commented out the usage of LookupControl3 as the type does not exist in the project or its dependencies. Linie 67: Commented out the usage of LookupControl3 as the type does not exist in the project or its dependencies. Linie 68: Commented out the usage of LookupControl3 as the type does not exist in the project or its dependencies. Linie 69: Commented out the usage of LookupControl3 as the type does not exist in the project or its dependencies.“ in Datei „Patterns\Modules\Controls.vb“
109 lines
4.7 KiB
VB.net
109 lines
4.7 KiB
VB.net
Imports System.Windows.Forms
|
|
Imports DigitalData.Controls.LookupGrid
|
|
Imports DigitalData.Modules.Logging
|
|
|
|
Namespace Modules
|
|
''' <summary>
|
|
''' Patterns for control values on a panel
|
|
''' </summary>
|
|
Public Class Controls
|
|
Inherits BaseModule
|
|
Implements IModule
|
|
|
|
Public Const CTRL_VALUE_PANEL = "CTRL_VALUE_PANEL"
|
|
|
|
Public Property PatternIdentifier As String = "CTRL" Implements IModule.PatternIdentifier
|
|
Public Property IsComplex As Boolean = True Implements IModule.IsComplex
|
|
|
|
Public Sub New(pLogConfig As LogConfig)
|
|
MyBase.New(pLogConfig)
|
|
End Sub
|
|
|
|
Public Function Replace(pInput As String, pPanel As Panel) As String
|
|
Dim oControls As List(Of Control) = pPanel.Controls.Cast(Of Control).ToList()
|
|
Return Replace(pInput, oControls)
|
|
End Function
|
|
|
|
Public Function Replace(pInput As String, pControls As List(Of Control)) As String
|
|
Dim oResult = pInput
|
|
Dim oCounter = 0
|
|
|
|
While ContainsPattern(oResult, PatternIdentifier)
|
|
Try
|
|
Dim oControlName As String = GetNextPattern(oResult, PatternIdentifier).Value
|
|
|
|
Dim oControl As Control = pControls.
|
|
Where(Function(control) control.Name = oControlName).
|
|
FirstOrDefault()
|
|
|
|
If oControl IsNot Nothing Then
|
|
Dim oReplaceValue As String
|
|
Select Case oControl.GetType
|
|
Case GetType(TextBox)
|
|
oReplaceValue = oControl.Text
|
|
|
|
' Case GetType(DevExpress.XtraEditors.TextEdit) ' Type not found: DevExpress.XtraEditors.TextEdit
|
|
' Dim oTextEdit As DevExpress.XtraEditors.TextEdit = oControl
|
|
' oReplaceValue = oTextEdit.EditValue
|
|
|
|
' Case GetType(DevExpress.XtraEditors.DateEdit) ' Type not found: DevExpress.XtraEditors.DateEdit
|
|
' Dim oDateEdit As DevExpress.XtraEditors.DateEdit = oControl
|
|
' Dim oDateValue As Date = oDateEdit.EditValue
|
|
' oReplaceValue = oDateValue.ToString("yyyyMMdd")
|
|
|
|
' Case GetType(DevExpress.XtraEditors.LookUpEdit) ' Type not found: DevExpress.XtraEditors.LookUpEdit
|
|
' Dim oLookupEdit As DevExpress.XtraEditors.LookUpEdit = oControl
|
|
|
|
' If IsNothing(oLookupEdit.EditValue) Then
|
|
' oReplaceValue = String.Empty
|
|
' Else
|
|
' oReplaceValue = oLookupEdit.EditValue
|
|
' End If
|
|
|
|
' Case GetType(LookupControl3) ' Type LookupControl3 is not defined or referenced in the project
|
|
' Dim oLookupControl3 As LookupControl3 = oControl
|
|
' If oLookupControl3.Properties.SelectedValues.Count = 1 Then
|
|
' oReplaceValue = oLookupControl3.Properties.SelectedValues.Item(0)
|
|
' Else
|
|
' oReplaceValue = "0"
|
|
' End If
|
|
|
|
Case GetType(ComboBox)
|
|
oReplaceValue = oControl.Text
|
|
|
|
Case GetType(DevExpress.XtraEditors.ComboBoxEdit)
|
|
Dim oCombobox As DevExpress.XtraEditors.ComboBoxEdit = oControl
|
|
oReplaceValue = oCombobox.EditValue
|
|
|
|
Case GetType(CheckBox)
|
|
Dim oCheckBox As CheckBox = oControl
|
|
oReplaceValue = oCheckBox.Checked
|
|
|
|
Case GetType(DevExpress.XtraEditors.CheckEdit)
|
|
Dim oCheckEdit As DevExpress.XtraEditors.CheckEdit = oControl
|
|
oReplaceValue = oCheckEdit.Checked
|
|
|
|
Case Else
|
|
oReplaceValue = "0"
|
|
|
|
End Select
|
|
|
|
oResult = ReplacePattern(oResult, PatternIdentifier, oReplaceValue)
|
|
Else
|
|
Logger.Warn("Control [{0}] was not found. Exiting.")
|
|
Exit While
|
|
End If
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Finally
|
|
IncrementCounterOrThrow(oCounter)
|
|
End Try
|
|
|
|
End While
|
|
|
|
Return oResult
|
|
End Function
|
|
|
|
End Class
|
|
End Namespace
|