aa367c4345
- Passaggio a lettura intestazione file DDF per avere i parametri dei componenti.
498 lines
25 KiB
VB.net
498 lines
25 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.IO
|
|
Imports EgtUILib
|
|
Imports System.Text.RegularExpressions
|
|
|
|
Friend Module DdfFile
|
|
|
|
Friend m_Door As New Door
|
|
Private FileContent As String()
|
|
|
|
Friend CompoListOrder As New List(Of String)({"vision_cut_outs", "louver_cut_outs", "mail_slots", "viewers", "flush_pulls", "hinges", "locks", "flush_bolts", "edge_pulls", "roller_latchs", "pivots", "stops_and_closers", "oh_stop_close"})
|
|
|
|
#Region "LETTURA DDF"
|
|
|
|
' Leggo e stampo a video
|
|
Public Sub ReadDDF(sPath As String, ByRef ReadDoor As Door)
|
|
m_Door = ReadDoor
|
|
' restituisce un problema nella lettura di un valore della compo
|
|
Dim InvalidValue As String = String.Empty
|
|
If Not File.Exists(sPath) Then Return
|
|
FileContent = File.ReadAllLines(sPath)
|
|
If FileContent.Count = 0 Then
|
|
MessageBox.Show("Empty file", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
|
|
For LineIndex As Integer = 0 To FileContent.Count - 1
|
|
' size
|
|
If SearchKey(FileContent(LineIndex), K_SIZE) Then
|
|
LineIndex = GetSize(LineIndex + 1)
|
|
If LineIndex = -1 Then
|
|
InvalidValue += EgtMsg(50102) + K_SIZE + vbCrLf
|
|
Exit For
|
|
End If
|
|
End If
|
|
' swing
|
|
If SearchKey(FileContent(LineIndex), K_SWING) Then
|
|
LineIndex = GetSwing(LineIndex)
|
|
If LineIndex = -1 Then
|
|
InvalidValue += EgtMsg(50102) + K_SWING + vbCrLf
|
|
Exit For
|
|
End If
|
|
End If
|
|
' profiles
|
|
If SearchKey(FileContent(LineIndex), K_PROFILES) Then
|
|
LineIndex = GetProfiles(LineIndex + 1)
|
|
If LineIndex = -1 Then
|
|
InvalidValue += EgtMsg(50102) + K_PROFILES + vbCrLf
|
|
Exit For
|
|
End If
|
|
End If
|
|
' Compo
|
|
If Not String.IsNullOrWhiteSpace(SearchName(FileContent(LineIndex))) Then
|
|
Dim CompoNameDDF = SearchName(FileContent(LineIndex))
|
|
If Not String.IsNullOrWhiteSpace(CompoNameDDF) Then
|
|
LineIndex = GetNewCompo(LineIndex + 1, CompoNameDDF, InvalidValue)
|
|
End If
|
|
End If
|
|
Next
|
|
If Not String.IsNullOrWhiteSpace(InvalidValue) Then
|
|
MessageBox.Show(InvalidValue, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
End Sub
|
|
|
|
' restituisce il valore della stringa che precede i due punti
|
|
Friend Function SearchName(sLine As String) As String
|
|
Return Regex.Match(sLine, "\s*(.*?\b)\s*:.*").Groups(1).Value
|
|
End Function
|
|
|
|
' Cerca la stringa con il trattino
|
|
Friend Function SearchScore(sLine As String) As Boolean
|
|
If Regex.Match(sLine, "\s*(-).*$").Groups(1).Value = "-" Then Return True
|
|
Return False
|
|
End Function
|
|
|
|
' restituisce il nome compreso tra il trattino meno e i due punti
|
|
Friend Function SearchTemplate(sLine As String) As String
|
|
Return Regex.Match(sLine, "\s*-*\s*(.*?\b)\s*:.*$").Groups(1).Value
|
|
End Function
|
|
|
|
' restituisce la stringa dopo i due punti
|
|
Friend Function SearchKeyValue(sLine As String, sKey As String) As String
|
|
Return Regex.Match(sLine, "\s*-*\s*" & sKey & "\s*:\s*(.*?\b)\s*$").Groups(1).Value
|
|
End Function
|
|
|
|
' cerca il nome che precede i due punti
|
|
Friend Function SearchKey(sLine As String, sKey As String) As Boolean
|
|
If Not Regex.Match(sLine, "\s*(" & sKey & ")\s*:.*$").Groups(1).Value = sKey Then Return False
|
|
Return True
|
|
End Function
|
|
|
|
' carico valori di Size
|
|
Public Function GetSize(Index As Integer) As Integer
|
|
Dim Width As String = SearchKeyValue(FileContent(Index), K_WIDTH)
|
|
If String.IsNullOrWhiteSpace(Width) Then
|
|
If Not SearchKey(FileContent(Index), K_LOCKEDGE) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.Width = Width
|
|
Index += 1
|
|
End If
|
|
Dim Height As String = SearchKeyValue(FileContent(Index), K_HEIGHT)
|
|
If String.IsNullOrWhiteSpace(Height) Then
|
|
If Not SearchKey(FileContent(Index), K_HEIGHT) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.Height = Height
|
|
Index += 1
|
|
End If
|
|
Dim Thickness As String = SearchKeyValue(FileContent(Index), K_THICKNESS)
|
|
If String.IsNullOrWhiteSpace(Thickness) Then
|
|
If Not SearchKey(FileContent(Index), K_THICKNESS) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.Thickness = Thickness
|
|
Index += 1
|
|
End If
|
|
Return Index
|
|
End Function
|
|
|
|
' carico valori swing
|
|
Public Function GetSwing(Index As Integer) As Integer
|
|
Dim Swing As String = SearchKeyValue(FileContent(Index), K_SWING)
|
|
If String.IsNullOrWhiteSpace(Swing) Then
|
|
If Not SearchKey(FileContent(Index), K_SWING) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.Swing = Swing
|
|
Index += 1
|
|
End If
|
|
Return Index
|
|
End Function
|
|
|
|
' carico valori profiles
|
|
Public Function GetProfiles(Index As Integer) As Integer
|
|
Dim ReadingError As String = String.Empty
|
|
' Lock
|
|
Dim LockEdgeType As String = SearchKeyValue(FileContent(Index), K_LOCKEDGE)
|
|
If String.IsNullOrWhiteSpace(LockEdgeType) Then
|
|
If Not SearchKey(FileContent(Index), K_LOCKEDGE) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.LockEdgeType = LockEdgeType
|
|
Index += 1
|
|
End If
|
|
Dim LockEdgeMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
|
|
If String.IsNullOrWhiteSpace(LockEdgeMachining) Then
|
|
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.LockEdgeMachining = Utility.ConvertOnOffToBoolean(LockEdgeMachining)
|
|
Index += 1
|
|
End If
|
|
Dim LockEdgeOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL)
|
|
If String.IsNullOrWhiteSpace(LockEdgeOverMaterial) Then
|
|
If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.LockEdgeOverMaterial = LockEdgeOverMaterial
|
|
Index += 1
|
|
End If
|
|
|
|
' Hinge
|
|
Dim HingeEdgeType As String = SearchKeyValue(FileContent(Index), K_HINGEEDGE)
|
|
If String.IsNullOrWhiteSpace(HingeEdgeType) Then
|
|
If Not SearchKey(FileContent(Index), K_HINGEEDGE) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.HingeEdgeType = HingeEdgeType
|
|
Index += 1
|
|
End If
|
|
Dim HingeEdgeMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
|
|
If String.IsNullOrWhiteSpace(HingeEdgeMachining) Then
|
|
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.HingeEdgeMachining = ConvertOnOffToBoolean(HingeEdgeMachining)
|
|
Index += 1
|
|
End If
|
|
Dim HingeEdgeOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL)
|
|
If String.IsNullOrWhiteSpace(HingeEdgeOverMaterial) Then
|
|
If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.HingeEdgeOverMaterial = HingeEdgeOverMaterial
|
|
Index += 1
|
|
End If
|
|
|
|
' Top
|
|
Dim TopType As String = SearchKeyValue(FileContent(Index), K_TOP)
|
|
If String.IsNullOrWhiteSpace(TopType) Then
|
|
If Not SearchKey(FileContent(Index), K_TOP) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.TopType = TopType
|
|
Index += 1
|
|
End If
|
|
Dim TopMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
|
|
If String.IsNullOrWhiteSpace(TopMachining) Then
|
|
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.TopMachining = ConvertOnOffToBoolean(TopMachining)
|
|
Index += 1
|
|
End If
|
|
Dim TopOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL)
|
|
If String.IsNullOrWhiteSpace(TopOverMaterial) Then
|
|
If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.TopOverMaterial = TopOverMaterial
|
|
Index += 1
|
|
End If
|
|
|
|
' Bottom
|
|
Dim BottomType As String = SearchKeyValue(FileContent(Index), K_BOTTOM)
|
|
If String.IsNullOrWhiteSpace(BottomType) Then
|
|
If Not SearchKey(FileContent(Index), K_BOTTOM) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.BottomType = BottomType
|
|
Index += 1
|
|
End If
|
|
|
|
Dim BottomMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
|
|
If String.IsNullOrWhiteSpace(BottomMachining) Then
|
|
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.BottomMachining = ConvertOnOffToBoolean(BottomMachining)
|
|
Index += 1
|
|
End If
|
|
|
|
Dim BottomOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL)
|
|
If String.IsNullOrWhiteSpace(BottomOverMaterial) Then
|
|
If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1
|
|
Index += 1
|
|
Else
|
|
m_Door.BottomOverMaterial = BottomOverMaterial
|
|
Index += 1
|
|
End If
|
|
|
|
Return Index
|
|
End Function
|
|
|
|
' ricerco la compo nella lista dei compobtn
|
|
Public Function GetNewCompo(Index As Integer, CompoNameDDF As String, ByRef InvalidValue As String) As Integer
|
|
Dim bCompo As Boolean = False
|
|
Dim ErrorRow As String = String.Empty
|
|
For CompoListIndex = 0 To CompoPanelViewModel.CompoBtnList.Count() - 1
|
|
If CompoPanelViewModel.CompoBtnList(CompoListIndex).DDFCompoName = CompoNameDDF Then
|
|
Dim NewCompoIndex As Integer = -1
|
|
While Index < FileContent.Count AndAlso Not String.IsNullOrWhiteSpace(FileContent(Index))
|
|
bCompo = True
|
|
If SearchScore(FileContent(Index)) Then
|
|
' Aggiungo la compo alla lista se trovo il trattino e restituisco l'indice associato alla lista
|
|
NewCompoIndex = m_Door.AddNewCompo(S_COMPO & CompoListIndex + 1)
|
|
End If
|
|
If NewCompoIndex <> -1 Then
|
|
Dim ReadValue As String = SearchKeyValue(FileContent(Index), SearchTemplate(FileContent(Index)))
|
|
Select Case SearchTemplate(FileContent(Index))
|
|
Case m_Door.CompoList(NewCompoIndex).ComboBox1DDFName
|
|
' se la lista è stata inserita manualmente allora esiste una listDDF
|
|
If m_Door.CompoList(NewCompoIndex).ComboBox1ListDDF.Count > 0 AndAlso m_Door.CompoList(NewCompoIndex).ComboBox1ListDDF.Contains(ReadValue) Then
|
|
Dim nSelIndex As Integer = m_Door.CompoList(NewCompoIndex).ComboBox1ListDDF.IndexOf(ReadValue)
|
|
m_Door.CompoList(NewCompoIndex).ComboBox1SelItem = m_Door.CompoList(NewCompoIndex).ComboBox1List(nSelIndex)
|
|
' se la lista è caricata da una directoru allora non esiste la listDDF
|
|
ElseIf m_Door.CompoList(NewCompoIndex).ComboBox1List.Contains(ReadValue) Then
|
|
m_Door.CompoList(NewCompoIndex).ComboBox1SelItem = ReadValue
|
|
Else
|
|
' se il vaolore inserito non esiste allora scrivo una riga di errore
|
|
InvalidValue += EgtMsg(50105) + " " + CStr(Index) + " " + vbCrLf + EgtMsg(50103) + ": " + ReadValue + vbCrLf
|
|
End If
|
|
Case m_Door.CompoList(NewCompoIndex).ComboBox2DDFName
|
|
If m_Door.CompoList(NewCompoIndex).ComboBox2ListDDF.Count > 0 AndAlso m_Door.CompoList(NewCompoIndex).ComboBox2ListDDF.Contains(ReadValue) Then
|
|
Dim nSelIndex As Integer = m_Door.CompoList(NewCompoIndex).ComboBox2ListDDF.IndexOf(ReadValue)
|
|
m_Door.CompoList(NewCompoIndex).ComboBox2SelItem = m_Door.CompoList(NewCompoIndex).ComboBox2List(nSelIndex)
|
|
ElseIf m_Door.CompoList(NewCompoIndex).ComboBox2List.Contains(ReadValue) Then
|
|
m_Door.CompoList(NewCompoIndex).ComboBox2SelItem = ReadValue
|
|
Else
|
|
InvalidValue += EgtMsg(50105) + " " + CStr(Index) + " " + vbCrLf + EgtMsg(50103) + ": " + ReadValue + vbCrLf
|
|
End If
|
|
Case m_Door.CompoList(NewCompoIndex).ComboBox3DDFName
|
|
If m_Door.CompoList(NewCompoIndex).ComboBox3ListDDF.Count > 0 AndAlso m_Door.CompoList(NewCompoIndex).ComboBox3ListDDF.Contains(ReadValue) Then
|
|
Dim nSelIndex As Integer = m_Door.CompoList(NewCompoIndex).ComboBox3ListDDF.IndexOf(ReadValue)
|
|
m_Door.CompoList(NewCompoIndex).ComboBox3SelItem = m_Door.CompoList(NewCompoIndex).ComboBox3List(nSelIndex)
|
|
ElseIf m_Door.CompoList(NewCompoIndex).ComboBox3List.Contains(ReadValue) Then
|
|
m_Door.CompoList(NewCompoIndex).ComboBox3SelItem = ReadValue
|
|
Else
|
|
InvalidValue += EgtMsg(50105) + " " + CStr(Index) + " " + vbCrLf + EgtMsg(50103) + ": " + ReadValue + vbCrLf
|
|
End If
|
|
Case m_Door.CompoList(NewCompoIndex).TextBox1DDFName
|
|
m_Door.CompoList(NewCompoIndex).TextBox1Value = ReadValue
|
|
Case m_Door.CompoList(NewCompoIndex).TextBox2DDFName
|
|
m_Door.CompoList(NewCompoIndex).TextBox2Value = ReadValue
|
|
Case m_Door.CompoList(NewCompoIndex).TextBox3DDFName
|
|
m_Door.CompoList(NewCompoIndex).TextBox3Value = ReadValue
|
|
Case m_Door.CompoList(NewCompoIndex).TextBox4DDFName
|
|
m_Door.CompoList(NewCompoIndex).TextBox4Value = ReadValue
|
|
Case m_Door.CompoList(NewCompoIndex).TextBox5DDFName
|
|
m_Door.CompoList(NewCompoIndex).TextBox5Value = ReadValue
|
|
Case m_Door.CompoList(NewCompoIndex).SpecialTextBox1DDFName
|
|
m_Door.CompoList(NewCompoIndex).SpecialTextBox1Value = ReadValue
|
|
End Select
|
|
End If
|
|
Index += 1
|
|
End While
|
|
Exit For
|
|
End If
|
|
Next
|
|
If Not bCompo Then
|
|
' salta la lettura di tutte le righe che seguono fino al primo spazio vuoto
|
|
ErrorRow += CStr(Index)
|
|
Index -= 1
|
|
While Index < FileContent.Length AndAlso Not String.IsNullOrWhiteSpace(FileContent(Index))
|
|
Dim x As String = FileContent(Index)
|
|
Index += 1
|
|
x = FileContent(Index)
|
|
End While
|
|
InvalidValue += EgtMsg(50104) + ": " + ErrorRow + "-" + CStr(Index + 1) + Environment.NewLine
|
|
End If
|
|
|
|
Return Index
|
|
End Function
|
|
|
|
|
|
#End Region ' Lettura ddf
|
|
|
|
#Region "SCRITTURA DDF"
|
|
|
|
'genero le stringhe che dovranno essere scritte nel DDF
|
|
Friend Sub WriteDDF(Door As Door, sPath As String)
|
|
' pulisco lista prima di iniziare a scrivere
|
|
Dim DdfFileContent As New List(Of String)
|
|
'Genero una lista di stringhe
|
|
Dim dVal As Double = 0
|
|
DdfFileContent.Add(ConstCompo.K_SIZE & ":")
|
|
StringToDouble(Door.Width, dVal)
|
|
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_WIDTH & ": " & DoubleToString(dVal, 3))
|
|
StringToDouble(Door.Height, dVal)
|
|
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HEIGHT & ": " & DoubleToString(dVal, 3))
|
|
StringToDouble(Door.Thickness, dVal)
|
|
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_THICKNESS & ": " & DoubleToString(dVal, 3))
|
|
' aggiungo una riga vuota per separare la lista successiva
|
|
DdfFileContent.Add("")
|
|
DdfFileContent.Add("" & ConstCompo.K_SWING & ": " & Door.Swing)
|
|
' aggiungo una riga vuota per separare la lista successiva
|
|
DdfFileContent.Add("")
|
|
DdfFileContent.Add("" & ConstCompo.K_PROFILES & ":")
|
|
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LOCKEDGE & ": " & Door.LockEdgeType)
|
|
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Door.LockEdgeMachining))
|
|
StringToDouble(Door.LockEdgeOverMaterial, dVal)
|
|
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
|
|
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HINGEEDGE & ": " & Door.HingeEdgeType)
|
|
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Door.HingeEdgeMachining))
|
|
StringToDouble(Door.HingeEdgeOverMaterial, dVal)
|
|
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
|
|
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_TOP & ": " & Door.TopType)
|
|
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Door.TopMachining))
|
|
StringToDouble(Door.TopOverMaterial, dVal)
|
|
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
|
|
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_BOTTOM & ": " & Door.BottomType)
|
|
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Door.BottomMachining))
|
|
StringToDouble(Door.BottomOverMaterial, dVal)
|
|
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
|
|
' aggiungo una riga vuota per separare la lista successiva
|
|
DdfFileContent.Add("")
|
|
' Riordino e stampo le compo
|
|
SearchCompo(DdfFileContent, Door)
|
|
If Not Directory.Exists(Path.GetDirectoryName(sPath)) Then
|
|
Directory.CreateDirectory(Path.GetDirectoryName(sPath))
|
|
End If
|
|
File.WriteAllLines(sPath, DdfFileContent, Text.Encoding.UTF8)
|
|
End Sub
|
|
|
|
' stampa le compo seguedo l'ordine della lista delle componenti del ddf
|
|
Public Sub SearchCompo(DdfFileContent As List(Of String), Door As Door)
|
|
Dim WritingError As New List(Of String)
|
|
For Index1 = 0 To DdfFile.CompoListOrder.Count() - 1
|
|
For Index2 = 0 To Door.CompoList.Count() - 1
|
|
If DdfFile.CompoListOrder(Index1) = Door.CompoList.Item(Index2).NameDDF Then
|
|
DdfFileContent.AddRange(GenerateCompolistDDF(Door.CompoList.Item(Index2), WritingError))
|
|
End If
|
|
Next
|
|
Next
|
|
ErrorMsg(WritingError)
|
|
End Sub
|
|
|
|
Public Sub ErrorMsg(ErrorList As List(Of String))
|
|
Dim Msg As String = String.Empty
|
|
For Index = 0 To ErrorList.Count - 1
|
|
Msg += ErrorList(Index)
|
|
Msg += vbCrLf
|
|
Next
|
|
If Not String.IsNullOrWhiteSpace(Msg) Then
|
|
MessageBox.Show(EgtMsg(50106) & vbCrLf & Msg, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
End Sub
|
|
'Genero la lista di parametri di ogni compo che vedo a video
|
|
Public Function GenerateCompolistDDF(Compo As Compo, ByRef ErrorValue As List(Of String)) As List(Of String)
|
|
'Dim ErrorValue As String = String.Empty
|
|
Dim CompoListDDF As New List(Of String)
|
|
CompoListDDF.Add(Compo.NameDDF & ":")
|
|
'aggiungo le combobox
|
|
If Compo.ComboBox1Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.ComboBox1SelItem) Then
|
|
Dim ItemComboBox As String = String.Empty
|
|
If Compo.ComboBox1ListDDF.Count > 0 Then
|
|
ItemComboBox = Compo.ComboBox1ListDDF.Item(Compo.ComboBox1List.IndexOf(Compo.ComboBox1SelItem))
|
|
Else
|
|
ItemComboBox = Compo.ComboBox1SelItem
|
|
End If
|
|
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox1DDFName & ": " & ItemComboBox)
|
|
ElseIf Compo.ComboBox1Visibility = Visibility.Visible Then
|
|
ErrorValue.Add(Compo.Name + ": " + Compo.ComboBox1Name)
|
|
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox1DDFName & ": ")
|
|
End If
|
|
|
|
If Compo.ComboBox2Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.ComboBox2SelItem) Then
|
|
Dim ItemComboBox As String = String.Empty
|
|
If Not Path.HasExtension(Compo.ComboBox2SelItem) Then
|
|
If Compo.ComboBox2ListDDF.Count > 0 Then
|
|
ItemComboBox = Compo.ComboBox2ListDDF.Item(Compo.ComboBox2List.IndexOf(Compo.ComboBox2SelItem))
|
|
Else
|
|
ItemComboBox = Compo.ComboBox2SelItem
|
|
End If
|
|
Else
|
|
ItemComboBox = Compo.ComboBox2SelItem.Replace(Path.GetExtension(Compo.ComboBox2SelItem), "")
|
|
End If
|
|
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox2DDFName & ": " & ItemComboBox)
|
|
ElseIf Compo.ComboBox2Visibility = Visibility.Visible Then
|
|
ErrorValue.Add(Compo.Name + ": " + Compo.ComboBox2Name)
|
|
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox2DDFName & ": ")
|
|
End If
|
|
|
|
If Compo.ComboBox3Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.ComboBox3SelItem) Then
|
|
Dim ItemComboBox As String = String.Empty
|
|
If Not Path.HasExtension(Compo.ComboBox3SelItem) Then
|
|
If Compo.ComboBox3ListDDF.Count > 0 Then
|
|
ItemComboBox = Compo.ComboBox3ListDDF.Item(Compo.ComboBox3List.IndexOf(Compo.ComboBox3SelItem))
|
|
Else
|
|
ItemComboBox = Compo.ComboBox3SelItem
|
|
End If
|
|
Else
|
|
ItemComboBox = Compo.ComboBox3SelItem.Replace(Path.GetExtension(Compo.ComboBox3SelItem), "")
|
|
End If
|
|
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox3DDFName & ": " & ItemComboBox)
|
|
ElseIf Compo.ComboBox3Visibility = Visibility.Visible Then
|
|
ErrorValue.Add(Compo.Name + ": " + Compo.ComboBox3Name)
|
|
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox3DDFName & ": ")
|
|
End If
|
|
|
|
'aggiungo le textbox
|
|
Dim dVal As Double = 0
|
|
If Compo.TextBox1Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.TextBox1Value) AndAlso StringToDouble(Compo.TextBox1Value, dVal) Then
|
|
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox1DDFName & ": " & DoubleToString(dVal, 3))
|
|
ElseIf Compo.TextBox1Visibility = Visibility.Visible Then
|
|
ErrorValue.Add(Compo.Name + ": " + Compo.TextBox1Name)
|
|
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox1DDFName & ": ")
|
|
End If
|
|
If Compo.TextBox2Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.TextBox2Value) AndAlso StringToDouble(Compo.TextBox2Value, dVal) Then
|
|
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox2DDFName & ": " & DoubleToString(dVal, 3))
|
|
ElseIf Compo.TextBox2Visibility = Visibility.Visible Then
|
|
ErrorValue.Add(Compo.Name + ": " + Compo.TextBox2Name)
|
|
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox2DDFName & ": ")
|
|
End If
|
|
If Compo.TextBox3Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.TextBox3Value) AndAlso StringToDouble(Compo.TextBox3Value, dVal) Then
|
|
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox3DDFName & ": " & DoubleToString(dVal, 3))
|
|
ElseIf Compo.TextBox3Visibility = Visibility.Visible Then
|
|
ErrorValue.Add(Compo.Name + ": " + Compo.TextBox3Name)
|
|
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox3DDFName & ": ")
|
|
End If
|
|
If Compo.TextBox4Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.TextBox4Value) AndAlso StringToDouble(Compo.TextBox4Value, dVal) Then
|
|
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox4DDFName & ": " & DoubleToString(dVal, 3))
|
|
ElseIf Compo.TextBox4Visibility = Visibility.Visible Then
|
|
ErrorValue.Add(Compo.Name + ": " + Compo.TextBox4Name)
|
|
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox4DDFName & ": ")
|
|
End If
|
|
If Compo.TextBox5Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.TextBox5Value) AndAlso StringToDouble(Compo.TextBox5Value, dVal) Then
|
|
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox5DDFName & ": " & DoubleToString(dVal, 3))
|
|
ElseIf Compo.TextBox5Visibility = Visibility.Visible Then
|
|
ErrorValue.Add(Compo.Name + ": " + Compo.TextBox5Name)
|
|
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox5DDFName & ": ")
|
|
End If
|
|
If Compo.SpecialTextBox1Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.SpecialTextBox1Value) AndAlso StringToDouble(Compo.SpecialTextBox1Value, dVal) Then
|
|
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.SpecialTextBox1DDFName & ": " & DoubleToString(dVal, 3))
|
|
ElseIf Compo.SpecialTextBox1Visibility = Visibility.Visible Then
|
|
ErrorValue.Add(Compo.Name + ": " + Compo.SpecialTextBox1Name)
|
|
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.SpecialTextBox1Name & ": ")
|
|
End If
|
|
' aggiungo una riga vuota
|
|
CompoListDDF.Add("")
|
|
Return CompoListDDF
|
|
End Function
|
|
|
|
#End Region ' Scrittura DDF
|
|
|
|
|
|
End Module
|