diff --git a/AssemblyManager/AssemblyManagerVM.vb b/AssemblyManager/AssemblyManagerVM.vb
index b033629..36a20b0 100644
--- a/AssemblyManager/AssemblyManagerVM.vb
+++ b/AssemblyManager/AssemblyManagerVM.vb
@@ -91,6 +91,16 @@ Public Class AssemblyManagerVM
Public Function Save(SavedAssName As AssemblyName) As Boolean
If IsNothing(SavedAssName) OrElse IsNothing(SavedAssName.SelAssembly) Then Return False
+ Dim ErrorMessages As String = String.Empty
+ Dim sTempFile As String = IniFile.m_sTempDir & "\" & TEMP_FILE
+ DdfFile.SaveErrorCompo = True
+ Map.refSceneManagerVM.RefreshBtn()
+ DdfFile.SaveErrorCompo = False
+ Dim bConfirmSavin As Boolean = False
+ ' verifico se il ddf presenta degli errori, se ignoro gli errori salvo
+ bConfirmSavin = ConfirmSaving(DdfFile.ErrorInWriting)
+ If Not bConfirmSavin Then Return False
+ Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False
' Salvo
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then
' questa condizione non DOVREBBE mai accadere, perchè viene interrotto prima il caricamento
@@ -104,24 +114,17 @@ Public Class AssemblyManagerVM
End If
Else
DdfFile.SaveErrorCompo = True
- DdfFile.WriteDDFPart(SavedAssName.SelAssembly.ListPartDoorOfDoor(0).Door, SavedAssName.Name, True, False)
+ DdfFile.WriteDDFPart(SavedAssName.SelAssembly.ListPartDoor(0).Door, SavedAssName.Name, True, False)
DdfFile.SaveErrorCompo = False
End If
Else
DdfFile.SaveErrorCompo = True
- DdfFile.WriteDDFAssembly(SavedAssName.SelAssembly, SavedAssName.Name, True)
+ DdfFile.WriteDDFAssembly(SavedAssName.SelAssembly, sTempFile, True)
DdfFile.SaveErrorCompo = False
End If
' controllo che il salvataggio sia andato a buon fine
- If Not String.IsNullOrEmpty(DdfFile.ErrorInWriting) Then
- DdfFile.ErrorInWriting &= "Do you want to procede?"
- If MessageBox.Show(DdfFile.ErrorInWriting, EgtMsg(50101), MessageBoxButton.YesNo, MessageBoxImage.Error) = MessageBoxResult.Yes Then
- DdfFile.DDFIsCorrect = True
- Else
- Return False
- End If
- End If
- If DdfFile.DDFIsCorrect Then
+
+ If bConfirmSavin Then
SavedAssName.IsModified = False
' ogni progetto salvato è l'ultimo da aprire, anche se il programma è chiuso dall'HardwareManager
WriteMainPrivateProfileString(S_LAUNCHERWINDOW, K_LASTPROJECT, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name)
@@ -132,6 +135,19 @@ Public Class AssemblyManagerVM
Return True
End Function
+ ' in fase di scrittura del file dei messaggi leggo gli errori che sono stati comunicati
+ Private Function ConfirmSaving(sMessages As String) As Boolean
+ If Not String.IsNullOrEmpty(sMessages) Then
+ DdfFile.ErrorInWriting &= "Do you want to procede?"
+ If MessageBox.Show(DdfFile.ErrorInWriting, EgtMsg(50101), MessageBoxButton.YesNo, MessageBoxImage.Error) = MessageBoxResult.Yes Then
+ DdfFile.DDFIsCorrect = True
+ Else
+ DdfFile.DDFIsCorrect = False
+ End If
+ End If
+ Return DdfFile.DDFIsCorrect
+ End Function
+
' rileggo le componenti caricate di default e se possibile le correggo
Public Function RefreshAssembly(Optional ErCompo As Compo = Nothing) As Boolean
' se ricevo una componente specifica non controllo solo qella
@@ -334,14 +350,236 @@ Public Class AssemblyManagerVM
ErrCompo.LoadByDefault = True
Return False
End If
-
- ' termmino la creazione della nuova componente
- m_CurrCompo.CompoParamList = ErrCompo.CompoParamList
+ Dim s As String = String.Empty
+ m_CurrCompo.m_ParameterDDfList = ErrCompo.m_ParameterDDfList
+ ReadParams(m_CurrCompo, s)
ErrCompo.LoadByDefault = False
- ErrCompo = m_CurrCompo
+ m_CurrCompo.LoadByDefault = False
+ ErrCompo.CompoParamList = m_CurrCompo.CompoParamList
+ CurrPart.CompoList.Add(m_CurrCompo)
+ ErrCompo.Delete()
Return True
End Function
+ ' Leggo i parametri del componente
+ Private Sub ReadParams(ByRef CompoTemplateItem As Compo, ByRef sErrorInfo As String)
+ Dim IndexLine As Integer = 0
+ If CompoTemplateItem.m_ParameterDDfList.Count < 1 Then Return
+ Dim FileContent As List(Of String) = CompoTemplateItem.m_ParameterDDfList
+
+ ' questo è l'indice dei parametri del componente
+ Dim IndexParam As Integer = 0
+ Dim ErrParamList As New List(Of String)
+ While IndexParam < CompoTemplateItem.CompoParamList.Count
+ ' carico la lista dei parametri della componente parametro per parametro
+ Dim CurrCompoParam As CompoParam = CompoTemplateItem.CompoParamList(IndexParam)
+ ' Controllo che il file non sia terminato
+ If IndexLine < FileContent.Count Then
+ Dim sLine As String = RemoveComment(FileContent(IndexLine))
+ ' se stringa vuota o tutto commento, vado oltre
+ If String.IsNullOrWhiteSpace(sLine) Then
+ IndexLine += 1
+ Continue While
+ End If
+ ' se fine pezzo o fine file o nome o metacomando, esco dal ciclo
+ If Search3Hyphens(sLine) OrElse Search3Dots(sLine) OrElse
+ Not String.IsNullOrWhiteSpace(GetName(sLine)) OrElse
+ sLine.Trim().StartsWith(DDF_METADATA) Then
+ If Not TypeOf CurrCompoParam Is TextBoxOnOffParam AndAlso Not TypeOf CurrCompoParam Is ComboBoxOnOffParam Then
+ ' restituisco il messaggio che manca un parametro
+ ' Error in reading: line {0}. Expected {1}.
+ sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
+ ' All missing params will be initialized by default.
+ sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50140)) & vbCrLf
+ Part.FirstReadingEdge = True
+ CompoTemplateItem.MissingParameter = True
+ CurrCompoParam.MissingParameterInReading = True
+ Else
+ ' significa che la TextBoxOnOff è stata disattivata
+ If TypeOf CurrCompoParam Is TextBoxOnOffParam Then DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
+ If TypeOf CurrCompoParam Is ComboBoxOnOffParam Then DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
+ End If
+ Exit While
+ End If
+ ' Se è di tipo obbligatorio (non è OnOff)
+ If Not (TypeOf CurrCompoParam Is TextBoxOnOffParam OrElse TypeOf CurrCompoParam Is ComboBoxOnOffParam) Then
+ Dim sKey As String = GetKey(sLine)
+ ' se il nome del parametro è lo stesso di quello presente nel componente
+ If String.Equals(Trim(CurrCompoParam.DDFName), sKey) Then
+ If TypeOf CurrCompoParam Is ComboBoxParam Then
+ ' leggo il valore DDF dal file
+ Dim sVal As String = GetValueWithoutKey(sLine)
+ ' carico la lista dei valori (messaggi)
+ Dim List As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemList
+ ' carico la lista dei valori DDF
+ Dim ListDDF As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemListDDF
+ ' riscrivo i valori della lista DDF senza spazi all'inizio e alla fine e in minuscolo
+ For IndexListDDF As Integer = 0 To ListDDF.Count - 1
+ ListDDF(IndexListDDF) = Trim(ListDDF(IndexListDDF)).ToLower()
+ Next
+ ' carico il valore IndexName come indice del valore selezionato dalla lista DDF
+ Dim IndexName As Integer = ListDDF.IndexOf(sVal.ToLower())
+ Dim SelItem As String = String.Empty
+ ' se è stata trovata una corrispondenza tra il valore letto dal file e il valore presente nella lista DDF
+ If IndexName >= 0 Then
+ ' restituisco il valore DDF della lista associato all'indice passato
+ SelItem = List(IndexName)
+ Else
+ ' il nome DDF non è corretto
+ ' Error in reading {0}: line {1}. It is not a member of the list.
+ sErrorInfo &= String.Format(EgtMsg(50137), sVal, IndexLine)
+ ' This param will be initialized by default.
+ sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
+ ' aggiungo un nuovo elemento solo nella lista da mostrare a video, quella dei ddf non deve essere toccata
+ List.Add(sVal)
+ SelItem = List(List.Count - 1)
+ CompoTemplateItem.ErrorValue = True
+ CurrCompoParam.ErrorInReading = True
+ ' SelItem = List(0)
+ End If
+ ' assegno al parametro del componente il valore "filtrato"
+ DirectCast(CurrCompoParam, ComboBoxParam).SetSelItem(SelItem)
+ ' assegno il valore letto alla textbox
+ ElseIf TypeOf CurrCompoParam Is TextBoxParam Then
+ Dim sVal As String = GetValueWithoutKey(sLine)
+ ' per ora non esegue nessun tipo di controllo sui valori letti dal file DDF
+ DirectCast(CurrCompoParam, TextBoxParam).SetValue(sVal)
+ ' avviso che il file è modificato (in caso di chiusura del programma obbligo a passare dal salvataggio)
+ Dim dVal As Double
+ If String.IsNullOrEmpty(sVal) OrElse Not StringToDouble(sVal, dVal) Then
+ ' Part.FirstReadingEdge = True
+ CompoTemplateItem.ErrorValue = True
+ CurrCompoParam.ErrorInReading = True
+ End If
+ End If
+ ' se il nome esiste ma è sbagliato
+ ElseIf Not String.IsNullOrWhiteSpace(sKey) Then
+ ' se il nome non è preceduto dal trattino
+ If Not sKey.StartsWith("- ") Then
+ ' il nome DDF non è corretto
+ ' Error in reading: line {0}. Expected {1}.
+ sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
+ ' This param will be initialized by default.
+ sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
+ Part.FirstReadingEdge = True
+ CompoTemplateItem.MissingParameter = True
+ CurrCompoParam.MissingParameterInReading = True
+ ' passo al parametro successivo senza cambiare linea del file DDF
+ IndexParam += 1
+ Continue While
+ Else
+ ' istanzio tutti i valori che mancano al compo corrente di default
+ ' Error in reading: line {0}. Expected {1}.
+ sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
+ ' This param will be initialized by default.
+ sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
+ ' avviso che il file in scrittura è differente da quello in lettura
+ Part.FirstReadingEdge = True
+ CompoTemplateItem.MissingParameter = True
+ CurrCompoParam.MissingParameterInReading = True
+ ' esco dal ciclo
+ Exit While
+ End If
+ End If
+ ' Se altrimenti è una TextBoxOnOff
+ ElseIf TypeOf CurrCompoParam Is TextBoxOnOffParam Then
+ ' se il nome del parametro è lo stesso di quello presente nel componente
+ If String.Equals(Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName), GetKey(sLine)) Then
+ ' se la stringa c'è nel DDF vuol dire che è stata selezionata
+ Dim sVal As String = GetValueWithKey(sLine, Trim(CurrCompoParam.DDFName))
+ DirectCast(CurrCompoParam, TextBoxOnOffParam).Value = sVal
+ Dim dVal As Double
+ If String.IsNullOrEmpty(sVal) OrElse Not StringToDouble(sVal, dVal) Then
+ CompoTemplateItem.ErrorValue = True
+ CurrCompoParam.ErrorInReading = True
+ End If
+ DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(True)
+ ' se il nome esiste ma è sbagliato
+ ElseIf Not String.IsNullOrWhiteSpace(GetKey(sLine)) Then
+ ' significa che la TextBoxOnOff è stata disattivata
+ DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
+ ' passo al parametro successivo senza cambiare linea del file DDF
+ IndexParam += 1
+ Continue While
+ End If
+ ' Altrimenti è una ComboBoxOnOffParam
+ Else
+ ' se il nome del parametro è lo stesso di quello presente nel componente
+ If String.Equals(Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName), Trim(GetKey(sLine))) Then
+ ' leggo il valore DDF dal file
+ Dim sVal As String = GetValueWithKey(sLine, Trim(CurrCompoParam.DDFName))
+ Dim IndexName As Integer = 0
+ ' carico la lista dei valori (messaggi)
+ Dim List As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxOnOffParam).ItemList
+ Dim IndexListDDF As Integer = 0
+ ' carico la lista dei valori DDF
+ Dim ListDDF As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxOnOffParam).ItemListDDF
+ ' riscrivo i valori della lista DDF senza spaziatura
+ For IndexListDDF = 0 To ListDDF.Count - 1
+ ListDDF(IndexListDDF) = Trim(ListDDF(IndexListDDF))
+ Next
+ ' carico il valore IndexName come indice del valore selezionato dalla lista DDF
+ IndexName = ListDDF.IndexOf(sVal)
+ Dim SelItem As String = String.Empty
+ ' se è stata trovata una corrispondenza tra il valore letto dal file e il valore presente nella lista DDF
+ If IndexName >= 0 Then
+ ' restituisco il valore DDF della lista associato all'indice passato
+ SelItem = Trim(List(IndexName))
+ Else
+ ' il nome DDF non è corretto
+ ' Error in reading {0}: line {1}. It is not a member of the list.
+ sErrorInfo &= String.Format(EgtMsg(50137), sVal, IndexLine)
+ ' This param will be initialized by default.
+ sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
+ ' aggiungo un nuovo elemento solo nella lista da mostrare a video, quella dei ddf non deve essere toccata
+ List.Add(sVal)
+ SelItem = List(List.Count - 1)
+ CompoTemplateItem.ErrorValue = True
+ CurrCompoParam.ErrorInReading = True
+ 'SelItem = List(0)
+ End If
+ ' assegno al parametro della compnente il valore "filtrato"
+ DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetSelItem(SelItem)
+ ' se il nome esiste ma è sbagliato
+ ElseIf Not String.IsNullOrWhiteSpace(GetKey(sLine)) Then
+ ' significa che la TextBoxOnOff è stata disattivata
+ DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
+ ' passo al parametro successivo senza cambiare linea del file DDF
+ IndexParam += 1
+ Continue While
+ End If
+ End If
+ Else
+ If TypeOf DirectCast(CompoTemplateItem.CompoParamList(IndexParam), CompoParam) Is TextBoxOnOffParam Then
+ DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
+ ElseIf TypeOf DirectCast(CompoTemplateItem.CompoParamList(IndexParam), CompoParam) Is ComboBoxOnOffParam Then
+ DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
+ Else
+ ' Error in reading: line {0}. Expected {1}.
+ sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
+ ' All missing params will be initialized by default.
+ sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50140)) & vbCrLf
+ Part.FirstReadingEdge = True
+ CompoTemplateItem.MissingParameter = True
+ CurrCompoParam.MissingParameterInReading = True
+ For Index As Integer = IndexParam To CompoTemplateItem.CompoParamList.Count - 1
+ 'If TypeOf DirectCast(CompoTemplateItem.CompoParamList(Index), CompoParam) Is TextBoxOnOffParam Then
+ ' DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
+ 'ElseIf TypeOf DirectCast(CompoTemplateItem.CompoParamList(Index), CompoParam) Is ComboBoxOnOffParam Then
+ ' DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
+ 'Else
+ CompoTemplateItem.CompoParamList(Index).MissingParameterInReading = True
+ 'End If
+ Next
+ End If
+ End If
+ ' Avanzo nell'elenco dei parametri e nel file DDF
+ IndexParam += 1
+ IndexLine = SkipWhiteSpaceList(FileContent, IndexLine + 1)
+ End While
+
+ End Sub
+
' verifica che la componente non riceva un errore in fase di inserimento di un parametro
Public Function RecreateCompoParm(ByRef ErrCompo As Compo, CurrPart As Part) As Boolean
Dim CompoListIndex As Integer = SearchCompotypeIndex(ErrCompo.CompoType.DDFName)
@@ -362,9 +600,9 @@ Public Class AssemblyManagerVM
For IndexItem = 0 To Param.ItemListDDF.Count - 1
If Param.SelItem = Param.ItemList(IndexItem) Then
If Param.ItemList.Count > Param.ItemListDDF.Count Then
+ ErrCompo.CompoParamList(IndexParam).ErrorInReading = False
Param.ItemList.RemoveAt(Param.ItemList.Count - 1)
End If
- Param.ErrorInReading = False
Exit For
End If
Next
@@ -390,12 +628,19 @@ Public Class AssemblyManagerVM
Next
ErrCompo.ErrorValue = False
+ ErrCompo.MissingParameter = False
For Each Param In ErrCompo.CompoParamList
If Param.ErrorInReading Then
ErrCompo.ErrorValue = True
Exit For
End If
Next
+ For Each Param In ErrCompo.CompoParamList
+ If Param.MissingParameterInReading Then
+ ErrCompo.MissingParameter = True
+ Exit For
+ End If
+ Next
Return True
End Function
diff --git a/DdfFile.vb b/DdfFile.vb
index f924c43..cf8a947 100644
--- a/DdfFile.vb
+++ b/DdfFile.vb
@@ -842,6 +842,18 @@ Friend Module DdfFile
' aggiungo " - nomeTemplate: TemplateSelezionato"
If Compo.LoadByDefault And Not SaveErrorCompo Then
CompoListDDF.Add(DDF_METADATA & DDF_HYPHEN & Compo.TemplateDDFName & ": " & Compo.TemplateSelItem)
+ ElseIf Compo.LoadByDefault And SaveErrorCompo Then
+ CompoListDDF.Add(DDF_HYPHEN & Compo.TemplateDDFName & ": " & Compo.TemplateSelItem)
+ If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
+ ' Compo {0} does not exist
+ sErrorList &= String.Format("Compo {0} does not exist.", Compo.SelBrandPart & "\" & Compo.SelFile)
+ If Compo.m_ParameterDDfList.Count > 0 Then
+ For Each ItemLine In Compo.m_ParameterDDfList
+ CompoListDDF.Add(ItemLine)
+ Next
+ End If
+ Return CompoListDDF
+ ParamInCompoIsCorrect = False
Else
CompoListDDF.Add(DDF_HYPHEN & Compo.TemplateDDFName & ": " & Compo.TemplateSelItem)
End If
@@ -852,7 +864,8 @@ Friend Module DdfFile
' scrivo tutti i parametri della compo
For ParamIndex = 0 To Compo.CompoParamList.Count - 1
Dim CurrCompoParam As CompoParam = Compo.CompoParamList(ParamIndex)
- ' ComboBox
+
+ ' ComboBoxOnOff
If TypeOf CurrCompoParam Is ComboBoxOnOffParam Then
Dim cbParam As ComboBoxOnOffParam = DirectCast(CurrCompoParam, ComboBoxOnOffParam)
If cbParam.IsActive Then
@@ -879,79 +892,155 @@ Friend Module DdfFile
ParamInCompoIsCorrect = False
End If
End If
+
+ ' ComboBox
ElseIf TypeOf CurrCompoParam Is ComboBoxParam Then
Dim cbParam As ComboBoxParam = DirectCast(CurrCompoParam, ComboBoxParam)
- ' recupero l'indice dell'elemento selezionato
- Dim IndexDDF As Integer = -1
- If Not String.IsNullOrWhiteSpace(cbParam.SelItem) Then
- ' raccolgo il valore IndexDDF come indice del valore selezionato dalla lista
- IndexDDF = cbParam.ItemList.IndexOf(cbParam.SelItem)
- End If
- ' controllo che sia selezionato un elemento
- If IndexDDF >= 0 AndAlso IndexDDF < cbParam.ItemListDDF.Count() Then
- ' restituisco il valore DDF della lista associato all'indice passato
- Dim SelItemDDF As String = Trim(cbParam.ItemListDDF(IndexDDF))
- If Compo.LoadByDefault And Not SaveErrorCompo Then
- CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & cbParam.DDFName & ": " & SelItemDDF)
- Else
- CompoListDDF.Add(DDF_SPACE5 & cbParam.DDFName & ": " & SelItemDDF)
+ If Not cbParam.ErrorInReading And Not cbParam.MissingParameterInReading Then
+ ' recupero l'indice dell'elemento selezionato
+ Dim IndexDDF As Integer = -1
+ If Not String.IsNullOrWhiteSpace(cbParam.SelItem) Then
+ ' raccolgo il valore IndexDDF come indice del valore selezionato dalla lista
+ IndexDDF = cbParam.ItemList.IndexOf(cbParam.SelItem)
+ End If
+ ' controllo che sia selezionato un elemento
+ If IndexDDF >= 0 AndAlso IndexDDF < cbParam.ItemListDDF.Count() Then
+ ' restituisco il valore DDF della lista associato all'indice passato
+ Dim SelItemDDF As String = Trim(cbParam.ItemListDDF(IndexDDF))
+ If Compo.LoadByDefault And Not SaveErrorCompo Then
+ CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & cbParam.DDFName & ": " & SelItemDDF)
+ Else
+ CompoListDDF.Add(DDF_SPACE5 & cbParam.DDFName & ": " & SelItemDDF)
+ End If
+ Else
+ ' se non è selezionato nessun elemento (cosa impossibile...)
+ If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
+ ' 50125: Error reading {0} param in {1} compo: do not exist value.
+ sErrorList &= String.Format(EgtMsg(50125), cbParam.Name, Compo.CompoType.DDFName)
+ ParamInCompoIsCorrect = False
+ If Compo.LoadByDefault And Not SaveErrorCompo Then
+ CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & cbParam.DDFName & ": " & cbParam.SelItem)
+ Else
+ CompoListDDF.Add(DDF_SPACE5 & cbParam.DDFName & ": " & cbParam.SelItem)
+ End If
+ End If
+ ElseIf Not cbParam.ErrorInReading And cbParam.MissingParameterInReading Then
+ ' recupero l'indice dell'elemento selezionato
+ Dim IndexDDF As Integer = -1
+ If Not String.IsNullOrWhiteSpace(cbParam.SelItem) Then
+ ' raccolgo il valore IndexDDF come indice del valore selezionato dalla lista
+ IndexDDF = cbParam.ItemList.IndexOf(cbParam.SelItem)
+ End If
+ ' controllo che sia selezionato un elemento
+ If IndexDDF >= 0 AndAlso IndexDDF < cbParam.ItemListDDF.Count() Then
+ ' restituisco il valore DDF della lista associato all'indice passato
+ Dim SelItemDDF As String = Trim(cbParam.ItemListDDF(IndexDDF))
+ If Compo.LoadByDefault And Not SaveErrorCompo Then
+ CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & cbParam.DDFName & ": " & SelItemDDF)
+ Else
+ CompoListDDF.Add(DDF_SPACE5 & cbParam.DDFName & ": " & SelItemDDF)
+ End If
+ Else
+ ' se non è selezionato nessun elemento (cosa impossibile...)
+ If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
+ ' 50125: Error reading {0} param in {1} compo: do not exist value.
+ sErrorList &= String.Format(EgtMsg(50125), cbParam.Name, Compo.CompoType.DDFName)
+ ParamInCompoIsCorrect = False
+ If Compo.LoadByDefault And Not SaveErrorCompo Then
+ CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & cbParam.DDFName & ": " & cbParam.SelItem)
+ Else
+ CompoListDDF.Add(DDF_SPACE5 & cbParam.DDFName & ": " & cbParam.SelItem)
+ End If
End If
-
Else
- ' se non è selezionato nessun elemento (cosa impossibile...)
- If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
- ' 50125: Error reading {0} param in {1} compo: do not exist value.
+ ' Error in reading {0} in compo {1}.
sErrorList &= String.Format(EgtMsg(50125), cbParam.Name, Compo.CompoType.DDFName)
ParamInCompoIsCorrect = False
+ If Compo.LoadByDefault And Not SaveErrorCompo Then
+ CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & cbParam.DDFName & ": " & cbParam.SelItem)
+ Else
+ CompoListDDF.Add(DDF_SPACE5 & cbParam.DDFName & ": " & cbParam.SelItem)
+ End If
End If
' TextBox Opzionale
- ElseIf TypeOf CurrCompoParam Is TextBoxOnOffParam Then
- Dim tboParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam)
- If Not String.IsNullOrWhiteSpace(tboParam.ToolTipValue) AndAlso tboParam.IsActive Then
- ' se è stata inserita un'espressione non valida restituisco un errore (50143: Invalid expression.)
- If tboParam.ToolTipValue = EgtMsg(50143) Then
- If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
- ' 50122: Error reading {0} param in {1} compo.
- sErrorList &= String.Format(EgtMsg(50122), tboParam.Name, Compo.CompoType.DDFName)
- If Compo.LoadByDefault And Not SaveErrorCompo Then
- CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & tboParam.DDFName & ": ")
- ParamInCompoIsCorrect = False
- Else
- CompoListDDF.Add(DDF_SPACE5 & tboParam.DDFName & ": ")
- ParamInCompoIsCorrect = False
- End If
- Else
- If bIsDDF Then
+ ElseIf TypeOf CurrCompoParam Is TextBoxOnOffParam Then
+ Dim tboParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam)
+ If Not String.IsNullOrWhiteSpace(tboParam.ToolTipValue) AndAlso tboParam.IsActive Then
+ ' se è stata inserita un'espressione non valida restituisco un errore (50143: Invalid expression.)
+ If tboParam.ToolTipValue = EgtMsg(50143) Then
+ If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
+ ' 50122: Error reading {0} param in {1} compo.
+ sErrorList &= String.Format(EgtMsg(50122), tboParam.Name, Compo.CompoType.DDFName)
If Compo.LoadByDefault And Not SaveErrorCompo Then
- CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & tboParam.DDFName & ": " & tboParam.ToolTipValue)
+ CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & tboParam.DDFName & ": ")
+ ParamInCompoIsCorrect = False
Else
- CompoListDDF.Add(DDF_SPACE5 & tboParam.DDFName & ": " & tboParam.ToolTipValue)
+ CompoListDDF.Add(DDF_SPACE5 & tboParam.DDFName & ": ")
+ ParamInCompoIsCorrect = False
End If
Else
- If Compo.LoadByDefault And Not SaveErrorCompo Then
- CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & tboParam.DDFName & ": " & tboParam.Value)
+ If bIsDDF Then
+ If Compo.LoadByDefault And Not SaveErrorCompo Then
+ CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & tboParam.DDFName & ": " & tboParam.ToolTipValue)
+ Else
+ CompoListDDF.Add(DDF_SPACE5 & tboParam.DDFName & ": " & tboParam.ToolTipValue)
+ End If
Else
- CompoListDDF.Add(DDF_SPACE5 & tboParam.DDFName & ": " & tboParam.Value)
+ If Compo.LoadByDefault And Not SaveErrorCompo Then
+ CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & tboParam.DDFName & ": " & tboParam.Value)
+ Else
+ CompoListDDF.Add(DDF_SPACE5 & tboParam.DDFName & ": " & tboParam.Value)
+ End If
End If
End If
+ ElseIf Not String.IsNullOrWhiteSpace(tboParam.ToolTipValue) AndAlso Not tboParam.IsActive Then
+ ' non restituire nessun tipo di errore
End If
- ElseIf Not String.IsNullOrWhiteSpace(tboParam.ToolTipValue) AndAlso Not tboParam.IsActive Then
- ' non restituire nessun tipo di errore
- End If
- ' TextBox
- ElseIf TypeOf CurrCompoParam Is TextBoxParam Then
+ ' TextBox
+ ElseIf TypeOf CurrCompoParam Is TextBoxParam Then
Dim tbParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam)
- If Not String.IsNullOrWhiteSpace(tbParam.ToolTipValue) Then
+ ' se c'è scritto qualcosa
+ If Not String.IsNullOrWhiteSpace(tbParam.ToolTipValue) And Not Compo.MissingParameter Then
' se è stata inserita un'espressine non valida restituisco un errore
If tbParam.ToolTipValue = EgtMsg(50143) Then
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
' 50122: Error reading {0} param in {1} compo.
sErrorList &= String.Format(EgtMsg(50122), tbParam.Name, Compo.CompoType.DDFName)
If Compo.LoadByDefault And Not SaveErrorCompo Then
- CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & tbParam.DDFName & ": ")
+ CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & tbParam.DDFName & ": " & tbParam.Value)
ParamInCompoIsCorrect = False
Else
- CompoListDDF.Add(DDF_SPACE5 & tbParam.DDFName & ": ")
+ CompoListDDF.Add(DDF_SPACE5 & tbParam.DDFName & ": " & tbParam.Value)
+ ParamInCompoIsCorrect = False
+ End If
+ Else
+ If bIsDDF Then
+ If Compo.LoadByDefault And Not SaveErrorCompo Then
+ CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & tbParam.DDFName & ": " & tbParam.ToolTipValue)
+ Else
+ CompoListDDF.Add(DDF_SPACE5 & tbParam.DDFName & ": " & tbParam.ToolTipValue)
+ End If
+ Else
+ If Compo.LoadByDefault And Not SaveErrorCompo Then
+ CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & tbParam.DDFName & ": " & tbParam.Value)
+ Else
+ CompoListDDF.Add(DDF_SPACE5 & tbParam.DDFName & ": " & tbParam.Value)
+ End If
+ End If
+ End If
+ ElseIf Not String.IsNullOrWhiteSpace(tbParam.ToolTipValue) And Compo.MissingParameter Then
+ If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
+ ' Missing parameter {0} in {1}.
+ ' sErrorList &= String.Format("Missing parameter {0}.", tbParam.Name, Compo.CompoType.DDFName)
+ If tbParam.ToolTipValue = EgtMsg(50143) Then
+ If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
+ ' 50122: Error reading {0} param in {1} compo.
+ sErrorList &= String.Format(EgtMsg(50122), tbParam.Name, Compo.CompoType.DDFName)
+ If Compo.LoadByDefault And Not SaveErrorCompo Then
+ CompoListDDF.Add(DDF_METADATA & DDF_SPACE5 & tbParam.DDFName & ": " & tbParam.Value)
+ ParamInCompoIsCorrect = False
+ Else
+ CompoListDDF.Add(DDF_SPACE5 & tbParam.DDFName & ": " & tbParam.Value)
ParamInCompoIsCorrect = False
End If
Else
@@ -973,8 +1062,9 @@ Friend Module DdfFile
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
' 50122: Error reading {0} param in {1} compo.
sErrorList &= String.Format(EgtMsg(50122), tbParam.Name, Compo.CompoType.DDFName)
+ CompoListDDF.Add(DDF_SPACE5 & tbParam.DDFName & ": " & tbParam.Value)
+ End If
End If
- End If
Next
' inserisco qui il riferimento da stampare (il codice è scelto dalla porta)
If Not IsNothing(Compo.refJambCompo) Then
diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb
index b408eac..d962231 100644
--- a/DoorParameters/Compo.vb
+++ b/DoorParameters/Compo.vb
@@ -10,8 +10,8 @@ Module Modified
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
If Not IsNothing(Map.refPartPageVM) AndAlso Not IsNothing(Map.refPartPageVM.CurrPart) Then
For Each Compo In Map.refPartPageVM.CurrPart.CompoList
- Compo.BorderColor = New BrushConverter().ConvertFrom("#DCDCDC")
- Compo.BackGroundColor = New BrushConverter().ConvertFrom("#FFFFFF")
+ Compo.BorderColor = DirectCast(New BrushConverter().ConvertFrom("#DCDCDC"), SolidColorBrush)
+ Compo.BackGroundColor = DirectCast(New BrushConverter().ConvertFrom("#FFFFFF"), SolidColorBrush)
Compo.BorderThickness = 1
Next
End If
@@ -38,7 +38,7 @@ Public Class Compo
End Get
End Property
- Private m_BorderColor As SolidColorBrush = New BrushConverter().ConvertFrom("#DCDCDC")
+ Private m_BorderColor As SolidColorBrush = DirectCast(New BrushConverter().ConvertFrom("#DCDCDC"), SolidColorBrush)
Public Property BorderColor As SolidColorBrush
Get
Return m_BorderColor
@@ -49,7 +49,7 @@ Public Class Compo
End Set
End Property
- Private m_BackGroundColor As SolidColorBrush = New BrushConverter().ConvertFrom("#FFFFFF")
+ Private m_BackGroundColor As SolidColorBrush = DirectCast(New BrushConverter().ConvertFrom("#FFFFFF"), SolidColorBrush)
Public Property BackGroundColor As SolidColorBrush
Get
Return m_BackGroundColor
@@ -110,6 +110,8 @@ Public Class Compo
#Region "Gestione Errori DOORCreator"
+ Public m_ParameterDDfList As New List(Of String)
+
Private m_LoadByDefault As Boolean = False
Public Property LoadByDefault As Boolean
Get
@@ -118,7 +120,6 @@ Public Class Compo
Set(value As Boolean)
m_LoadByDefault = value
SetImage()
- ' NotifyPropertyChanged("ImageButton")
NotifyPropertyChanged("ShowParamList")
NotifyPropertyChanged("IsError")
End Set
@@ -146,9 +147,23 @@ Public Class Compo
End Set
End Property
+ Private m_ErrorColor As SolidColorBrush = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorLoadByDefault), SolidColorBrush)
+ Public Property ErrorColor As SolidColorBrush
+ Get
+ Return m_ErrorColor
+ End Get
+ Set(value As SolidColorBrush)
+ m_ErrorColor = value
+ NotifyPropertyChanged("ErrorColor")
+ End Set
+ End Property
+
Public ReadOnly Property ShowParamList As Visibility
Get
- If m_LoadByDefault Then Return Visibility.Collapsed
+ If m_LoadByDefault Then
+ NotifyPropertyChanged("IsError")
+ Return Visibility.Collapsed
+ End If
Return Visibility.Visible
End Get
End Property
@@ -173,7 +188,17 @@ Public Class Compo
Public ReadOnly Property IsError As Boolean
Get
' è suffuciente che ci sia un errore perchè venga evidenziato nella grafica
- If m_ErrorValue OrElse m_MissingParameter OrElse m_LoadByDefault Then
+ If m_ErrorValue And Not m_MissingParameter And Not m_LoadByDefault Then
+ ErrorColor = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorErrorValue), SolidColorBrush)
+ Return True
+ ElseIf m_MissingParameter And Not m_ErrorValue And Not m_LoadByDefault Then
+ ErrorColor = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorMissingParameter), SolidColorBrush)
+ Return True
+ ElseIf m_LoadByDefault And Not m_MissingParameter And Not m_ErrorValue Then
+ ErrorColor = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorLoadByDefault), SolidColorBrush)
+ Return True
+ ElseIf m_MissingParameter And m_ErrorValue Then
+ ErrorColor = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorErrorAndMissing), SolidColorBrush)
Return True
Else
Return False
@@ -1594,6 +1619,16 @@ End Class
Public Class CompoParam
Implements INotifyPropertyChanged
+ Public ReadOnly Property ErrorParameter As Boolean
+ Get
+ If m_ErrorInReading Or m_MissingParameterInReading Then
+ Return True
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
Private m_ErrorInReading As Boolean = False
Public Property ErrorInReading As Boolean
Get
@@ -1601,7 +1636,18 @@ Public Class CompoParam
End Get
Set(value As Boolean)
m_ErrorInReading = value
- NotifyPropertyChanged("ErrorInReading")
+ NotifyPropertyChanged("ErrorParameter")
+ End Set
+ End Property
+
+ Private m_MissingParameterInReading As Boolean = False
+ Public Property MissingParameterInReading As Boolean
+ Get
+ Return m_MissingParameterInReading
+ End Get
+ Set(value As Boolean)
+ m_MissingParameterInReading = value
+ NotifyPropertyChanged("ErrorParameter")
End Set
End Property
@@ -1722,12 +1768,10 @@ Public Class TextBoxParam
ErrorInReading = True
CurrCompo.ErrorValue = True
End If
+ MissingParameterInReading = False
If Not IsNothing(Map.refAssemblyManagerVM) Then Map.refAssemblyManagerVM.RefreshAssembly(CurrCompo)
SetModified()
- ' ErrorInReading = False
- CurrCompo.MissingParameter = False
- ' CurrCompo.ErrorValue = False
- ' se la componente non ha un riferimento esce
+ NotifyPropertyChanged("ErrorParameter")
If IsNothing(CurrCompo.refJambCompo) Then Return
' se fallisce il caricamento dei parametri esce
If Not LoadCompoParam(CurrCompo, Map.refPartPageVM.CurrPart.TypePart) Then Return
@@ -1738,8 +1782,8 @@ Public Class TextBoxParam
End Property
Public Sub SetValue(sValue As String)
m_Value = sValue
- NotifyPropertyChanged("ToolTipValue")
NotifyPropertyChanged("Value")
+ NotifyPropertyChanged("ToolTipValue")
End Sub
Public ReadOnly Property ToolTipValue As String
@@ -1866,11 +1910,12 @@ Public Class ComboBoxParam
Set(value As String)
m_SelItem = value
SetModified()
+ MissingParameterInReading = False
If ErrorInReading = True Then
If Not IsNothing(Map.refAssemblyManagerVM) Then Map.refAssemblyManagerVM.RefreshAssembly(CurrCompo)
End If
+ NotifyPropertyChanged("ErrorParameter")
' ErrorInReading = False
- CurrCompo.MissingParameter = False
' CurrCompo.ErrorValue = False
Dim CmpPar As CompoParam = Me
Dim IndexP As Integer = CurrCompo.CompoParamList.IndexOf(Me)
diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb
index 15f7aed..f247757 100644
--- a/DoorParameters/Part.vb
+++ b/DoorParameters/Part.vb
@@ -1228,35 +1228,31 @@ Public Class Part
Item.IsChecked = False
Next
End If
+ ' Messaggio di errore per le proprietà
If ReadDoor.bModifyProperties And Not FirstReadingEdge Then
' 50194 = Properties has been deleted
MessageBox.Show(EgtMsg(50194), EgtMsg(50118), MessageBoxButton.OK, MessageBoxImage.Information)
FirstReadingEdge = True
End If
+ ' Messaggio di errore per il Top Arch
If ReadDoor.bDeleteTopArch Then
' 50197: Impossible to create a Top Arch because of configuration! Curr door will be modify.
MessageBox.Show(EgtMsg(50197), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Asterisk)
FirstReadingEdge = True
End If
- ' Sarebbe buona norma inserire qui la stringa con i messaggi di errore e avvertimento (dopo aver caricato i bevel corretti)
+ ' Messaggio di errore per incongruenza bevel
If ReadDoor.bModifyBevel Then
If Not IsNothing(ReadDoor.LockEdgeType) AndAlso
(ReadDoor.m_LockEdgeType.BevelDDF = BEVEL_DOWN OrElse ReadDoor.m_LockEdgeType.BevelDDF = BEVEL_UP) AndAlso
Not IsNothing(ReadDoor.m_Swing) AndAlso ReadDoor.m_Swing.Contains("I") Then
+ ' 50198 =Bevel on lock edge would be inverted, 50115 =Caution
MessageBox.Show(EgtMsg(50198), EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No)
Else
' 50169 =Door dispositiopn has been modify.
MessageBox.Show(EgtMsg(50169), EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No)
- End If
+ End If
End If
- End If
- ' se la stringa dei messaggi contiene delle informazioni allora visualizzo
- If Not String.IsNullOrWhiteSpace(sErrorInfo) Then
- Dim sTitle As String = EgtMsg(50101)
- If Not IsNothing(ReadDoor) Then sTitle &= " in reading " & ReadDoor.TypePart
- MessageBox.Show(sErrorInfo, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
- ' quando non passa dalla funzione GetWeight (perchè il ddf non ha il peso)
- Else
+ ' Messaggio di errore per il Weight, quando non passa dalla funzione GetWeight (perchè il ddf non ha il peso)
If Not bPressure Then
If m_IsCheckedWeight = Visibility.Visible Then
' ACCESO e NON presenet nel ddf
@@ -1273,6 +1269,14 @@ Public Class Part
End If
End If
End If
+
+ ' Messaggi di errore generici, se la stringa dei messaggi contiene delle informazioni allora visualizzo
+ If Not String.IsNullOrWhiteSpace(sErrorInfo) Then
+ Dim sTitle As String = EgtMsg(50101)
+ If Not IsNothing(ReadDoor) Then sTitle &= " in reading " & ReadDoor.TypePart
+ MessageBox.Show(sErrorInfo, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
+ End If
+
End Sub
' Passaggio controllato alla prossima linea del file
@@ -1922,6 +1926,7 @@ Public Class Part
sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50133), CompoNameDDF) & vbCrLf
Return -1
End If
+
' Passo alla lettura delle linee con eventuali - shape/- template e con i parametri
While Index < FileContent.Count
Dim sLine As String = RemoveComment(FileContent(Index))
@@ -2135,206 +2140,222 @@ Public Class Part
Private Sub ReadParams(ByRef CompoTemplateItem As Compo, ByRef sErrorInfo As String, ByRef IndexLine As Integer)
' questo è l'indice dei parametri del componente
Dim IndexParam As Integer = 0
- While IndexParam < CompoTemplateItem.CompoParamList.Count
- ' carico la lista dei parametri della componente parametro per parametro
- Dim CurrCompoParam As CompoParam = CompoTemplateItem.CompoParamList(IndexParam)
- ' Controllo che il file non sia terminato
- If IndexLine < FileContent.Count Then
- Dim sLine As String = RemoveComment(FileContent(IndexLine))
- ' se stringa vuota o tutto commento, vado oltre
- If String.IsNullOrWhiteSpace(sLine) Then
+ Dim ErrParamList As New List(Of String)
+ If CompoTemplateItem.LoadByDefault Then
+ While IndexLine < FileContent.Count - 1 AndAlso
+ Not (Search3Hyphens(RemoveComment(FileContent(IndexLine))) OrElse Search3Dots(RemoveComment(FileContent(IndexLine)))) AndAlso
+ Not Trim(RemoveComment(FileContent(IndexLine))).StartsWith("- ")
+ ' salvo i commenti
+ If String.IsNullOrWhiteSpace(FileContent(IndexLine)) Then
IndexLine += 1
Continue While
End If
- ' se fine pezzo o fine file o nome o metacomando, esco dal ciclo
- If Search3Hyphens(sLine) OrElse Search3Dots(sLine) OrElse
- Not String.IsNullOrWhiteSpace(GetName(sLine)) OrElse
- sLine.Trim().StartsWith(DDF_METADATA) Then
- If Not TypeOf CurrCompoParam Is TextBoxOnOffParam AndAlso Not TypeOf CurrCompoParam Is ComboBoxOnOffParam Then
- ' restituisco il messaggio che manca un parametro
- ' Error in reading: line {0}. Expected {1}.
- sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
- ' All missing params will be initialized by default.
- sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50140)) & vbCrLf
- CompoTemplateItem.MissingParameter = True
- CurrCompoParam.ErrorInReading = True
- Else
- ' significa che la TextBoxOnOff è stata disattivata
- If TypeOf CurrCompoParam Is TextBoxOnOffParam Then DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
- If TypeOf CurrCompoParam Is ComboBoxOnOffParam Then DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
+ ErrParamList.Add(RemoveComment(FileContent(IndexLine)))
+ IndexLine += 1
+ End While
+ CompoTemplateItem.m_ParameterDDfList = ErrParamList
+ Else
+ While IndexParam < CompoTemplateItem.CompoParamList.Count
+ ' carico la lista dei parametri della componente parametro per parametro
+ Dim CurrCompoParam As CompoParam = CompoTemplateItem.CompoParamList(IndexParam)
+ ' Controllo che il file non sia terminato
+ If IndexLine < FileContent.Count Then
+ Dim sLine As String = RemoveComment(FileContent(IndexLine))
+ ' se stringa vuota o tutto commento, vado oltre
+ If String.IsNullOrWhiteSpace(sLine) Then
+ IndexLine += 1
+ Continue While
End If
- Exit While
- End If
- ' Se è di tipo obbligatorio (non è OnOff)
- If Not (TypeOf CurrCompoParam Is TextBoxOnOffParam OrElse TypeOf CurrCompoParam Is ComboBoxOnOffParam) Then
- Dim sKey As String = GetKey(sLine)
- ' se il nome del parametro è lo stesso di quello presente nel componente
- If String.Equals(Trim(CurrCompoParam.DDFName), sKey) Then
- If TypeOf CurrCompoParam Is ComboBoxParam Then
+ ' se fine pezzo o fine file o nome o metacomando, esco dal ciclo
+ If Search3Hyphens(sLine) OrElse Search3Dots(sLine) OrElse
+ Not String.IsNullOrWhiteSpace(GetName(sLine)) OrElse
+ sLine.Trim().StartsWith(DDF_METADATA) Then
+ If Not TypeOf CurrCompoParam Is TextBoxOnOffParam AndAlso Not TypeOf CurrCompoParam Is ComboBoxOnOffParam Then
+ ' restituisco il messaggio che manca un parametro
+ ' Error in reading: line {0}. Expected {1}.
+ sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
+ ' All missing params will be initialized by default.
+ sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50140)) & vbCrLf
+ Part.FirstReadingEdge = True
+ CompoTemplateItem.MissingParameter = True
+ CurrCompoParam.MissingParameterInReading = True
+ Else
+ ' significa che la TextBoxOnOff è stata disattivata
+ If TypeOf CurrCompoParam Is TextBoxOnOffParam Then DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
+ If TypeOf CurrCompoParam Is ComboBoxOnOffParam Then DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
+ End If
+ Exit While
+ End If
+ ' Se è di tipo obbligatorio (non è OnOff)
+ If Not (TypeOf CurrCompoParam Is TextBoxOnOffParam OrElse TypeOf CurrCompoParam Is ComboBoxOnOffParam) Then
+ Dim sKey As String = GetKey(sLine)
+ ' se il nome del parametro è lo stesso di quello presente nel componente
+ If String.Equals(Trim(CurrCompoParam.DDFName), sKey) Then
+ If TypeOf CurrCompoParam Is ComboBoxParam Then
+ ' leggo il valore DDF dal file
+ Dim sVal As String = GetValueWithoutKey(sLine)
+ ' carico la lista dei valori (messaggi)
+ Dim List As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemList
+ ' carico la lista dei valori DDF
+ Dim ListDDF As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemListDDF
+ ' riscrivo i valori della lista DDF senza spazi all'inizio e alla fine e in minuscolo
+ For IndexListDDF As Integer = 0 To ListDDF.Count - 1
+ ListDDF(IndexListDDF) = Trim(ListDDF(IndexListDDF)).ToLower()
+ Next
+ ' carico il valore IndexName come indice del valore selezionato dalla lista DDF
+ Dim IndexName As Integer = ListDDF.IndexOf(sVal.ToLower())
+ Dim SelItem As String = String.Empty
+ ' se è stata trovata una corrispondenza tra il valore letto dal file e il valore presente nella lista DDF
+ If IndexName >= 0 Then
+ ' restituisco il valore DDF della lista associato all'indice passato
+ SelItem = List(IndexName)
+ Else
+ ' il nome DDF non è corretto
+ ' Error in reading {0}: line {1}. It is not a member of the list.
+ sErrorInfo &= String.Format(EgtMsg(50137), sVal, IndexLine)
+ ' This param will be initialized by default.
+ sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
+ List.Add(sVal)
+ SelItem = List(List.Count - 1)
+ CompoTemplateItem.ErrorValue = True
+ CurrCompoParam.ErrorInReading = True
+ ' SelItem = List(0)
+ End If
+ ' assegno al parametro del componente il valore "filtrato"
+ DirectCast(CurrCompoParam, ComboBoxParam).SetSelItem(SelItem)
+ ' assegno il valore letto alla textbox
+ ElseIf TypeOf CurrCompoParam Is TextBoxParam Then
+ Dim sVal As String = GetValueWithoutKey(sLine)
+ ' per ora non esegue nessun tipo di controllo sui valori letti dal file DDF
+ DirectCast(CurrCompoParam, TextBoxParam).m_Value = sVal
+ ' avviso che il file è modificato (in caso di chiusura del programma obbligo a passare dal salvataggio)
+ Dim dVal As Double
+ If String.IsNullOrEmpty(sVal) OrElse Not StringToDouble(sVal, dVal) Then
+ ' Part.FirstReadingEdge = True
+ CompoTemplateItem.ErrorValue = True
+ CurrCompoParam.ErrorInReading = True
+ End If
+ End If
+ ' se il nome esiste ma è sbagliato
+ ElseIf Not String.IsNullOrWhiteSpace(sKey) Then
+ ' se il nome non è preceduto dal trattino
+ If Not sKey.StartsWith("- ") Then
+ ' il nome DDF non è corretto
+ ' Error in reading: line {0}. Expected {1}.
+ sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
+ ' This param will be initialized by default.
+ sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
+ Part.FirstReadingEdge = True
+ CompoTemplateItem.MissingParameter = True
+ CurrCompoParam.MissingParameterInReading = True
+ ' passo al parametro successivo senza cambiare linea del file DDF
+ IndexParam += 1
+ Continue While
+ Else
+ ' istanzio tutti i valori che mancano al compo corrente di default
+ ' Error in reading: line {0}. Expected {1}.
+ sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
+ ' This param will be initialized by default.
+ sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
+ ' avviso che il file in scrittura è differente da quello in lettura
+ Part.FirstReadingEdge = True
+ CompoTemplateItem.MissingParameter = True
+ CurrCompoParam.MissingParameterInReading = True
+ ' esco dal ciclo
+ Exit While
+ End If
+ End If
+ ' Se altrimenti è una TextBoxOnOff
+ ElseIf TypeOf CurrCompoParam Is TextBoxOnOffParam Then
+ ' se il nome del parametro è lo stesso di quello presente nel componente
+ If String.Equals(Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName), GetKey(sLine)) Then
+ ' se la stringa c'è nel DDF vuol dire che è stata selezionata
+ Dim sVal As String = GetValueWithKey(sLine, Trim(CurrCompoParam.DDFName))
+ DirectCast(CurrCompoParam, TextBoxOnOffParam).m_Value = sVal
+ Dim dVal As Double
+ If String.IsNullOrEmpty(sVal) OrElse Not StringToDouble(sVal, dVal) Then
+ CompoTemplateItem.ErrorValue = True
+ CurrCompoParam.ErrorInReading = True
+ End If
+ DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(True)
+ ' se il nome esiste ma è sbagliato
+ ElseIf Not String.IsNullOrWhiteSpace(GetKey(sLine)) Then
+ ' significa che la TextBoxOnOff è stata disattivata
+ DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
+ ' passo al parametro successivo senza cambiare linea del file DDF
+ IndexParam += 1
+ Continue While
+ End If
+ ' Altrimenti è una ComboBoxOnOffParam
+ Else
+ ' se il nome del parametro è lo stesso di quello presente nel componente
+ If String.Equals(Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName), Trim(GetKey(sLine))) Then
' leggo il valore DDF dal file
- Dim sVal As String = GetValueWithoutKey(sLine)
+ Dim sVal As String = GetValueWithKey(sLine, Trim(CurrCompoParam.DDFName))
+ Dim IndexName As Integer = 0
' carico la lista dei valori (messaggi)
- Dim List As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemList
+ Dim List As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxOnOffParam).ItemList
+ Dim IndexListDDF As Integer = 0
' carico la lista dei valori DDF
- Dim ListDDF As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemListDDF
- ' riscrivo i valori della lista DDF senza spazi all'inizio e alla fine e in minuscolo
- For IndexListDDF As Integer = 0 To ListDDF.Count - 1
- ListDDF(IndexListDDF) = Trim(ListDDF(IndexListDDF)).ToLower()
+ Dim ListDDF As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxOnOffParam).ItemListDDF
+ ' riscrivo i valori della lista DDF senza spaziatura
+ For IndexListDDF = 0 To ListDDF.Count - 1
+ ListDDF(IndexListDDF) = Trim(ListDDF(IndexListDDF))
Next
' carico il valore IndexName come indice del valore selezionato dalla lista DDF
- Dim IndexName As Integer = ListDDF.IndexOf(sVal.ToLower())
+ IndexName = ListDDF.IndexOf(sVal)
Dim SelItem As String = String.Empty
' se è stata trovata una corrispondenza tra il valore letto dal file e il valore presente nella lista DDF
If IndexName >= 0 Then
' restituisco il valore DDF della lista associato all'indice passato
- SelItem = List(IndexName)
+ SelItem = Trim(List(IndexName))
Else
' il nome DDF non è corretto
' Error in reading {0}: line {1}. It is not a member of the list.
sErrorInfo &= String.Format(EgtMsg(50137), sVal, IndexLine)
' This param will be initialized by default.
sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
- If String.IsNullOrEmpty(sVal) Then
- Part.FirstReadingEdge = True
- End If
- ' ListDDF.Add(sVal)
' aggiungo un nuovo elemento solo nella lista da mostrare a video, quella dei ddf non deve essere toccata
List.Add(sVal)
SelItem = List(List.Count - 1)
CompoTemplateItem.ErrorValue = True
CurrCompoParam.ErrorInReading = True
- ' SelItem = List(0)
+ 'SelItem = List(0)
End If
- ' assegno al parametro del componente il valore "filtrato"
- DirectCast(CurrCompoParam, ComboBoxParam).SetSelItem(SelItem)
- ' assegno il valore letto alla textbox
- ElseIf TypeOf CurrCompoParam Is TextBoxParam Then
- Dim sVal As String = GetValueWithoutKey(sLine)
- ' per ora non esegue nessun tipo di controllo sui valori letti dal file DDF
- DirectCast(CurrCompoParam, TextBoxParam).m_Value = sVal
- ' avviso che il file è modificato (in caso di chiusura del programma obbligo a passare dal salvataggio)
- Dim dVal As Double
- If String.IsNullOrEmpty(sVal) OrElse Not StringToDouble(sVal, dVal) Then
- Part.FirstReadingEdge = True
- CompoTemplateItem.ErrorValue = True
- CurrCompoParam.ErrorInReading = True
- End If
- End If
- ' se il nome esiste ma è sbagliato
- ElseIf Not String.IsNullOrWhiteSpace(sKey) Then
- ' se il nome non è preceduto dal trattino
- If Not sKey.StartsWith("- ") Then
- ' il nome DDF non è corretto
- ' Error in reading: line {0}. Expected {1}.
- sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
- ' This param will be initialized by default.
- sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
- Part.FirstReadingEdge = True
- CompoTemplateItem.ErrorValue = True
- CurrCompoParam.ErrorInReading = True
+ ' assegno al parametro della compnente il valore "filtrato"
+ DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetSelItem(SelItem)
+ ' se il nome esiste ma è sbagliato
+ ElseIf Not String.IsNullOrWhiteSpace(GetKey(sLine)) Then
+ ' significa che la TextBoxOnOff è stata disattivata
+ DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
' passo al parametro successivo senza cambiare linea del file DDF
IndexParam += 1
Continue While
- Else
- ' istanzio tutti i valori che mancano al compo corrente di default
- ' Error in reading: line {0}. Expected {1}.
- sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
- ' This param will be initialized by default.
- sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
- Part.FirstReadingEdge = True
- CompoTemplateItem.MissingParameter = True
- ' esco dal ciclo
- Exit While
End If
End If
- ' Se altrimenti è una TextBoxOnOff
- ElseIf TypeOf CurrCompoParam Is TextBoxOnOffParam Then
- ' se il nome del parametro è lo stesso di quello presente nel componente
- If String.Equals(Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName), GetKey(sLine)) Then
- ' se la stringa c'è nel DDF vuol dire che è stata selezionata
- Dim sVal As String = GetValueWithKey(sLine, Trim(CurrCompoParam.DDFName))
- DirectCast(CurrCompoParam, TextBoxOnOffParam).m_Value = sVal
- Dim dVal As Double
- If String.IsNullOrEmpty(sVal) OrElse Not StringToDouble(sVal, dVal) Then
- Part.FirstReadingEdge = True
- CompoTemplateItem.LoadByDefault = True
- End If
- DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(True)
- ' se il nome esiste ma è sbagliato
- ElseIf Not String.IsNullOrWhiteSpace(GetKey(sLine)) Then
- ' significa che la TextBoxOnOff è stata disattivata
+ Else
+ If TypeOf DirectCast(CompoTemplateItem.CompoParamList(IndexParam), CompoParam) Is TextBoxOnOffParam Then
DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
- ' passo al parametro successivo senza cambiare linea del file DDF
- IndexParam += 1
- Continue While
- End If
- ' Altrimenti è una ComboBoxOnOffParam
- Else
- ' se il nome del parametro è lo stesso di quello presente nel componente
- If String.Equals(Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName), Trim(GetKey(sLine))) Then
- ' leggo il valore DDF dal file
- Dim sVal As String = GetValueWithKey(sLine, Trim(CurrCompoParam.DDFName))
- Dim IndexName As Integer = 0
- ' carico la lista dei valori (messaggi)
- Dim List As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxOnOffParam).ItemList
- Dim IndexListDDF As Integer = 0
- ' carico la lista dei valori DDF
- Dim ListDDF As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxOnOffParam).ItemListDDF
- ' riscrivo i valori della lista DDF senza spaziatura
- For IndexListDDF = 0 To ListDDF.Count - 1
- ListDDF(IndexListDDF) = Trim(ListDDF(IndexListDDF))
- Next
- ' carico il valore IndexName come indice del valore selezionato dalla lista DDF
- IndexName = ListDDF.IndexOf(sVal)
- Dim SelItem As String = String.Empty
- ' se è stata trovata una corrispondenza tra il valore letto dal file e il valore presente nella lista DDF
- If IndexName >= 0 Then
- ' restituisco il valore DDF della lista associato all'indice passato
- SelItem = Trim(List(IndexName))
- Else
- ' il nome DDF non è corretto
- ' Error in reading {0}: line {1}. It is not a member of the list.
- sErrorInfo &= String.Format(EgtMsg(50137), sVal, IndexLine)
- ' This param will be initialized by default.
- sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
- If String.IsNullOrEmpty(sVal) Then
- Part.FirstReadingEdge = True
- End If
- ' ListDDF.Add(sVal)
- ' aggiungo un nuovo elemento solo nella lista da mostrare a video, quella dei ddf non deve essere toccata
- List.Add(sVal)
- SelItem = List(List.Count - 1)
- CompoTemplateItem.LoadByDefault = True
- 'SelItem = List(0)
- End If
- ' assegno al parametro della compnente il valore "filtrato"
- DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetSelItem(SelItem)
- ' se il nome esiste ma è sbagliato
- ElseIf Not String.IsNullOrWhiteSpace(GetKey(sLine)) Then
- ' significa che la TextBoxOnOff è stata disattivata
+ ElseIf TypeOf DirectCast(CompoTemplateItem.CompoParamList(IndexParam), CompoParam) Is ComboBoxOnOffParam Then
DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
- ' passo al parametro successivo senza cambiare linea del file DDF
- IndexParam += 1
- Continue While
+ Else
+ ' Error in reading: line {0}. Expected {1}.
+ sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
+ ' All missing params will be initialized by default.
+ sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50140)) & vbCrLf
+ Part.FirstReadingEdge = True
+ CompoTemplateItem.MissingParameter = True
+ CurrCompoParam.MissingParameterInReading = True
+ For Index As Integer = IndexParam To CompoTemplateItem.CompoParamList.Count - 1
+ CompoTemplateItem.CompoParamList(Index).MissingParameterInReading = True
+ Next
End If
End If
- Else
- If TypeOf DirectCast(CompoTemplateItem.CompoParamList(IndexParam), CompoParam) Is TextBoxOnOffParam Then
- DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
- ElseIf TypeOf DirectCast(CompoTemplateItem.CompoParamList(IndexParam), CompoParam) Is ComboBoxOnOffParam Then
- DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
- Else
- ' Error in reading: line {0}. Expected {1}.
- sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
- ' All missing params will be initialized by default.
- sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50140)) & vbCrLf
- CompoTemplateItem.LoadByDefault = True
- End If
- End If
- ' Avanzo nell'elenco dei parametri e nel file DDF
- IndexParam += 1
- IndexLine = NextIndex(IndexLine)
- End While
+ ' Avanzo nell'elenco dei parametri e nel file DDF
+ IndexParam += 1
+ IndexLine = NextIndex(IndexLine)
+ End While
+ End If
End Sub
' controllo che tutti i bevel siano dello stesso tipo
diff --git a/DoorParameters/PartPageV.xaml b/DoorParameters/PartPageV.xaml
index 6b932c0..6b94143 100644
--- a/DoorParameters/PartPageV.xaml
+++ b/DoorParameters/PartPageV.xaml
@@ -352,7 +352,7 @@
-
+
@@ -418,7 +418,7 @@