diff --git a/CompoPanel/CompoPanelViewModel.vb b/CompoPanel/CompoPanelViewModel.vb
index 723d993..ba34042 100644
--- a/CompoPanel/CompoPanelViewModel.vb
+++ b/CompoPanel/CompoPanelViewModel.vb
@@ -59,8 +59,8 @@ Public Class CompoPanelViewModel
''' Execute the Exec. This method is invoked by the ExecCommand.
'''
Public Sub CompoBtn(param As Object)
- Dim CurrCompoType As CompoType = DirectCast(param, CompoType)
- m_rfDoorParametersViewModel.CurrDoor.AddNewCompo(CurrCompoType)
+ Dim m_CurrCompoType As CompoType = DirectCast(param, CompoType)
+ m_rfDoorParametersViewModel.CurrDoor.AddNewCompo(m_CurrCompoType)
End Sub
#End Region ' CompoBtnCommand
diff --git a/Constants/ConstCompo.vb b/Constants/ConstCompo.vb
index 12804fc..b2844f4 100644
--- a/Constants/ConstCompo.vb
+++ b/Constants/ConstCompo.vb
@@ -21,6 +21,8 @@ Module ConstCompo
Public Const K_NAME As String = "Name"
Public Const K_ISACTIVE As String = "IsActive"
Public Const K_COMPO As String = "Compo"
+ Public Const S_NGECONFIG As String = "NgeConfig"
+ Public Const K_PARAM As String = "Param"
Public Const K_SIZE As String = "size"
Public Const K_WIDTH As String = "width"
@@ -34,6 +36,7 @@ Module ConstCompo
Public Const K_HINGEEDGE As String = "hingeedge"
Public Const K_TOP As String = "top"
Public Const K_BOTTOM As String = "bottom"
+ Public Const K_SCORE As String = " - "
Public Const K_SPACE3 As String = " "
Public Const K_SPACE5 As String = " "
Public Const K_LIST As String = "List"
diff --git a/DdfFile.vb b/DdfFile.vb
index 6229b5b..0e0c62d 100644
--- a/DdfFile.vb
+++ b/DdfFile.vb
@@ -4,31 +4,38 @@ Imports EgtUILib
Imports System.Text.RegularExpressions
Friend Module DdfFile
+ Private m_rfMainWindowViewModel As MainWindowViewModel
- Friend m_Door As New Door
+ ' il vettore che conterrà tutti le linee del file DDF da leggere
Private FileContent As String()
-
+ ' lista ordinata delle componenti da stampare
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"
-
+ ' Genero una nuova porta da usare nella lettura di un DDF
+ Dim m_Door As New Door
' Leggo e stampo a video
- Public Sub ReadDDF(sPath As String, ByRef ReadDoor As Door)
+ Public Sub ReadDDF(sPathDDF 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)
+ ' controllo se esite il file DDF
+ If Not File.Exists(sPathDDF) Then Return
+ FileContent = File.ReadAllLines(sPathDDF)
+ ' se il file esiste ma è vuoto
If FileContent.Count = 0 Then
MessageBox.Show("Empty file", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End If
-
+ ' leggo riga per riga
For LineIndex As Integer = 0 To FileContent.Count - 1
' size
If SearchKey(FileContent(LineIndex), K_SIZE) Then
LineIndex = GetSize(LineIndex + 1)
+ ' se manca una parola chiave nel DDF
If LineIndex = -1 Then
+ ' carico il messaggio di errore
InvalidValue += EgtMsg(50102) + K_SIZE + vbCrLf
+ ' interrompo la lettura del file
Exit For
End If
End If
@@ -48,14 +55,20 @@ Friend Module DdfFile
Exit For
End If
End If
+
' Compo
+ ' se trovo un nome seguito dai due punti
If Not String.IsNullOrWhiteSpace(SearchName(FileContent(LineIndex))) Then
+ ' carivo la stringa letta come nome DDF
Dim CompoNameDDF = SearchName(FileContent(LineIndex))
- If Not String.IsNullOrWhiteSpace(CompoNameDDF) Then
- LineIndex = GetNewCompo(LineIndex + 1, CompoNameDDF, InvalidValue)
- End If
+ ' passo la riga successiva e il nome DDF alla funzione che controlla se esiste e restituisce la riga successiva
+ LineIndex = GetNewCompo(LineIndex + 1, CompoNameDDF, InvalidValue)
+ ElseIf Not String.IsNullOrWhiteSpace(FileContent(LineIndex)) Then
+ If Not String.IsNullOrEmpty(InvalidValue) Then InvalidValue &= Environment.NewLine
+ InvalidValue &= String.Format("Error reading line {0}: ""{1}"" does not exist .", LineIndex, FileContent(LineIndex))
End If
Next
+ ' quando finisce la lettura di tutte le righe esci dal ciclo
If Not String.IsNullOrWhiteSpace(InvalidValue) Then
MessageBox.Show(InvalidValue, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End If
@@ -66,6 +79,11 @@ Friend Module DdfFile
Return Regex.Match(sLine, "\s*(.*?\b)\s*:.*").Groups(1).Value
End Function
+ ' restituisce il trattino
+ Friend Function Score(sLine As String) As String
+ Return Regex.Match(sLine, "\s*(-)*\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
@@ -88,14 +106,21 @@ Friend Module DdfFile
Return True
End Function
+#Region "Carica il General della porta"
+
' carico valori di Size
Public Function GetSize(Index As Integer) As Integer
Dim Width As String = SearchKeyValue(FileContent(Index), K_WIDTH)
+ ' se il valore restituito è nullo o vuoto
If String.IsNullOrWhiteSpace(Width) Then
- If Not SearchKey(FileContent(Index), K_LOCKEDGE) Then Return -1
+ ' se non c'è la parola chiave allora esci
+ If Not SearchKey(FileContent(Index), K_WIDTH) Then Return -1
+ ' altrimenti lascia il valore vuoto
Index += 1
Else
+ ' carico il valore nella porta corrente
m_Door.Width = Width
+ ' passo alla riga successiva
Index += 1
End If
Dim Height As String = SearchKeyValue(FileContent(Index), K_HEIGHT)
@@ -114,32 +139,45 @@ Friend Module DdfFile
m_Door.Thickness = Thickness
Index += 1
End If
+ ' restituisco la riga successiva all'ultimo valore letto
Return Index
End Function
' carico valori swing
Public Function GetSwing(Index As Integer) As Integer
Dim Swing As String = SearchKeyValue(FileContent(Index), K_SWING)
+ ' se il valore restituito è nullo o vuoto
If String.IsNullOrWhiteSpace(Swing) Then
+ ' se non c'è la parola chiave allora esci
If Not SearchKey(FileContent(Index), K_SWING) Then Return -1
+ ' altrimenti lascia il valore vuoto
Index += 1
Else
+ ' carico il valore nella porta corrente
m_Door.Swing = Swing
+ ' passo alla riga successiva
Index += 1
End If
+ ' restituisco la riga successiva all'ultimo valore letto
Return Index
End Function
' carico valori profiles
Public Function GetProfiles(Index As Integer) As Integer
+ ' Creo una stringa per scrivere gli errori
Dim ReadingError As String = String.Empty
' Lock
Dim LockEdgeType As String = SearchKeyValue(FileContent(Index), K_LOCKEDGE)
+ ' se il valore restituito è nullo o vuoto
If String.IsNullOrWhiteSpace(LockEdgeType) Then
+ ' se non c'è la parola chiave allora esci
If Not SearchKey(FileContent(Index), K_LOCKEDGE) Then Return -1
+ ' altrimenti lascia il valore vuoto
Index += 1
Else
+ ' carico il valore nella porta corrente
m_Door.LockEdgeType = LockEdgeType
+ ' restituisco la riga successiva all'ultimo valore letto
Index += 1
End If
Dim LockEdgeMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
@@ -238,90 +276,173 @@ Friend Module DdfFile
m_Door.BottomOverMaterial = BottomOverMaterial
Index += 1
End If
-
+ ' restituisco la riga successiva all'ultimo valore letto
Return Index
End Function
+#End Region ' Carica il General della porta
+
' ricerco la compo nella lista dei compobtn
Public Function GetNewCompo(Index As Integer, CompoNameDDF As String, ByRef InvalidValue As String) As Integer
+ Dim bDDFName As Boolean = False
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
+ Dim NewCompoIndex As Integer = Nothing
+ ' controllo che il nome passato esiste nella lista delle componenti
+ Dim CompoListIndex As Integer
+ ' se la stringa ha un trattino ipotizzo che il nome della componente sia lo stesso dell'ultima componente inserita
+ If Not String.IsNullOrWhiteSpace(Score(FileContent(Index - 1))) Then
+ CompoNameDDF = m_Door.m_CompoList.Last.CompoType.DDFName
+ Index -= 1
+ End If
+
+ For CompoListIndex = 0 To CompoPanelViewModel.CompoTypeList.Count() - 1
+ ' se il nome esite
+ If CompoPanelViewModel.CompoTypeList(CompoListIndex).DDFName = CompoNameDDF Then
+ bDDFName = True
+ ' inizializzo l'idice della lista delle componenti che sto per creare
+ NewCompoIndex = -1
+ ' passo alla lettura delle righe successive
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)
+
+ ' controllo che la stringa abbia i due punti: se non ha i due punti
+ If String.IsNullOrWhiteSpace(SearchName(FileContent(Index))) Then
+ If Not String.IsNullOrEmpty(InvalidValue) Then InvalidValue &= Environment.NewLine
+ InvalidValue &= String.Format("Error reading line {0}: ""{1}"".", Index, FileContent(Index))
+ ' esco dalla lettura della compo
+ Exit While
+ ' se ha il trattino
+ Else
+ ' creo la nuova componente
+ Dim m_CurrCompo = New Compo(CompoPanelViewModel.CompoTypeList(CompoListIndex), m_Door)
+ ' Leggo il file ini del componente per vedere se c'è il template: se c'è
+ Dim CurrCompoTypePath As String = CompoPanelViewModel.CompoTypeList(CompoListIndex).Path
+ If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME) <> 0 Then
+ ' leggo nomi
+ Dim Name As String = String.Empty
+ Dim DDFName As String = String.Empty
+ IniFile.GetPrivateProfileCompoName(S_TEMPLATE, K_NAME, DDFName, Name, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME)
+ Dim TemplateList As New List(Of String)
+ IniFile.OpenDirectory(CompoPanelViewModel.CompoTypeList(CompoListIndex).Path, TemplateList)
+ ' aggiungo il template come parametro
+ m_CurrCompo.TemplateDDFName = DDFName
+ m_CurrCompo.TemplateName = Name
+ m_CurrCompo.TemplateItemList = TemplateList
+
+ ' cercco il template associato al nome DDF come parola preceduta dl trattino "-"
+ If SearchScore(FileContent(Index)) Then
+ ' leggo il valore del template e lo assegno alla componente che sto generando
+ m_CurrCompo.TemplateSelItem = SearchKeyValue(FileContent(Index), SearchTemplate(FileContent(Index)))
+ ' se il template non ha nessun nome
+ If String.IsNullOrWhiteSpace(m_CurrCompo.TemplateSelItem) Then
+ ' elimina la compo che stai creando
+ m_CurrCompo = Nothing
+ ' ed esci dal ciclo while
+ Exit While
+ End If
+ 'mi sposto nella riga successiva
+ Index += 1
+ ' leggo i parametri della componente
+ ReadParam(m_CurrCompo, InvalidValue, Index)
+ ' se creo la componente allora assegno vero
+ bCompo = True
+ Else
+ ' restituisco la riga precedente alla funzione ReadDDF
+ Index -= 1
+ ' se non ha il trattino (ma ha un template) esci dal ciclo
+ Exit While
+ End If
+ ' la componente non ha template (louver_cut_outs)
+ Else
+ ' nascondo il template
+ m_CurrCompo.TemplateVisibility = Visibility.Collapsed
+ ' leggo il nome del compo dal file config.ini
+ Dim sTemplateName As String = String.Empty
+ ' controllo il tipo di estensione del file (nome letto da Config.ini)
+ EgtUILib.GetPrivateProfileString(S_TEMPLATE, K_COMPO, "", sTemplateName, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME)
+ If String.IsNullOrWhiteSpace(sTemplateName) Then
+ If Not String.IsNullOrEmpty(InvalidValue) Then InvalidValue &= Environment.NewLine
+ InvalidValue &= String.Format("Error reading {0} param in {1} compo.", K_COMPO, m_CurrCompo.TemplateName)
+ m_CurrCompo = Nothing
+ ElseIf Not File.Exists(CurrCompoTypePath & "\" & sTemplateName & ".lua") Then
+ If Not String.IsNullOrEmpty(InvalidValue) Then InvalidValue &= Environment.NewLine
+ InvalidValue &= String.Format("Error reading {0} {1} compo.", K_COMPO, m_CurrCompo.TemplateName)
+ m_CurrCompo = Nothing
+ Else
+ ' assegno il nome del tipo di componente
+ m_CurrCompo.TemplateSelItem = sTemplateName
+ ReadParam(m_CurrCompo, InvalidValue, Index)
+ ' se creo la compo allora assegno vero
+ bCompo = True
+ End If
+ End If
+ m_Door.CompoList.Add(m_CurrCompo)
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
+ ' se la stringa non ha i due punti
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)
+ If Not bDDFName Then
+ ' la componente none esiste
+ If Not String.IsNullOrEmpty(InvalidValue) Then InvalidValue &= Environment.NewLine
+ InvalidValue &= String.Format("Error reading {0}: ""{1}"" does not exist as {0}", K_COMPO, CompoNameDDF)
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
+ Sub ReadParam(ByRef CompoTemplateItem As Compo, ByRef InvalidValue As String, ByRef IndexLine As Integer)
+ Dim IndexParam As Integer
+ For IndexParam = 0 To CompoTemplateItem.CompoParamList.Count - 1
+ ' se il nome del parametro è lo stesso di quello presente nella componente
+ If String.Equals(Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName), Trim(SearchName(FileContent(IndexLine + IndexParam)))) Then
+ Dim CurrCompoParam As CompoParam = CompoTemplateItem.CompoParamList(IndexParam)
+ ' verifico di che tipo si tratta: combobox
+ If TypeOf CurrCompoParam Is ComboBoxParam Then
+ ' assegno il valore letto alla lista
+ Dim sVal As String = SearchKeyValue(FileContent(IndexLine + IndexParam), CurrCompoParam.DDFName)
+ DirectCast(CurrCompoParam, ComboBoxParam).SelItem = SearchKeyValue(FileContent(IndexLine + IndexParam), CurrCompoParam.DDFName)
+ ' assegno il valore letto alla textbox
+ ElseIf TypeOf CurrCompoParam Is TextBoxParam Then
+ Dim sVal As String = SearchKeyValue(FileContent(IndexLine + IndexParam), CurrCompoParam.DDFName)
+ DirectCast(CurrCompoParam, TextBoxParam).Value = SearchKeyValue(FileContent(IndexLine + IndexParam), CurrCompoParam.DDFName)
+ ElseIf TypeOf CurrCompoParam Is TextBoxOnOffParam Then
+ ' assegno il valore letto alla taxtboxonoff
+ Dim sVal As String = SearchKeyValue(FileContent(IndexLine + IndexParam), CurrCompoParam.DDFName)
+ DirectCast(CurrCompoParam, TextBoxOnOffParam).Value = SearchKeyValue(FileContent(IndexLine + IndexParam), CurrCompoParam.DDFName)
+ 'Else
+ ' ' il nome non DDF non è corretto
+ ' InvalidValue &= String.Format("Error reading name {0} param in {1} compo.", CompoTemplateItem.CompoParamList(IndexParam).DDFName, CompoTemplateItem.CompoType.DDFName)
+ End If
+ ' se il nome esiste ma è sabgliato
+ ElseIf Not String.IsNullOrWhiteSpace(SearchName(FileContent(IndexLine + IndexParam))) Then
+ ' se il nome non è preceduto dal trattino
+ If String.IsNullOrWhiteSpace(Score(FileContent(IndexLine + IndexParam))) Then
+ ' il nome DDF non è corretto
+ If Not String.IsNullOrEmpty(InvalidValue) Then InvalidValue &= Environment.NewLine
+ InvalidValue &= String.Format("Error reading name {0} param in {1} compo.", SearchName(FileContent(IndexLine + IndexParam)), CompoTemplateItem.CompoType.DDFName)
+ Else
+ ' istanzio tutti i valori che mancano alla compo corrente di default
+ If Not String.IsNullOrEmpty(InvalidValue) Then InvalidValue &= Environment.NewLine
+ InvalidValue &= String.Format("Error reading {0} compo: missing {1} params.", CompoTemplateItem.CompoType.DDFName, CompoTemplateItem.CompoParamList.Count - IndexParam)
+ ' esco dal ciclo for dei parametri
+ Exit For
+ End If
+ 'se c'è una riga vuota
+ ElseIf String.IsNullOrWhiteSpace(SearchName(FileContent(IndexLine + IndexParam))) Then
+ ' spostati alla riga successiva nel fie DDF
+ IndexLine += 1
+ ' e continua a cercare lo stesso parametro
+ IndexParam -= 1
+ ' se trovo un trattino vuol dire che cè una nuova componente
+ End If
+ Next
+ ' terminata la lettura dei parametri
+ IndexLine += IndexParam
+ End Sub
+
+
#End Region ' Lettura ddf
@@ -329,6 +450,7 @@ Friend Module DdfFile
'genero le stringhe che dovranno essere scritte nel DDF
Friend Sub WriteDDF(Door As Door, sPath As String)
+ ' Door = DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor
' pulisco lista prima di iniziare a scrivere
Dim DdfFileContent As New List(Of String)
'Genero una lista di stringhe
@@ -373,121 +495,78 @@ Friend Module DdfFile
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)
+ Public Sub SearchCompo(DdfFileContent As List(Of String), ByRef Door As Door)
+ Dim NewCompoNameDDF = False
+ Dim WritingError As String = String.Empty
+ ' cerco la prima componente da aggiungere alla lista delle componenti
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))
+ ' se trovo la componenete da aggiungere
+ If DdfFile.CompoListOrder(Index1) = Door.CompoList(Index2).CompoType.DDFName Then
+ ' se il nome della componente da aggiungere già esiste
+ If Index2 >= 1 AndAlso String.Equals(Door.CompoList(Index2).CompoType.DDFName, Door.CompoList(Index2 - 1).CompoType.DDFName) Then
+ NewCompoNameDDF = True
+ Else
+ ' aggiungo una riga vuota per separare il nome della nuova componente
+ DdfFileContent.Add("")
+ End If
+ ' Carico nella lista dei componenti la lista di stringhe da stampare
+ DdfFileContent.AddRange(GenerateCompolistDDF(Door.CompoList(Index2), WritingError, NewCompoNameDDF))
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)
+ ' finto di leggere tutte le componenti stampo il messaggio degli errori
+ If Not String.IsNullOrWhiteSpace(WritingError) Then
+ MessageBox.Show(WritingError, "Error", MessageBoxButton.OK)
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
+ Public Function GenerateCompolistDDF(Compo As Compo, ByRef sErrorList As String, bNewCompoNameDDF As Boolean) As List(Of String)
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 & ": ")
+ ' se il nome non esiste ancora nella lista lo aggiungo
+ If Not bNewCompoNameDDF Then
+ ' aggiungo il nome DDF della componente
+ CompoListDDF.Add(Compo.CompoType.DDFName & ":")
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))
+ ' se esiste il template
+ If Not String.IsNullOrWhiteSpace(Compo.TemplateDDFName) Then
+ ' aggiungo " - nomeTemplate: TemplateSelezionato"
+ CompoListDDF.Add(K_SCORE & Compo.TemplateDDFName & ": " & Compo.TemplateSelItem)
+ End If
+ ' creo l'indice dei parametri della compo
+ Dim ParamIndex As Integer
+ ' scrivo tutti i parametri della compo
+ For ParamIndex = 0 To Compo.CompoParamList.Count - 1
+ Dim CurrCompoParam As CompoParam = Compo.CompoParamList(ParamIndex)
+ ' controllo il tipo di parametro: ComboBox
+ If TypeOf CurrCompoParam Is ComboBoxParam Then
+ ' controllo che sia selezionato un elemento
+ If Not String.IsNullOrWhiteSpace(DirectCast(CurrCompoParam, ComboBoxParam).SelItem) Then
+ CompoListDDF.Add(K_SPACE5 & DirectCast(CurrCompoParam, ComboBoxParam).DDFName & ": " & DirectCast(CurrCompoParam, ComboBoxParam).SelItem)
Else
- ItemComboBox = Compo.ComboBox2SelItem
+ ' se non è selezionato nessun elemento (cosa impossibile...)
+ If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
+ sErrorList &= String.Format("Error reading {0} param in {1} compo: value does not exist", DirectCast(CurrCompoParam, ComboBoxParam).Name, CurrCompoParam.DDFName)
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))
+ ' TextBox
+ ElseIf TypeOf CurrCompoParam Is TextBoxParam Then
+ If Not String.IsNullOrWhiteSpace(DirectCast(CurrCompoParam, TextBoxParam).Value) Then
+ CompoListDDF.Add(K_SPACE5 & DirectCast(CurrCompoParam, TextBoxParam).DDFName & ": " & DirectCast(CurrCompoParam, TextBoxParam).Value)
+ ' TextBoxOnOff e controllo che la TextBoxOnOff sia attiva
Else
- ItemComboBox = Compo.ComboBox3SelItem
+ If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
+ sErrorList &= String.Format("Error reading {0} param in {1} compo: value does not exist", DirectCast(CurrCompoParam, TextBoxParam).Name, CurrCompoParam.DDFName)
+ End If
+ ElseIf TypeOf CurrCompoParam Is TextBoxOnOffParam AndAlso DirectCast(CurrCompoParam, TextBoxOnOffParam).IsActive Then
+ If Not String.IsNullOrWhiteSpace(DirectCast(CurrCompoParam, TextBoxOnOffParam).Value) Then
+ CompoListDDF.Add(K_SPACE5 & DirectCast(CurrCompoParam, TextBoxOnOffParam).DDFName & ": " & DirectCast(CurrCompoParam, TextBoxOnOffParam).Value)
+ Else
+ If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
+ sErrorList &= String.Format("Error reading {0} param in {1} compo: value does not exist", DirectCast(CurrCompoParam, TextBoxOnOffParam).Name, CurrCompoParam.DDFName)
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("")
+ Next
Return CompoListDDF
End Function
diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb
index ab8efb2..265bd29 100644
--- a/DoorParameters/Compo.vb
+++ b/DoorParameters/Compo.vb
@@ -46,159 +46,334 @@ Public Class Compo
End Set
End Property
+ ' dalla scelta TemplateSelItem genero la lista di parametri
Private m_TemplateSelItem As String
Public Property TemplateSelItem As String
Get
Return m_TemplateSelItem
End Get
+ ' aggiorno la lista dei parametri
Set(value As String)
Dim CurrItemPath As String = m_CompoType.Path & "\" & value
- If Not Path.HasExtension(CurrItemPath) Then
+ ' se il file ha estensione nge
+ If Path.HasExtension(CurrItemPath) AndAlso Path.GetExtension(CurrItemPath).ToLower = ".nge" Then
+ ' controllo che esiste il file altrimenti esco
+ If Not File.Exists(CurrItemPath) Then Return
+ m_TemplateSelItem = value
+ ' creo la stringa che contiene la lista degli errori
+ Dim ErrorList As String = String.Empty
+ Dim ParamIndex As Integer = 1
+ Dim sParam As String = String.Empty
+ Dim NewCompoParam As CompoParam = Nothing
+ ' ricerco la parola chiave Param nella stringa nel file Cinfig.ini
+ While EgtUILib.GetPrivateProfileString(S_NGECONFIG, K_PARAM & ParamIndex, "", sParam, m_CompoType.Path & "\" & CONFIGINI_FILE_NAME) > 0
+ If Not String.IsNullOrWhiteSpace(sParam) Then
+ ' leggo il tipo di parametro
+ ReadParam(sParam, NewCompoParam, ErrorList)
+ ' carico il parametro nella lista della componente
+ InsertCompoParam(NewCompoParam, ParamIndex)
+ End If
+ ParamIndex += 1
+ End While
+ Else
+ ' se il file non ha estensione allora creo l'estensione .lua
CurrItemPath &= ".lua"
- End If
- If Not File.Exists(CurrItemPath) Then Return
- m_TemplateSelItem = value
- Dim ReadCurrCompo() As String = File.ReadAllLines(CurrItemPath)
- ' creo la stringa che contiene la lista degli errori
- Dim ErrorList As String = String.Empty
- For LineIndex = 0 To ReadCurrCompo.Count - 1
- Dim CurrCompoFileLine As String = ReadCurrCompo(LineIndex)
- If RegexFunction.IsGraphicParametersTitle(CurrCompoFileLine) Then
- Dim ParamIndex As Integer = 1
- Dim NewCompoParam As CompoParam = Nothing
- Dim bIsFinished As Boolean = False
- While Not bIsFinished
- NewCompoParam = Nothing
- If Not String.IsNullOrWhiteSpace(ReadCurrCompo(LineIndex + ParamIndex)) Then
- bIsFinished = Not ReadParam(ReadCurrCompo(LineIndex + ParamIndex), ParamIndex, NewCompoParam, ErrorList)
- Else
- LineIndex += 1
- Continue While
- End If
- If Not IsNothing(NewCompoParam) Then
- ' se non esiste l'indice
- If Not m_CompoParamList.Count > ParamIndex - 1 Then
- ' creo il parametro combo
- Me.CompoParamList.Insert(ParamIndex - 1, NewCompoParam)
+ ' controllo che esiste il file altrimenti esco
+ If Not File.Exists(CurrItemPath) Then Return
+ m_TemplateSelItem = value
+ ' carico un vettore con le stringhe del file corrente
+ Dim ReadCurrCompo() As String = File.ReadAllLines(CurrItemPath)
+ ' creo la stringa che contiene la lista degli errori
+ Dim ErrorList As String = String.Empty
+ ' leggo il vettore di stringhe del file corrente
+ For LineIndex = 0 To ReadCurrCompo.Count - 1
+ ' copio il valore della riga
+ Dim CurrCompoFileLine As String = ReadCurrCompo(LineIndex)
+ ' cerco il titolo [Graphic parameters]
+ If RegexFunction.IsGraphicParametersTitle(CurrCompoFileLine) Then
+ Dim ParamIndex As Integer = 1
+ Dim NewCompoParam As CompoParam = Nothing
+ Dim bIsFinished As Boolean = False
+ While Not bIsFinished
+ ' attualizzo il componente a nulla
+ NewCompoParam = Nothing
+ ' cerco nella riga successiva al titolo il primo parametro
+ If Not String.IsNullOrWhiteSpace(ReadCurrCompo(LineIndex + ParamIndex)) Then
+ Dim ReadLine As String
+ ' carico i valori della stringa che seguono la chiave "--Param1="
+ ReadLine = ParamLine(ReadCurrCompo(LineIndex + ParamIndex), "Param" & ParamIndex)
+ ' se uno dei paraemtri è completamente sbagliato allora restituisce falso e non riempo la NewCompoParam che rimane Nothing
+ bIsFinished = Not ReadParam(ReadLine, NewCompoParam, ErrorList)
Else
- ' se esiste ma è diverso il nome DDF
- If Not m_CompoParamList(ParamIndex - 1).DDFName = NewCompoParam.DDFName Then
- ' creo il nuovo parametro combo
- m_CompoParamList.RemoveAt(ParamIndex - 1)
- m_CompoParamList.Insert(ParamIndex - 1, NewCompoParam)
- End If
+ ' altrimenti se la riga è vuota mi sposto alla successiva
+ LineIndex += 1
+ ' e continuo il ciclo while
+ Continue While
End If
- End If
- If Not bIsFinished Then ParamIndex += 1
- End While
- For DeleteIndex = m_CompoParamList.Count - 1 To ParamIndex - 1 Step -1
- m_CompoParamList.RemoveAt(DeleteIndex)
- Next
- Exit For
- End If
- Next
+ ' insrisco la nuova componenenet: se la riga è vuota o la componente non è stata creata allora il componete è Nothing
+ InsertCompoParam(NewCompoParam, ParamIndex)
+ ' se il parametro è stato creato passa alla riga successiva
+ If Not bIsFinished Then ParamIndex += 1
+ End While
+ ' esiste già una lista
+ For DeleteIndex = m_CompoParamList.Count - 1 To ParamIndex - 1 Step -1
+ m_CompoParamList.RemoveAt(DeleteIndex)
+ Next
+ Exit For
+ End If
+ Next
+ End If
+
End Set
End Property
- Private Function ReadParam(sLine As String, nParamIndex As Integer, ByRef NewCompoParam As CompoParam, sErrorList As String) As Boolean
- Dim ReadLine As String = ParamLine(sLine, "Param" & nParamIndex)
- If Not String.IsNullOrWhiteSpace(ReadLine) Then
- Dim sItems() As String = ReadLine.Split(";"c)
- If sItems.Count > 0 Then
+ ' inserisco il parametro letto nella lista dei paramtri senza modificare i parametri già esistenti
+ Private Sub InsertCompoParam(NewCompoParam As CompoParam, ParamIndex As Integer)
+ If Not IsNothing(NewCompoParam) Then
+ ' se non esiste l'indice
+ If Not m_CompoParamList.Count > ParamIndex - 1 Then
+ ' creo il parametro combo
+ Me.CompoParamList.Insert(ParamIndex - 1, NewCompoParam)
+ Else
+ ' se esiste ma è diverso il nome DDF
+ If Not m_CompoParamList(ParamIndex - 1).DDFName = NewCompoParam.DDFName Then
+ ' creo il nuovo parametro combo
+ m_CompoParamList.RemoveAt(ParamIndex - 1)
+ m_CompoParamList.Insert(ParamIndex - 1, NewCompoParam)
+ End If
+ End If
+ End If
+ End Sub
+
+ ' leggo il nome DDF e il nome, restituisco il nome solo se esiste un messaggio associato
+ Private Function MsgContol(sDDFName As String, sName As String, ByRef sErrorList As String) As String
+ 'If IsNumeric(sName) Then
+ ' se è numerico ma non esiste un messaggio associato
+ Dim ErrorMsg As String = "Msg" & Trim(sName)
+ If String.Equals(Utility.ReadMsg(sName), ErrorMsg) Then
+ Return sDDFName
+ Else
+ ' restituisco il messaggio letto
+ Return Utility.ReadMsg(sName)
+ sErrorList &= String.Format("Error reading name {0} param in {1} compo: does not exist.", sName, m_CompoType.DDFName)
+ End If
+ End Function
+
+ ' lettura del parametro passato dalla riga del file aperto
+ Private Function ReadParam(sReadLine As String, ByRef NewCompoParam As CompoParam, sErrorList As String) As Boolean
+ If Not String.IsNullOrWhiteSpace(sReadLine) Then
+ ' carico un vettore con i valori della stringa
+ Dim sItems() As String = sReadLine.Split(";"c)
+ ' se esistono almeno due elementi "ComboBox; NomeDDF"
+ If sItems.Count > 1 Then
+ ' il primo elemento del vettore disti gue tre categorie
Select Case sItems(0)
Case "ComboBox"
+ ' se la combobox contiene almeno un elemento "ComboBox; NomeDDF; Nome; NomeDDFItem/NomeItem"
If sItems.Count >= 4 Then
- ' carico gli elementi della lista
+ ' carico gli elementi della lista in un vettore
Dim sComboItemList() As String = sItems(3).Split(","c)
Dim ComboItemList As New List(Of String)
Dim DDFComboItemList As New List(Of String)
For ItemIndex = 0 To sComboItemList.Count - 1
- ' carico la lista con i nomi DDF
Dim ComboItem() As String = sComboItemList(ItemIndex).Split("/"c)
- DDFComboItemList.Add(ComboItem(0))
- ComboItemList.Add(Utility.ReadMsg(ComboItem(1)))
+ ' se esiste il NomeDDF e il Nome allora separo
+ If ComboItem.Count = 2 Then
+ ' carico la lista con i nomi DDF
+ DDFComboItemList.Add(ComboItem(0))
+ ' carico la lista con i nomi
+ ComboItemList.Add(MsgContol(ComboItem(0), ComboItem(1), sErrorList))
+ Else
+ ' se esiste solo un nome considero sia il nome DDF
+ ComboItemList.Add(ComboItem(0))
+ ' Errore nella lettura del nome: manca la definizione del nome nella lingua corrente
+ sErrorList &= String.Format("Error reading name {0} param in {1} compo.", ComboItem(0), m_CompoType.DDFName)
+ End If
Next
- NewCompoParam = New ComboBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), ComboItemList, DDFComboItemList)
+ NewCompoParam = New ComboBoxParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), ComboItemList, DDFComboItemList, ComboItemList(0))
Return True
Else
- sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), m_CompoType.DDFName)
+ ' non esiste una lista di nemmeno un elemento
+ sErrorList &= String.Format("Error reading {0} param in {1} compo: do not exist.", sItems(1), m_CompoType.DDFName)
+ Return False
End If
+
Case "TextBox"
+ Dim dHeight As Double
+ ' leggo il valore altezza che già esite nella porta
+ StringToDouble(m_rfCurrDoor.Height, dHeight)
+ Dim dDefaultValue As Double
+ ' verifico che sono presenti "TextBox; NomeDDF; Nome"
If sItems.Count >= 3 Then
- If sItems.Count > 3 Then
- Dim DDFComboValuelList As New List(Of String)
- Dim sComboItemList() As String = sItems(4).Split(","c)
- For ItemIndex = 0 To sComboItemList.Count - 1
- DDFComboValuelList.Add(sComboItemList(ItemIndex))
- Next
- For ParamIndex = 0 To m_CompoParamList.Count - 1
- Dim CurrCompoParam As CompoParam = m_CompoParamList(ParamIndex)
- If CurrCompoParam.DDFName = sItems(3) Then
- If TypeOf CurrCompoParam Is ComboBoxParam Then
- NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), DirectCast(CurrCompoParam, ComboBoxParam), DDFComboValuelList)
- Return True
- Else
- NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
- Return True
- End If
- Exit For
+ ' verifico che sono presenti "TextBox; NomeDDF; Nome; Valore"
+ If sItems.Count >= 4 Then
+ ' se converto il valore in double
+ sItems(3) = Replace(sItems(3).ToUpper, "TH", "(" & m_rfCurrDoor.Thickness & ")")
+ StringToDouble(sItems(3), dDefaultValue)
+ Dim sDefaultValue As String = DoubleToString(dDefaultValue, -3)
+ ' verifico che la misura letta sia minore dell'altezza della porta
+ If dDefaultValue < dHeight Then
+ ' verifico che sono presenti "TextBox; NomeDDF; Nome; Valore; NomeLista; NomeElementoLista"
+ If sItems.Count > 5 Then
+ ' creo la lista associata alla TextBox se esiste almeno un elemento
+ Dim DDFComboValuelList As New List(Of String)
+ ' carico gli elementi della lista in un vettore
+ Dim sComboItemList() As String = sItems(5).Split(","c)
+ ' carico la lista dal vettore
+ For ItemIndex = 0 To sComboItemList.Count - 1
+ DDFComboValuelList.Add(sComboItemList(ItemIndex))
+ Next
+ ' cerco nella lista dei paraletri già esistenti il nome della lista a cui fa riferimento
+ For ParamIndex = 0 To m_CompoParamList.Count - 1
+ Dim CurrCompoParam As CompoParam = m_CompoParamList(ParamIndex)
+ ' verifico che il nome della lista associata esista
+ If CurrCompoParam.DDFName = sItems(4) Then
+ ' verifico che il nome del paramertro è di una combobox
+ If TypeOf CurrCompoParam Is ComboBoxParam Then
+ ' creo la componente nuova
+ NewCompoParam = New TextBoxParam(sItems(1), MsgContol(sItems(1), Utility.ReadMsg(sItems(2)), sErrorList), sDefaultValue, DirectCast(CurrCompoParam, ComboBoxParam), DDFComboValuelList)
+ Return True
+ Else
+ ' se esiste il nome della lista associata ma non è una combobox creo il componente senza la lista
+ NewCompoParam = New TextBoxParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing)
+ sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(4), m_CompoType.DDFName)
+ Return True
+ End If
+ Exit For
+ End If
+ Next
+ ' se non trovo nella lista dei parametri il nome della lista creo il componente senza la lista
+ NewCompoParam = New TextBoxParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing)
+ sErrorList &= String.Format("Error reading {0} param in {1} compo: do not exist.", sItems(4), m_CompoType.DDFName)
+ Return True
+ ElseIf sItems.Count = 5 Then
+ 'se non esiste una lista ma solo il nome della lista
+ NewCompoParam = New TextBoxParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing)
+ sErrorList &= String.Format("Error reading {0} param in {1} compo: do not exist list", sItems(4), m_CompoType.DDFName)
+ Return True
+ ElseIf sItems.Count = 4 Then
+ ' se la text contiente solo 4 parametri
+ NewCompoParam = New TextBoxParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing)
+ Return True
End If
- Next
- NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
- Return True
- Else
- NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
- Return True
- End If
+ Else
+ ' se la misura passata è più grande di quella della porta non carico il valore e creo il parametro senza lista
+ NewCompoParam = New TextBoxParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), "0.000", Nothing, Nothing)
+ sItems(2) = MsgContol(sItems(1), sItems(2), sErrorList)
+ sErrorList &= String.Format("Error reading {0} param in {1} compo: {2}.", sItems(2), m_CompoType.DDFName, sDefaultValue)
+ ' ma faccio andare avanti nella lettura dei parametri
+ Return True
+ End If
Else
- If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
- sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), m_CompoType.DDFName)
+ ' se la stringa ha 3 elemtni "TextBox; NomeDDF; Nome"
+ NewCompoParam = New TextBoxParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), "0.000", Nothing, Nothing)
+ sItems(2) = MsgContol(sItems(1), sItems(2), sErrorList)
+ sErrorList &= String.Format("Error reading {0} param in {1} compo: do not exist value.", sItems(2), m_CompoType.DDFName)
+ Return True
End If
+ Else
+ ' se ha solo 2 elementi "TextBox; NomeDDF"
+ NewCompoParam = Nothing
+ sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), m_CompoType.DDFName)
+ Return False
+ End If
+
Case "TextBoxOnOff"
+ Dim dHeight As Double
+ ' leggo il valore altezza che già esite nella porta
+ StringToDouble(m_rfCurrDoor.Height, dHeight)
+ Dim dItem As Double
+ ' verifico che sono presenti "TextBox; NomeDDF; Nome"
+ Dim dDefaultValue As Double
If sItems.Count >= 3 Then
- If sItems.Count > 3 Then
- Dim DDFComboValuelList As New List(Of String)
- Dim sComboItemList() As String = sItems(4).Split(","c)
- For ItemIndex = 0 To sComboItemList.Count - 1
- DDFComboValuelList.Add(sComboItemList(ItemIndex))
- Next
- For ParamIndex = 0 To m_CompoParamList.Count - 1
- Dim CurrCompoParam As CompoParam = m_CompoParamList(ParamIndex)
- If CurrCompoParam.DDFName = sItems(3) Then
- If TypeOf CurrCompoParam Is ComboBoxParam Then
- NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), DirectCast(CurrCompoParam, ComboBoxParam), DDFComboValuelList)
- Return True
- Else
- NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
- Return True
- End If
- Exit For
+ ' verifico che sono presenti "TextBox; NomeDDF; Nome; Valore"
+ If sItems.Count >= 4 Then
+ sItems(3) = Replace(sItems(3).ToUpper, "TH", "(" & m_rfCurrDoor.Thickness & ")")
+ StringToDouble(sItems(3), dDefaultValue)
+ Dim sDefaultValue As String = DoubleToString(dDefaultValue, -3)
+ ' converto il valore in double
+ StringToDouble(sItems(3), dItem)
+ ' verifico che la misura letta sia minore dell'altezza della porta
+ If dDefaultValue < dHeight Then
+ ' verifico che sono presenti "TextBox; NomeDDF; Nome; Valore; NomeLista; NomeElementoLista"
+ If sItems.Count > 5 Then
+ ' creo la lista associata alla TextBox se esiste almeno un elemento
+ Dim DDFComboValuelList As New List(Of String)
+ ' carico gli elementi della lista in un vettore
+ Dim sComboItemList() As String = sItems(5).Split(","c)
+ ' carico la lista dal vettore
+ For ItemIndex = 0 To sComboItemList.Count - 1
+ DDFComboValuelList.Add(sComboItemList(ItemIndex))
+ Next
+ ' cerco nella lista dei paraletri già esistenti il nome della lista a cui fa riferimento
+ For ParamIndex = 0 To m_CompoParamList.Count - 1
+ Dim CurrCompoParam As CompoParam = m_CompoParamList(ParamIndex)
+ ' verifico che il nome della lista associata esista
+ If CurrCompoParam.DDFName = sItems(4) Then
+ ' verifico che il nome del paramertro è di una combobox
+ If TypeOf CurrCompoParam Is ComboBoxParam Then
+ ' creo la componente nuova
+ NewCompoParam = New TextBoxOnOffParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), sDefaultValue, DirectCast(CurrCompoParam, ComboBoxParam), DDFComboValuelList)
+ Return True
+ Else
+ ' se esiste il nome della lista associata ma non è una combobox creo il componente senza la lista
+ NewCompoParam = New TextBoxOnOffParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing)
+ Return True
+ End If
+ Exit For
+ End If
+ Next
+ ' se non trovo nella lista dei parametri il nome della lista creo il componente senza la lista
+ NewCompoParam = New TextBoxOnOffParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing)
+ Return True
+ ElseIf sItems.Count = 5 Then
+ 'se non esiste una lista ma solo il nome della lista
+ NewCompoParam = New TextBoxParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing)
+ sErrorList &= String.Format("Error reading {0} param in {1} compo: do not exist list", sItems(4), m_CompoType.DDFName)
+ Return True
+ ElseIf sItems.Count = 4 Then
+ ' se la text contiente solo 4 parametri
+ NewCompoParam = New TextBoxParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), sDefaultValue, Nothing, Nothing)
+ Return True
End If
- Next
- NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
- Return True
+ Else
+ ' se la misura passata è più grande di quella della porta non carico il valore e creo il parametro senza lista
+ NewCompoParam = New TextBoxOnOffParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), "0", Nothing, Nothing)
+ If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
+ sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), m_CompoType.DDFName)
+ ' ma faccio andare avanti nella lettura dei parametri
+ Return True
+ End If
Else
- NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
+ ' se la stringa ha 3 elemtni "TextBox; NomeDDF; Nome"
+ NewCompoParam = New TextBoxOnOffParam(sItems(1), MsgContol(sItems(1), sItems(2), sErrorList), "0", Nothing, Nothing)
Return True
End If
Else
+ ' se ha solo 2 elementi "TextBox; NomeDDF"
+ NewCompoParam = Nothing
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), m_CompoType.DDFName)
+ Return False
End If
+
End Select
- If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
- If sItems.Count >= 2 Then
- sErrorList &= String.Format("Erron in compo {0} param {1}: type {2} do not exist.", m_CompoType.DDFName, sItems(1), sItems(0))
- Else
- sErrorList &= String.Format("Erron in compo {0}: type {1} do not exist.", m_CompoType.DDFName, sItems(0))
- End If
+ Else
+ ' se non è nessuno dei casi precedenti del select case
+ sErrorList &= String.Format("Erron in compo {0} param {1}: do not exist.", m_CompoType.DDFName, sItems(0))
Return True
End If
End If
+ ' creo la stringa di errore
+ If Not String.IsNullOrEmpty(sErrorList) Then
+ sErrorList &= Environment.NewLine
+ sErrorList &= sErrorList
+ Else
+ sErrorList &= sErrorList
+ End If
Return False
End Function
-
Private m_TemplateVisibility As Visibility
Public Property TemplateVisibility As Visibility
Get
@@ -250,7 +425,7 @@ Public Class Compo
''' Execute the Exec. This method is invoked by the ExecCommand.
'''
Public Sub Apply()
- 'DdfFile.WriteDDF(m_rfCurrDoor, "c:\EgtData\EgtDOORCreator\Temp\CurrDoor.ddf")
+ DdfFile.WriteDDF(m_rfCurrDoor, "c:\EgtData\EgtDOORCreator\Temp\CurrDoor.ddf")
End Sub
#End Region ' ApplyCommand
@@ -352,8 +527,9 @@ Public Class TextBoxParam
End Set
End Property
- Sub New(sDDFName As String, sName As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String))
+ Sub New(sDDFName As String, sName As String, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String))
MyBase.New(sDDFName, sName)
+ m_Value = sValue
m_ComboBox = ComboBox
m_ComboValuelList = ComboValuelList
End Sub
@@ -392,10 +568,11 @@ Public Class ComboBoxParam
End Set
End Property
- Sub New(sDDFName As String, sName As String, ItemList As List(Of String), ItemListDDF As List(Of String))
+ Sub New(sDDFName As String, sName As String, ItemList As List(Of String), ItemListDDF As List(Of String), sSelItem As String)
MyBase.New(sDDFName, sName)
m_ItemList = ItemList
m_ItemListDDF = ItemListDDF
+ m_SelItem = sSelItem
End Sub
End Class
@@ -413,7 +590,7 @@ Public Class TextBoxOnOffParam
End Set
End Property
- Sub New(sDDFName As String, sName As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String))
- MyBase.New(sDDFName, sName, ComboBox, ComboValuelList)
+ Sub New(sDDFName As String, sName As String, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String))
+ MyBase.New(sDDFName, sName, sValue, ComboBox, ComboValuelList)
End Sub
End Class
\ No newline at end of file
diff --git a/DoorParameters/Door.vb b/DoorParameters/Door.vb
index 32494b0..284cb88 100644
--- a/DoorParameters/Door.vb
+++ b/DoorParameters/Door.vb
@@ -8,6 +8,7 @@ Public Class Door
#Region "GENERAL"
+
#Region "Size"
Private m_SwingTypeList As List(Of String) = New List(Of String)({"LH", "RH", "LHA", "RHA", "LHI", "RHI", "LHRA", "RHRA", "LHRI", "RHRI"})
@@ -17,14 +18,14 @@ Public Class Door
End Get
End Property
- Private m_Height As String = String.Empty
+ ' inizializzo la misura dell'altezza della porta
+ Private m_Height As String = "10"
Public Property Height As String
Get
Return m_Height
End Get
Set(value As String)
m_Height = value
- NotifyPropertyChanged("Height")
End Set
End Property
@@ -38,7 +39,7 @@ Public Class Door
End Set
End Property
- Private m_Thickness As String = String.Empty
+ Private m_Thickness As String = "1"
Public Property Thickness As String
Get
Return m_Thickness
@@ -201,7 +202,7 @@ Public Class Door
#End Region ' General
- Private m_CompoList As New ObservableCollection(Of Compo)
+ Friend m_CompoList As New ObservableCollection(Of Compo)
Public Property CompoList As ObservableCollection(Of Compo)
Get
Return m_CompoList
@@ -217,8 +218,8 @@ Public Class Door
Dim ErrorList As String = String.Empty
' creo il nuovo compo
Dim NewCompo As New Compo(CurrCompoType, Me)
- ' Leggo il file ini del componente per vedere se c'è il template
- If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoType.Path) <> 0 Then
+ ' Leggo il file ini del componente per vedere se c'è il template: se c'è
+ If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME) <> 0 Then
' leggo nomi
Dim Name As String = String.Empty
Dim DDFName As String = String.Empty
@@ -229,231 +230,49 @@ Public Class Door
NewCompo.TemplateDDFName = DDFName
NewCompo.TemplateName = Name
NewCompo.TemplateItemList = TemplateList
-
+ ' se esiste un lista di template
If NewCompo.TemplateItemList.Count > 0 Then
- NewCompo.TemplateSelItem = NewCompo.TemplateItemList(0)
+ Dim SelItemindex As Integer = 0
+ ' cerco il primo elemento della lista che abbia estensione lua
+ While Path.HasExtension(NewCompo.TemplateItemList(SelItemindex)) And SelItemindex < NewCompo.TemplateItemList.Count - 1
+ SelItemindex += 1
+ End While
+ ' inizializzo la combobox template
+ NewCompo.TemplateSelItem = NewCompo.TemplateItemList(SelItemindex)
+
End If
-
+ ' se non c'è il template
Else
- ' altrimenti leggo il nome del compo da analizzare
- EgtUILib.GetPrivateProfileString(S_TEMPLATE, K_COMPO, "", NewCompo.TemplateSelItem, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME)
-
-
+ ' nascondo il template
+ NewCompo.TemplateVisibility = Visibility.Collapsed
+ ' leggo il nome del compo dal file config.ini
+ Dim sTemplateName As String = String.Empty
+ EgtUILib.GetPrivateProfileString(S_TEMPLATE, K_COMPO, "", sTemplateName, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME)
+ If String.IsNullOrWhiteSpace(sTemplateName) Then
+ ErrorList &= String.Format("Error reading {0} param in {1} compo.", K_COMPO, NewCompo.TemplateName)
+ NewCompo = Nothing
+ ElseIf Not File.Exists(CurrCompoType.Path & "\" & sTemplateName & ".lua") Then
+ ErrorList &= String.Format("Error reading {0} param in {1} compo.", K_COMPO, NewCompo.TemplateName)
+ NewCompo = Nothing
+ Else
+ NewCompo.TemplateSelItem = sTemplateName
+ End If
End If
- '' creo path completa e controllo l'estensione del file
- 'Dim TemplateFilePath As String = CurrCompoType.Path & "\" & NewCompo.TemplateSelItem
- 'If Not Path.HasExtension(TemplateFilePath) Then
- ' TemplateFilePath &= ".lua"
- 'End If
- '' carico il contenuto del file
- 'Dim TemplateFileContent() As String = File.ReadAllLines(TemplateFilePath)
- 'For LineIndex = 0 To TemplateFileContent.Count - 1
- ' Dim TemplateFileLine As String = TemplateFileContent(LineIndex)
- ' If RegexFunction.IsGraphicParametersTitle(TemplateFileLine) Then
- ' Dim ParamIndex As Integer = 1
- ' Dim NewCompoParam As CompoParam = Nothing
- ' While ReadParam(TemplateFileContent(LineIndex + ParamIndex), ParamIndex, NewCompoParam, NewCompo, ErrorList)
- ' If Not IsNothing(NewCompoParam) Then
- ' NewCompo.CompoParamList.Add(NewCompoParam)
- ' End If
- ' ParamIndex += 1
- ' End While
- ' Exit For
- ' End If
- 'Next
+ ' raggruppo tutte le componenti che hanno lo stesso nome vicine
If Not IsNothing(NewCompo) Then
+ Dim CompoIndex = 0
+ For CompoIndex = 0 To m_CompoList.Count - 1
+ ' inserisco la nuova componente
+ If NewCompo.CompoType.DDFName = m_CompoList(CompoIndex).CompoType.DDFName Then
+ CompoList.Insert(CompoIndex, NewCompo)
+ Exit For
+ End If
+ Next
m_CompoList.Add(NewCompo)
End If
- ' creo il nuovo compo
- 'Dim NewCompo As New Compo(Me)
- '' lo modifico in base al tipo passatomi
- 'CompoGetPrivateProfileNameGroup(IniCompoName, ConstCompo.K_NAME, NewCompo.NameDDF, NewCompo.Name)
- 'If Not CompoGetPrivateProfileComboBox(IniCompoName, ConstCompo.K_COMBOBOX & 1, NewCompo.ComboBox1DDFName, NewCompo.ComboBox1Name) Then
- ' NewCompo.ComboBox2Visibility = Visibility.Collapsed
- 'End If
+ Return CompoList.Count - 1
- 'Select Case CompoGetPrivateProfileComboBoxList(IniCompoName, ConstCompo.K_COMBOBOX & 1 & ConstCompo.K_LIST, NewCompo.ComboBox1List, NewCompo.ComboBox1ListDDF)
- ' Case ComboListResult.NOTFOUND
- ' NewCompo.ComboBox1Visibility = Visibility.Collapsed
- ' Case ComboListResult.FOUND
- ' NewCompo.ComboBox1Visibility = Visibility.Visible
- ' Case ComboListResult.MISTAKE
- ' Return -1
- 'End Select
-
- 'If Not CompoGetPrivateProfileComboBox(IniCompoName, ConstCompo.K_COMBOBOX & 2, NewCompo.ComboBox2DDFName, NewCompo.ComboBox2Name) Then
- ' NewCompo.ComboBox2Visibility = Visibility.Collapsed
- 'End If
-
- 'Select Case CompoGetPrivateProfileComboBoxList(IniCompoName, ConstCompo.K_COMBOBOX & 2 & ConstCompo.K_LIST, NewCompo.ComboBox2List, NewCompo.ComboBox2ListDDF)
- ' Case ComboListResult.NOTFOUND
- ' NewCompo.ComboBox2Visibility = Visibility.Collapsed
- ' Case ComboListResult.FOUND
- ' NewCompo.ComboBox2Visibility = Visibility.Visible
- ' Case ComboListResult.MISTAKE
- ' Return -1
- 'End Select
-
- 'If Not CompoGetPrivateProfileComboBox(IniCompoName, ConstCompo.K_COMBOBOX & 3, NewCompo.ComboBox3DDFName, NewCompo.ComboBox3Name) Then
- ' NewCompo.ComboBox3Visibility = Visibility.Collapsed
- 'End If
-
- 'Select Case CompoGetPrivateProfileComboBoxList(IniCompoName, ConstCompo.K_COMBOBOX & 3 & ConstCompo.K_LIST, NewCompo.ComboBox3List, NewCompo.ComboBox3ListDDF)
- ' Case ComboListResult.NOTFOUND
- ' NewCompo.ComboBox3Visibility = Visibility.Collapsed
- ' Case ComboListResult.FOUND
- ' NewCompo.ComboBox3Visibility = Visibility.Visible
- ' Case ComboListResult.MISTAKE
- ' Return -1
- 'End Select
-
- '' TextBox
- 'If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 1, NewCompo.TextBox1DDFName, NewCompo.TextBox1Name) Then
- ' NewCompo.TextBox1Visibility = Visibility.Collapsed
- 'End If
-
- 'If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 2, NewCompo.TextBox2DDFName, NewCompo.TextBox2Name) Then
- ' NewCompo.TextBox2Visibility = Visibility.Collapsed
- 'End If
-
- 'If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 3, NewCompo.TextBox3DDFName, NewCompo.TextBox3Name) Then
- ' NewCompo.TextBox3Visibility = Visibility.Collapsed
- 'End If
-
- 'If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 4, NewCompo.TextBox4DDFName, NewCompo.TextBox4Name) Then
- ' NewCompo.TextBox4Visibility = Visibility.Collapsed
- 'End If
-
- 'If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 5, NewCompo.TextBox5DDFName, NewCompo.TextBox5Name) Then
- ' NewCompo.TextBox5Visibility = Visibility.Collapsed
- 'End If
-
- '' gestione SpecialTextBox
- 'Dim nComboIndex As Integer = 0
- 'Dim SpecialList As New List(Of String)
- 'If CompoGetPrivateProfileSpecialTextBox(IniCompoName, ConstCompo.K_SPECIALTEXTBOX & 1, NewCompo.SpecialTextBox1DDFName, NewCompo.SpecialTextBox1Name, nComboIndex, SpecialList) Then
- ' Select Case nComboIndex
- ' Case 1
- ' NewCompo.ComboBox1SpecialList = SpecialList
- ' Case 2
- ' NewCompo.ComboBox2SpecialList = SpecialList
- ' Case 3
- ' NewCompo.ComboBox3SpecialList = SpecialList
- ' End Select
- 'End If
- '' nascondo la SpecialTextBox
- 'NewCompo.SpecialTextBox1Visibility = Visibility.Collapsed
-
- 'Dim bFound As Boolean = False
- 'For CompoIndex = 0 To m_CompoList.Count - 1
- ' If m_CompoList(CompoIndex).NameDDF = NewCompo.NameDDF Then
- ' bFound = True
- ' ElseIf bFound Then
- ' CompoList.Insert(CompoIndex, NewCompo)
- ' Return CompoIndex
- ' End If
- 'Next
-
- 'CompoList.Add(NewCompo)
- 'Return CompoList.Count - 1
-
- End Function
-
- Private Function ReadParam(sLine As String, nParamIndex As Integer, ByRef NewCompoParam As CompoParam, Compo As Compo, sErrorList As String) As Boolean
- Dim ReadLine As String = ParamLine(sLine, "Param" & nParamIndex)
- If Not String.IsNullOrWhiteSpace(ReadLine) Then
- Dim sItems() As String = ReadLine.Split(";"c)
- If sItems.Count > 0 Then
- Select Case sItems(0)
- Case "ComboBox"
- If sItems.Count >= 4 Then
- Dim sComboItemList() As String = sItems(3).Split(","c)
- Dim ComboItemList As New List(Of String)
- Dim DDFComboItemList As New List(Of String)
- For ItemIndex = 0 To sComboItemList.Count - 1
- Dim ComboItem() As String = sComboItemList(ItemIndex).Split("/"c)
- DDFComboItemList.Add(ComboItem(0))
- ComboItemList.Add(Utility.ReadMsg(ComboItem(1)))
- Next
- NewCompoParam = New ComboBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), ComboItemList, DDFComboItemList)
- Return True
- Else
- sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), Compo.CompoType.DDFName)
- End If
- Case "TextBox"
- If sItems.Count >= 3 Then
- If sItems.Count > 3 Then
- Dim DDFComboValuelList As New List(Of String)
- Dim sComboItemList() As String = sItems(4).Split(","c)
- For ItemIndex = 0 To sComboItemList.Count - 1
- DDFComboValuelList.Add(sComboItemList(ItemIndex))
- Next
- For ParamIndex = 0 To Compo.CompoParamList.Count - 1
- Dim CurrCompoParam As CompoParam = Compo.CompoParamList(ParamIndex)
- If CurrCompoParam.DDFName = sItems(3) Then
- If TypeOf CurrCompoParam Is ComboBoxParam Then
- NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), DirectCast(CurrCompoParam, ComboBoxParam), DDFComboValuelList)
- Return True
- Else
- NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
- Return True
- End If
- Exit For
- End If
- Next
- NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
- Return True
- Else
- NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
- Return True
- End If
- Else
- If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
- sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), Compo.CompoType.DDFName)
- End If
- Case "TextBoxOnOff"
- If sItems.Count >= 3 Then
- If sItems.Count > 3 Then
- Dim DDFComboValuelList As New List(Of String)
- Dim sComboItemList() As String = sItems(4).Split(","c)
- For ItemIndex = 0 To sComboItemList.Count - 1
- DDFComboValuelList.Add(sComboItemList(ItemIndex))
- Next
- For ParamIndex = 0 To Compo.CompoParamList.Count - 1
- Dim CurrCompoParam As CompoParam = Compo.CompoParamList(ParamIndex)
- If CurrCompoParam.DDFName = sItems(3) Then
- If TypeOf CurrCompoParam Is ComboBoxParam Then
- NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), DirectCast(CurrCompoParam, ComboBoxParam), DDFComboValuelList)
- Return True
- Else
- NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
- Return True
- End If
- Exit For
- End If
- Next
- NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
- Return True
- Else
- NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
- Return True
- End If
- Else
- If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
- sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), Compo.CompoType.DDFName)
- End If
- End Select
- If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
- If sItems.Count >= 2 Then
- sErrorList &= String.Format("Erron in compo {0} param {1}: type {2} do not exist.", Compo.CompoType.DDFName, sItems(1), sItems(0))
- Else
- sErrorList &= String.Format("Erron in compo {0}: type {1} do not exist.", Compo.CompoType.DDFName, sItems(0))
- End If
- Return True
- End If
- End If
- Return False
End Function
Friend Sub RemoveCompo(CompoToRemove As Compo)
diff --git a/EgtDOORCreator.vbproj b/EgtDOORCreator.vbproj
index 7c4be56..bccd81d 100644
--- a/EgtDOORCreator.vbproj
+++ b/EgtDOORCreator.vbproj
@@ -92,6 +92,7 @@
+
DoorManagerView.xaml
diff --git a/IniFile.vb b/IniFile.vb
index a11f67c..a1232df 100644
--- a/IniFile.vb
+++ b/IniFile.vb
@@ -253,7 +253,6 @@ Friend Module IniFile
End Sub
Friend Sub RecursiveOpenDirectory(DirectoryPath As String, ByRef ComboList As List(Of String), InitialDirectory As String)
-
Dim SubDir() As String = Directory.GetDirectories(DirectoryPath)
For Index = 0 To SubDir.Count - 1
RecursiveOpenDirectory(SubDir(Index), ComboList, InitialDirectory)