Commit changes before fixing errors.

This commit is contained in:
Developer01
2025-12-30 07:39:42 +01:00
parent 337ece3ebe
commit c7c48394d5
4 changed files with 53 additions and 54 deletions

View File

@@ -1,5 +1,4 @@
Imports System.Windows.Forms
Imports DigitalData.Controls.LookupGrid
Imports DigitalData.Modules.Logging
Namespace Modules
@@ -38,55 +37,25 @@ Namespace Modules
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
If TryGetDevExpressCheckEditValue(oControl, oReplaceValue) Then
' value already determined by helper
Else
Select Case True
Case TypeOf oControl Is TextBox
oReplaceValue = oControl.Text
' 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 TypeOf oControl Is ComboBox
oReplaceValue = oControl.Text
' Case GetType(DevExpress.XtraEditors.LookUpEdit) ' Type not found: DevExpress.XtraEditors.LookUpEdit
' Dim oLookupEdit As DevExpress.XtraEditors.LookUpEdit = oControl
Case TypeOf oControl Is CheckBox
Dim oCheckBox As CheckBox = DirectCast(oControl, CheckBox)
oReplaceValue = oCheckBox.Checked.ToString()
' 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) ' Type not found: 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
Case Else
oReplaceValue = "0"
End Select
End If
oResult = ReplacePattern(oResult, PatternIdentifier, oReplaceValue)
Else
@@ -106,3 +75,25 @@ Namespace Modules
End Class
End Namespace
Module DevExpressCheckEditCompatibility
Friend Function TryGetDevExpressCheckEditValue(control As Control, ByRef value As String) As Boolean
If control Is Nothing Then
Return False
End If
Dim controlType = control.GetType()
If controlType.FullName <> "DevExpress.XtraEditors.CheckEdit" Then
Return False
End If
Dim checkedProperty = controlType.GetProperty("Checked")
If checkedProperty Is Nothing Then
Return False
End If
Dim checkedValue = checkedProperty.GetValue(control)
value = Convert.ToString(checkedValue, Globalization.CultureInfo.InvariantCulture)
Return True
End Function
End Module

View File

@@ -1,5 +1,4 @@
Imports System.Windows.Forms
Imports DigitalData.Controls.LookupGrid
Imports DigitalData.Modules.Logging
Namespace Modules

View File

@@ -1,6 +1,4 @@
Imports System.Windows.Forms
Imports DigitalData.Controls.LookupGrid
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Logging
Namespace Modules
''' <summary>
@@ -19,14 +17,26 @@ Namespace Modules
MyBase.New(pLogConfig)
End Sub
Public Function Replace(pInput As String, pWMObject As WINDREAMLib.WMObject) As String
Public Function Replace(pInput As String, pWMObject As Object) As String
Dim oResult = pInput
Dim oCounter = 0
If pWMObject Is Nothing Then
Logger.Warn("No windream object provided for replacement.")
Return oResult
End If
Dim objectType = pWMObject.GetType()
Dim getVariableValueMethod = objectType.GetMethod("GetVariableValue")
If getVariableValueMethod Is Nothing Then
Logger.Warn("Provided object does not expose a GetVariableValue method. Skipping windream replacements.")
Return oResult
End If
While ContainsPattern(oResult, PatternIdentifier)
Try
Dim oIndexName As String = GetNextPattern(oResult, PatternIdentifier).Value
Dim oWMValue As Object = pWMObject.GetVariableValue(oIndexName)
Dim oWMValue As Object = getVariableValueMethod.Invoke(pWMObject, New Object() {oIndexName})
If oWMValue Is Nothing Then
Logger.Warn("Value for Index [{0}] is empty and will not be used for replacing. Skipping.")

View File

@@ -1,7 +1,6 @@
Imports System.IO
Imports System.Text.RegularExpressions
Imports System.Windows.Forms
Imports DigitalData.Controls.LookupGrid
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.ZooFlow
@@ -88,7 +87,7 @@ Public Class Patterns2
End Try
End Function
Public Function ReplaceWindreamValues(pInput As String, pWMObject As WMObject) As String
Public Function ReplaceWindreamValues(pInput As String, pWMObject As Object) As String
Try
Logger.Debug("Replacing Windream Values")
Dim oModule = New Modules.Windream(LogConfig)