diff --git a/Constants/ConstGen.vb b/Constants/ConstGen.vb index 5401751..0a056ce 100644 --- a/Constants/ConstGen.vb +++ b/Constants/ConstGen.vb @@ -59,7 +59,7 @@ Module ConstGen Public Const MM As String = "mm" Public Const INCHES As String = "inch" Public Const VAL_DOUBLE As String = "double" - Public Const VAL_STING As String = "string" + Public Const VAL_STRING As String = "string" Public Const VAL_INCHES As String = "Inches" ' sigle diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb index 703218e..27d2360 100644 --- a/DoorParameters/Compo.vb +++ b/DoorParameters/Compo.vb @@ -1120,7 +1120,7 @@ Public Class Compo If Not StringToDouble(sValue, dDefaultValue) Then Return False ' ricevo un numero in mm e lo voglio convertire nell'unità dell'interfaccia sDefaultValue = LenToString(dDefaultValue, 4) - Case ConstGen.VAL_STING + Case ConstGen.VAL_STRING sDefaultValue = sValue Case Else ' il tipo non è tra quelli indicati sopra ' Errore nell'espressione {0}. {1} non associa nulla. diff --git a/HardwareManager/Hardware.vb b/HardwareManager/Hardware.vb index 54ed184..0804963 100644 --- a/HardwareManager/Hardware.vb +++ b/HardwareManager/Hardware.vb @@ -545,6 +545,8 @@ Public Class Hardware m_GroupChapters(IndexGroupChapters).SetIsActiveChapter(True) If TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxDGCParam Then Dim Text As TextBoxDGCParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxDGCParam) + ' se testo numerico, eseguo opportunbe conversioni per H,W e T + sValue = ConvertToDGD(Text.TypeVar, sValue) ' separare il valore tra parentesi dai termini fuoir parentesi Dim sItems() As String = sValue.Split("+"c) If sItems.Count > 2 Then @@ -564,6 +566,8 @@ Public Class Hardware End If ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxThicknessParam Then Dim Text As TextBoxThicknessParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxThicknessParam) + ' se testo numerico, eseguo opportunbe conversioni per H,W e T + sValue = ConvertToDGD(Text.TypeVar, sValue) Dim dVal As Double Text.SetConst(Text.ConstList(2)) Text.SetValue("") @@ -586,6 +590,8 @@ Public Class Hardware ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxParam Then Dim Text As TextBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxParam) + ' se testo numerico, eseguo opportunbe conversioni per H,W e T + sValue = ConvertToDGD(Text.TypeVar, sValue) ' controllo il tipo di dato che si aspetta Select Case Text.TypeVar Case ConstGen.INCHES @@ -597,7 +603,7 @@ Public Class Hardware Case ConstGen.VAL_DOUBLE Dim dVal As Double = 0.0 If StringToDouble(sValue, dVal) Then Text.SetValue(sValue) Else Text.SetValue("0.000") - Case ConstGen.VAL_STING + Case ConstGen.VAL_STRING Text.SetValue(Trim(Utility.DeleteSuperScript(sValue))) End Select @@ -846,7 +852,7 @@ Public Class Hardware Text.Value = Trim(sTemplateName) Return True End If - Next + Next Next Return False End Function @@ -980,7 +986,7 @@ Public Class Hardware Dim bIsActive As Boolean = True Dim NameParam = Utility.FindNameParam(sValue) If String.IsNullOrEmpty(NameParam) Then Return False - For IndexGroupChapters As Integer = 0 To m_GroupChapters.Count - 1 + For IndexGroupChapters As Integer = 0 To m_GroupChapters.Count - 1 For IndexChapter As Integer = 0 To m_GroupChapters(IndexGroupChapters).CompoParamList.Count - 1 If m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter).DDFName = NameParam Then ' verifico che il parametro da stampare sia abilitato alla stampa (altriementi NON scrivere nel file) @@ -996,7 +1002,6 @@ Public Class Hardware Else sValue = Text.TypeVar & "( " & Text.Value & ")" End If - 'sValue = Text.TypeVar & "( " & Text.ToolTipValue & ")" Else sValue = Text.Value If MmToInches(sValue) Then sValue = Text.TypeVar & "( " & sValue & ")" @@ -1011,9 +1016,10 @@ Public Class Hardware Else sValue = Text.Value End If - 'sValue = Text.ToolTipValue End If End Select + ' se testo numerico, eseguo opportune conversioni per H,W e T + sValue = ConvertFromDGD(Text.TypeVar, sValue) sValue &= " + " & Text.SelConst Return True @@ -1029,7 +1035,6 @@ Public Class Hardware Else sValue = Text.TypeVar & "( " & Text.Value & ")" End If - 'sValue = Text.TypeVar & "( " & Text.ToolTipValue & ")" Else sValue = Text.Value If MmToInches(sValue) Then sValue = Text.TypeVar & "( " & sValue & ")" @@ -1044,9 +1049,10 @@ Public Class Hardware Else sValue = Text.Value End If - 'sValue = Text.ToolTipValue End If End Select + ' se testo numerico, eseguo opportune conversioni per H,W e T + sValue = ConvertFromDGD(Text.TypeVar, sValue) Return True End If sValue = DoubleToString(Text.SelConst.dValue, 1) @@ -1089,9 +1095,11 @@ Public Class Hardware End If Case ConstGen.VAL_DOUBLE sValue = Text.Value - Case ConstGen.VAL_STING + Case ConstGen.VAL_STRING sValue = "'" & Text.Value & "'" End Select + ' se testo numerico, eseguo opportune conversioni per H,W e T + sValue = ConvertFromDGD(Text.TypeVar, sValue) Return True ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxNgeParam Then diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 7fdcc47..d8dca6f 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -72,5 +72,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb index de51329..6c5d423 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -249,12 +249,18 @@ Friend Module OptionModule Dim Width As String = String.Empty DefaultGetPrivateProfileString(S_SIZE_INI, K_WIDTH_INI, "32", Width) m_Width = Width + Dim dWidth As Double + If StringToDouble(m_Width, dWidth) Then EgtLuaSetGlobNumVar("W", dWidth) Dim Height As String = String.Empty DefaultGetPrivateProfileString(S_SIZE_INI, K_HEIGHT_INI, "80", Height) m_Height = Height + Dim dHeight As Double + If StringToDouble(m_Height, dHeight) Then EgtLuaSetGlobNumVar("H", dHeight) Dim Thickness As String = String.Empty DefaultGetPrivateProfileString(S_SIZE_INI, K_THICKNESS_INI, "1.75", Thickness) m_Thickness = Thickness + Dim dThickness As Double + If StringToDouble(m_Thickness, dThickness) Then EgtLuaSetGlobNumVar("T", dThickness) ' carico i valori associati allo swing della porta Dim SwingTypeList As New List(Of String) DefaultGetPrivateProfileList(S_SIZE_INI, K_SWING_LIST_INI, SwingTypeList) diff --git a/Utility.vb b/Utility.vb index 0af473b..715730b 100644 --- a/Utility.vb +++ b/Utility.vb @@ -256,6 +256,41 @@ Public Module Utility End If End Function + ' Conversione stringhe con W, H e T in DGD.dW, DGD.dH, DGD.dT e viceversa per lettura/scrittura parametri compo + Friend Function ConvertFromDGD(sTypeVar As String, sValue As String) As String + Dim sMyVal As String = sValue + ' se testo numerico, eseguo opportune conversioni per H,W e T + If sTypeVar = ConstGen.INCHES Or sTypeVar = ConstGen.MM Then + If OptionModule.m_SelectedMeasureUnit = ConstGen.VAL_INCHES Then + sMyVal = sMyVal.Replace("W", "(DGD.dW/25.4)") + sMyVal = sMyVal.Replace("H", "(DGD.dH/25.4)") + sMyVal = sMyVal.Replace("T", "(DGD.dT/25.4)") + Else + sMyVal = sMyVal.Replace("W", "DGD.dW") + sMyVal = sMyVal.Replace("H", "DGD.dH") + sMyVal = sMyVal.Replace("T", "DGD.dT") + End If + End If + Return sMyVal + End Function + + Friend Function ConvertToDGD(sTypeVar As String, sValue As String) As String + Dim sMyVal As String = sValue + ' se testo numerico, eseguo opportunbe conversioni per H,W e T + If sTypeVar = ConstGen.INCHES Or sTypeVar = ConstGen.MM Then + If OptionModule.m_SelectedMeasureUnit = ConstGen.VAL_INCHES Then + sMyVal = sMyVal.Replace("(DGD.dW/25.4)", "W") + sMyVal = sMyVal.Replace("(DGD.dH/25.4)", "H") + sMyVal = sMyVal.Replace("(DGD.dT/25.4)", "T") + Else + sMyVal = sMyVal.Replace("DGD.dW", "W") + sMyVal = sMyVal.Replace("DGD.dH", "H") + sMyVal = sMyVal.Replace("DGD.dT", "T") + End If + End If + Return sMyVal + End Function + Friend Sub UpdateUI() ' Costringo ad aggiornare UI Dim nDummy As Integer