diff --git a/Assembly/Assembly.vb b/Assembly/Assembly.vb index 9866e31..86b8456 100644 --- a/Assembly/Assembly.vb +++ b/Assembly/Assembly.vb @@ -1840,7 +1840,7 @@ Public Class Assembly If Not String.IsNullOrEmpty(Door.CompoList(IndexCompo).IdCode) Then ' cerco l'associazione delle compo sulla porta con le componenti sul telaio For IndexCompoJamb As Integer = 0 To Jamb.CompoList.Count - 1 - If Jamb.CompoList(IndexCompoJamb).IdCode = Door.CompoList(IndexCompo).IdCode Then + If Trim(Jamb.CompoList(IndexCompoJamb).IdCode) = Trim(Door.CompoList(IndexCompo).IdCode) Then Door.CompoList(IndexCompo).refJambCompo = Jamb.CompoList(IndexCompoJamb) Jamb.CompoList(IndexCompoJamb).refCompoDoor = Door.CompoList(IndexCompo) Door.CompoList(IndexCompo).refJambCompo.VisibilitiReloadBtn = Visibility.Visible @@ -1881,15 +1881,36 @@ Public Class Assembly If Not String.IsNullOrEmpty(DoorActive.CompoList(IndexCompo).IdCode) Then For IndexCompoInactiveDoor As Integer = 0 To DoorInactive.CompoList.Count - 1 ' cerco l'associazione delle compo sulla porta attiva con le componenti sulla porta inattiva - If DoorInactive.CompoList(IndexCompoInactiveDoor).IdCode = DoorActive.CompoList(IndexCompo).IdCode Then - DoorActive.CompoList(IndexCompo).refJambCompo = DoorInactive.CompoList(IndexCompoInactiveDoor) - DoorInactive.CompoList(IndexCompoInactiveDoor).refCompoDoor = DoorActive.CompoList(IndexCompo).refJambCompo - DoorActive.CompoList(IndexCompo).refJambCompo.IsReadOnly = False - DoorActive.CompoList(IndexCompo).IsReadOnly = True - If Not LoadCompoParam(DoorActive.CompoList(IndexCompo), DoorActive.TypePart) Then Return - For IndexParam As Integer = 0 To DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList.Count - 1 + Dim Local_Copo As Compo + If Trim(DoorInactive.CompoList(IndexCompoInactiveDoor).IdCode) = Trim(DoorActive.CompoList(IndexCompo).IdCode) Then + If DoorActive.CompoList(IndexCompo).MatchedDoor Then + DoorInactive.CompoList(IndexCompoInactiveDoor).refJambCompo = DoorActive.CompoList(IndexCompo) + DoorActive.CompoList(IndexCompo).refCompoDoor = DoorInactive.CompoList(IndexCompoInactiveDoor) + DoorInactive.CompoList(IndexCompoInactiveDoor).VisibilitiReloadBtn = Visibility.Visible + DoorInactive.CompoList(IndexCompoInactiveDoor).refJambCompo.IsReadOnly = False + DoorInactive.CompoList(IndexCompoInactiveDoor).IsReadOnly = True + If Not LoadCompoParam(DoorInactive.CompoList(IndexCompoInactiveDoor), DoorActive.TypePart) Then Return + ' assegno la componente + Local_Copo = DoorInactive.CompoList(IndexCompoInactiveDoor).refJambCompo + Else + DoorActive.CompoList(IndexCompo).refJambCompo = DoorInactive.CompoList(IndexCompoInactiveDoor) + DoorInactive.CompoList(IndexCompoInactiveDoor).refCompoDoor = DoorActive.CompoList(IndexCompo) + DoorActive.CompoList(IndexCompo).VisibilitiReloadBtn = Visibility.Visible + DoorActive.CompoList(IndexCompo).refJambCompo.IsReadOnly = False + DoorActive.CompoList(IndexCompo).IsReadOnly = True + ' assegno la componente + If Not LoadCompoParam(DoorActive.CompoList(IndexCompo), DoorActive.TypePart) Then Return + Local_Copo = DoorActive.CompoList(IndexCompo).refJambCompo + End If + 'DoorActive.CompoList(IndexCompo).refJambCompo = DoorInactive.CompoList(IndexCompoInactiveDoor) + 'DoorInactive.CompoList(IndexCompoInactiveDoor).refCompoDoor = DoorActive.CompoList(IndexCompo) + 'DoorActive.CompoList(IndexCompo).VisibilitiReloadBtn = Visibility.Visible + 'DoorActive.CompoList(IndexCompo).refJambCompo.IsReadOnly = False + 'DoorActive.CompoList(IndexCompo).IsReadOnly = True + 'If Not LoadCompoParam(DoorActive.CompoList(IndexCompo), DoorActive.TypePart) Then Return + For IndexParam As Integer = 0 To Local_Copo.CompoParamList.Count - 1 'Dim CmpPar As CompoParam = DoorActive.CompoList(IndexCompo).CompoParamList(IndexParam) - Dim CmpRefPar As CompoParam = DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam) + Dim CmpRefPar As CompoParam = Local_Copo.CompoParamList(IndexParam) If TypeOf CmpRefPar Is TextBoxOnOffParam Then 'Dim TBoxPar As TextBoxOnOffParam = DirectCast(CmpPar, TextBoxOnOffParam) Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(CmpRefPar, TextBoxOnOffParam) @@ -2088,29 +2109,39 @@ Public Class Assembly Return False End If + ' se l'associazione è un'anta allora verifico se la componente non sia un riferiememto + If refPartDoor.Door.TypePart.Contains("DO_") AndAlso Not IsNothing(CurrCompo.refCompoDoor) Then + Return False + End If + ' cerco il nome della componente da associare FrameFile Dim CurrDoorHArdwareFile As String = CurrCompo.CompoType.Path & "\" & CurrCompo.TemplateSelItem If Path.GetExtension(CurrDoorHArdwareFile) <> NGE_EXTENSION Then CurrDoorHArdwareFile &= LUA_EXTENSION End If ' cerco il campo [Match file] nel file lua della componente - If File.Exists(CurrDoorHArdwareFile) Then - Dim ReadCurrCompo() As String = File.ReadAllLines(CurrDoorHArdwareFile) - For LineIndex = 0 To ReadCurrCompo.Count - 1 - If RegexFunction.IsMatchingParameterTitle(ReadCurrCompo(LineIndex)) Then - ' mi preparo per leggere la prima riga dopo il titolo - Dim ParamIndex As Integer = 1 - FrameFile = Trim(RegexFunction.ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_MATCHING_FILE)) - While String.IsNullOrEmpty(FrameFile) And LineIndex + ParamIndex < ReadCurrCompo(LineIndex + ParamIndex).Count - ParamIndex += 1 - FrameFile = Trim(RegexFunction.ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_MATCHING_FILE)) - End While - Exit For - End If - Next + Dim sKey As String = K_MATCHING_FILE + ' se il riferiemento è un'anta allora devo caricare il file "MatchingFileDoor" + If refPartDoor.Door.TypePart.Contains("DO_") Then + sKey = K_MATCHING_FILE_DOOR End If - ' se non esiste nessun accoppiamento allora esco ed elimino la componente - If FrameFile.Contains("None") Then + If File.Exists(CurrDoorHArdwareFile) Then + Dim ReadCurrCompo() As String = File.ReadAllLines(CurrDoorHArdwareFile) + For LineIndex = 0 To ReadCurrCompo.Count - 1 + If RegexFunction.IsMatchingParameterTitle(ReadCurrCompo(LineIndex)) Then + ' mi preparo per leggere la prima riga dopo il titolo + Dim ParamIndex As Integer = 1 + FrameFile = Trim(RegexFunction.ParamLine(ReadCurrCompo(LineIndex + ParamIndex), sKey)) + While String.IsNullOrEmpty(FrameFile) And LineIndex + ParamIndex < ReadCurrCompo(LineIndex + ParamIndex).Count + ParamIndex += 1 + FrameFile = Trim(RegexFunction.ParamLine(ReadCurrCompo(LineIndex + ParamIndex), sKey)) + End While + Exit For + End If + Next + End If + ' se non esiste nessun accoppiamento allora esco ed elimino la componente + If FrameFile.Contains("None") Then If Not IsNothing(CurrCompo.refJambCompo) Then Local_CurrDoor.RemoveCompo(CurrCompo, True) CurrCompo.refJambCompo = Nothing @@ -2162,8 +2193,12 @@ Public Class Assembly ' costruisco sul riferiento la nuova componente inserita Dim refCompoType As New CompoType(FrameName, FrameNameDDF, Path.GetDirectoryName(FrameFileConfig), FrameSide, FrameFolderName) ' aggiungo la componete sul riferiento passato (caricando la lista dei file di tipo Frame) - CurrCompo.refJambCompo = refPartDoor.Door.AddNewCompo(refCompoType, True) + Dim refPartDoor_IsFrame As Boolean = True + If refPartDoor.Door.TypePart.Contains("DO_") Then refPartDoor_IsFrame = False + CurrCompo.refJambCompo = refPartDoor.Door.AddNewCompo(refCompoType, refPartDoor_IsFrame) CurrCompo.refJambCompo.refCompoDoor = CurrCompo + ' se non è un frame allora sto costruendo su una anta + CurrCompo.refJambCompo.MatchedDoor = Not refPartDoor_IsFrame ' definsco se la componente deve essre ribalata (Top-Door2; Bottom-Door1 e una sola anta) If Side = "top" And Local_CurrDoor.TypePart.Contains("DO_2") Then CurrCompo.refJambCompo.OtherDoor = True @@ -2209,13 +2244,14 @@ Public Class Assembly ' numero di ante presenti nel progetto corrente Dim nDoorNbr As Integer = 1 - ' ricerco il PartDoor associato al side - Dim refPartDoor As PartDoor = Nothing - If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then - Return False - Else - refPartDoor = Map.refAssemblyPageVM.ReserchPartDoor(Map.refPartPageVM.CurrPart.TypePart) - End If + ' ricerco il PartDoor associato al side (anche da anta ad anta) + Dim refPartDoor As PartDoor = Map.refAssemblyPageVM.ReserchPartDoor(Map.refPartPageVM.CurrPart.TypePart) + 'If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then + ' Return False + 'Else + ' refPartDoor = Map.refAssemblyPageVM.ReserchPartDoor(Map.refPartPageVM.CurrPart.TypePart) + 'End If + ' se non è stata trovata nessuna associazione esco If IsNothing(refPartDoor) Then CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed @@ -2224,7 +2260,7 @@ Public Class Assembly ' ricerco l'indice della componente che sto modificando For Index As Integer = 0 To refPartDoor.Door.CompoList.Count - 1 - If refPartDoor.Door.CompoList(Index).IdCode = CurrCompo.IdCode Then + If Trim(refPartDoor.Door.CompoList(Index).IdCode) = Trim(CurrCompo.IdCode) Then IndexRefCompo = Index End If Next @@ -2241,6 +2277,8 @@ Public Class Assembly LocalDoor = Map.refAssemblyPageVM.ReserchPartDoor("DO_2").Door ElseIf refPartDoor.Door.TypePart.Contains("FR_") Then LocalDoor = Map.refAssemblyPageVM.ReserchPartDoor("DO_2").Door + ElseIf refPartDoor.Door.TypePart.Contains("DO_1") Then + LocalDoor = Map.refAssemblyPageVM.ReserchPartDoor("DO_2").Door End If End If @@ -2274,8 +2312,10 @@ Public Class Assembly If IsNothing(CurrCompo.refJambCompo) Then ' costruisco sul riferiento la nuova componente inserita Dim refCompoType As New CompoType(FrameName, FrameNameDDF, Path.GetDirectoryName(FrameFileConfig), FrameSide, FrameFolderName) - ' aggiungo la componete sul riferiento passato (caricando la lista dei file di tipo Frame) - CurrCompo.refJambCompo = refPartDoor.Door.AddNewCompo(refCompoType, True, IndexRefCompo) + ' aggiungo la componete sul riferiento passato (caricando la lista dei file di tipo Frame solo per il telaio) + Dim refPartDoor_IsFrame As Boolean = True + If refPartDoor.Door.TypePart.Contains("DO_") Then refPartDoor_IsFrame = False + CurrCompo.refJambCompo = refPartDoor.Door.AddNewCompo(refCompoType, refPartDoor_IsFrame, IndexRefCompo) CurrCompo.refJambCompo.refCompoDoor = CurrCompo ' definsco se la componente deve essre ribalata (Top-Door2; Bottom-Door1 e una sola anta) If sSide = "top" And LocalDoor.TypePart.Contains("DO_2") Then @@ -2470,6 +2510,8 @@ Public Class Assembly For Each ItemPart In ListPartDoorOfDoor For IndexCompo = 0 To ItemPart.Door.CompoList.Count - 1 CreateCompoOnJamb(ItemPart.Door.CompoList(IndexCompo), "", ItemPart.Door.TypePart) + ' potrebbe capitare che vengano eliminate delle componenti, quindi è meglio controllare + If IndexCompo = ItemPart.Door.CompoList.Count - 1 Then Exit For Next Next End If @@ -2617,6 +2659,7 @@ Public Class Assembly For Each ItemCombo In CBoxRefPar.ItemList If ItemCombo = CBoxPar.SelItem Then CBoxRefPar.SetSelItem(ItemCombo) + CBoxRefPar.OrigItem = CBoxPar.SelItem Exit For End If Next @@ -2641,6 +2684,7 @@ Public Class Assembly For Each ItemCombo In CBoxRefPar.ItemList If ItemCombo = CBoxPar.SelItem Then CBoxRefPar.SetSelItem(ItemCombo) + CBoxRefPar.OrigItem = CBoxPar.SelItem Exit For End If Next @@ -2669,7 +2713,18 @@ Public Class Assembly CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters) ' confronto il valore calcolato con il parametro caricato da DDF If Trim(TBoxRefPar.m_Value) <> Trim(TBoxRefPar.OrigValue) Then - TBoxRefPar.IsModifingRefCompoParam = True + Dim dValue As Double + Dim dOrigValue As Double + If Not IsNothing(TBoxRefPar.m_Value) AndAlso Not IsNothing(TBoxRefPar.OrigValue) Then + StringToDouble(TBoxRefPar.m_Value, dValue) + StringToDouble(TBoxRefPar.OrigValue, dOrigValue) + If dValue <> dOrigValue Then + TBoxRefPar.IsModifingRefCompoParam = True + Else + TBoxRefPar.IsModifingRefCompoParam = False + End If + End If + 'TBoxRefPar.IsModifingRefCompoParam = True End If ElseIf TypeOf ItemCompoRef Is TextBoxParam AndAlso TypeOf ItemCompo Is TextBoxParam Then ' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta @@ -2679,7 +2734,18 @@ Public Class Assembly CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters) ' confronto il valore calcolato con il parametro caricato da DDF If Trim(TBoxRefPar.m_Value) <> Trim(TBoxRefPar.OrigValue) Then - TBoxRefPar.IsModifingRefCompoParam = True + Dim dValue As Double + Dim dOrigValue As Double + If Not IsNothing(TBoxRefPar.m_Value) AndAlso Not IsNothing(TBoxRefPar.OrigValue) Then + StringToDouble(TBoxRefPar.m_Value, dValue) + StringToDouble(TBoxRefPar.OrigValue, dOrigValue) + If dValue <> dOrigValue Then + TBoxRefPar.IsModifingRefCompoParam = True + Else + TBoxRefPar.IsModifingRefCompoParam = False + End If + End If + 'TBoxRefPar.IsModifingRefCompoParam = True End If End If ' passo al parametro successivo della lista del CompoRef diff --git a/CompoMatch.vb b/CompoMatch.vb index 7be2fbb..7e02695 100644 --- a/CompoMatch.vb +++ b/CompoMatch.vb @@ -106,7 +106,7 @@ Module CompoMatch StringToDouble(CurrAssembly.DepthBottom, dDepthBottom) EgtLuaSetGlobNumVar("STU.DepthBottom", dDepthBottom) Dim dThicknessBottom As Double - StringToDouble(CurrAssembly.DeltaThickness, dThicknessBottom) + StringToDouble(CurrAssembly.ThicknessBottom, dThicknessBottom) EgtLuaSetGlobNumVar("STU.ThicknessBottom", dThicknessBottom) Dim dOverlapBottom As Double StringToDouble(CurrAssembly.OverlapBottom, dOverlapBottom) @@ -142,8 +142,7 @@ Module CompoMatch StringToDouble(CurrAssembly.ListPartDoorOfDoor(0).Door.Height, dHeightDoor) End If End If - - EgtLuaSetGlobNumVar("STU.ThicknessDoor", dThicknessDoor) + EgtLuaSetGlobNumVar("STU.ThicknessDoor", dThicknessDoor) EgtLuaSetGlobNumVar("STU.HeightDoor", dHeightDoor) Dim dDoor1Width As Double = 0.0 'StringToDouble(CurrAssembly.GetArrayPartDoor(0).Door.Width, dDoor1Width) diff --git a/Constants/ConstCompo.vb b/Constants/ConstCompo.vb index 2e7be40..e425fc3 100644 --- a/Constants/ConstCompo.vb +++ b/Constants/ConstCompo.vb @@ -82,7 +82,9 @@ Module ConstCompo Public Const K_LAYER_NAME As String = "LayerName" Public Const K_MATCHING_FILE As String = "MatchingFile" + Public Const K_MATCHING_FILE_DOOR As String = "MatchingFileDoor" Public Const MATCHING_FILE_TEMPLATE As String = "Match File" + Public Const MATCHING_FILE_TEMPLATE_DOOR As String = "Match File Door" Public Const MATCHING_FILE_AUTOMATIC As String = "Automatic" Public Const MATCHING_FILE_NONE As String = "None" Public Const MATCHING_INI As String = "Matching" diff --git a/DdfFile.vb b/DdfFile.vb index 3a7846d..6e170c3 100644 --- a/DdfFile.vb +++ b/DdfFile.vb @@ -1265,25 +1265,36 @@ Friend Module DdfFile Next ' inserisco qui il riferimento da stampare (il codice è scelto dalla porta) If Not IsNothing(Compo.refJambCompo) Then - ' assegno lo stesso indice alla componente sull'unta e sul telaio - If Not String.IsNullOrEmpty(Compo.IdCode) AndAlso Compo.refJambCompo.IdCode = Compo.IdCode Then + ' stampo una componente dell'anta + If Not String.IsNullOrEmpty(Compo.IdCode) AndAlso Trim(Compo.refJambCompo.IdCode) = Trim(Compo.IdCode) Then CompoListDDF.Add(DDF_SPACE5 & "##IdCodeComponent : " & Compo.IdCode) Else Compo.IdCode = CStr(IdIndex) - Compo.refJambCompo.IdCode = Compo.IdCode + Compo.refJambCompo.IdCode = Trim(Compo.IdCode) CompoListDDF.Add(DDF_SPACE5 & "##IdCodeComponent : " & Compo.IdCode) End If IdIndex += 1 + ElseIf Not IsNothing(Compo.refCompoDoor) Then + ' stampo una componente sul telaio + If Not String.IsNullOrEmpty(Compo.refCompoDoor.IdCode) Then + If Compo.OtherDoor Then + CompoListDDF.Add(DDF_SPACE5 & "other_door: 1") + End If + Compo.IdCode = Compo.refCompoDoor.IdCode + If Compo.MatchedDoor Then + ' solo per il caso di sue ante + CompoListDDF.Add(DDF_SPACE5 & "##IdCodeComponent : " & Compo.IdCode & " , matched") + Else + CompoListDDF.Add(DDF_SPACE5 & "##IdCodeComponent : " & Compo.IdCode) + End If + + End If ElseIf Not String.IsNullOrEmpty(Compo.IdCode) Then If Compo.OtherDoor Then CompoListDDF.Add(DDF_SPACE5 & "other_door: 1") End If CompoListDDF.Add(DDF_SPACE5 & "##IdCodeComponent : " & Compo.IdCode) IdIndex += 1 - ElseIf Not IsNothing(Compo.refCompoDoor) Then - If Compo.OtherDoor Then - CompoListDDF.Add(DDF_SPACE5 & "other_door: 1") - End If End If Return CompoListDDF End Function diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb index 05e274e..ad111c7 100644 --- a/DoorParameters/Compo.vb +++ b/DoorParameters/Compo.vb @@ -142,6 +142,15 @@ Public Class Compo End Set End Property + Private m_MatchedDoor As Boolean = False + Public Property MatchedDoor As Boolean + Get + Return m_MatchedDoor + End Get + Set(value As Boolean) + m_MatchedDoor = value + End Set + End Property ' deve essere settato a 1 (solo in presenza di due ante): ' - inserisco un componente sul frame Top & sulla seconda anta (dx) ' - inserisco un componente sul frema Bottom & sulla prima anta (sx) @@ -2220,7 +2229,17 @@ Public Class TextBoxParam '-------------------------------------------------------------------------------------------- ' significa che sto modificando una componente del telaio If Not IsNothing(CurrCompo.refCompoDoor) AndAlso Trim(m_Value) <> Trim(m_OrigValue) Then - IsModifingRefCompoParam = True + Dim dValue As Double + Dim dOrigValue As Double + If Not IsNothing(m_Value) AndAlso Not IsNothing(m_OrigValue) Then + StringToDouble(m_Value, dValue) + StringToDouble(m_OrigValue, dOrigValue) + If dValue <> dOrigValue Then + IsModifingRefCompoParam = True + Else + IsModifingRefCompoParam = False + End If + End If NotifyPropertyChanged("ErrorParameter") ElseIf Not IsNothing(CurrCompo.refCompoDoor) AndAlso Trim(m_Value) = Trim(m_OrigValue) Then IsModifingRefCompoParam = False @@ -2328,6 +2347,24 @@ Public Class TextBoxParam ElseIf TypeOf CmpRefPar Is ComboBoxOnOffParam AndAlso CmpPar.DDFName = CmpRefPar.DDFName Then Dim TBoxPar As ComboBoxOnOffParam = DirectCast(CmpPar, ComboBoxOnOffParam) Dim TBoxRefPar As ComboBoxOnOffParam = DirectCast(CmpRefPar, ComboBoxOnOffParam) + ' calco eventualmente il valore delle combobox che deve essere restituito + 'If TBoxRefPar.IsModifingRefCompoParam Then + ' Dim sMsg As String = "The current parameters have been modified: " & TBoxRefPar.Name + ' sMsg = sMsg & vbCrLf & "Do you want to overwrite?" + ' If bContinueModify AndAlso Trim(m_PrecCompoIdCode) = Trim(CurrCompo.IdCode) AndAlso + ' m_PrecNameParam = TBoxPar.DDFName Then + ' CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.SelItem, TBoxRefPar.OrigItem, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters) + ' Return True + ' Else + ' bContinueModify = False + ' End If + ' Select Case MessageBox.Show(sMsg, "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning) + ' Case MessageBoxResult.No + ' bContinueModify = True + ' CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.SelItem, TBoxRefPar.OrigItem, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters) + ' Return True + ' End Select + 'End If TBoxRefPar.SetIsActive(TBoxPar.IsActive) Return True ElseIf TypeOf CmpRefPar Is TextBoxParam AndAlso CmpPar.DDFName = CmpRefPar.DDFName Then @@ -2414,6 +2451,17 @@ Public Class ComboBoxParam End Set End Property + ' in questa variabile devo salvare il valore calcolato dal Matching.lua + Private m_OrigItem As String + Public Property OrigItem As String + Get + Return m_OrigItem + End Get + Set(value As String) + m_OrigItem = value + End Set + End Property + Private m_ItemList As New ObservableCollection(Of String) Public Property ItemList As ObservableCollection(Of String) Get @@ -2474,10 +2522,28 @@ Public Class ComboBoxParam sSide = DirectCast(CmpPar, ComboBoxParam).ItemListDDF(IndexItemDDF) End If End If - Map.refAssemblyPageVM.CurrAssembly.CreateCompoOnJamb(CurrCompo, Trim(sSide)) + Map.refAssemblyPageVM.CurrAssembly.CreateCompoOnJamb(CurrCompo, Trim(sSide)) End If - ' verifico di essere nella configurazione HardwareManager e che la Compo chiamata si chiama "Match File" - If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage And CmpPar.CurrCompo.TemplateName = "Match File" Then + + ' significa che sto modificando una componente del telaio + If Not IsNothing(CurrCompo.refCompoDoor) Then + For Each ItemParam In CurrCompo.refCompoDoor.CompoParamList + If ItemParam.DDFName = Me.DDFName AndAlso TypeOf ItemParam Is ComboBoxParam Then + m_OrigItem = DirectCast(ItemParam, ComboBoxParam).SelItem + Exit For + End If + Next + If Trim(m_SelItem) = Trim(m_OrigItem) Then + IsModifingRefCompoParam = False + Else + IsModifingRefCompoParam = True + End If + NotifyPropertyChanged("ErrorParameter") + End If + + ' verifico di essere nella configurazione HardwareManager e che la Compo chiamata si chiama "Match File" + If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage AndAlso + (CmpPar.CurrCompo.TemplateName = MATCHING_FILE_TEMPLATE OrElse CmpPar.CurrCompo.TemplateName = MATCHING_FILE_TEMPLATE_DOOR) Then Select Case CmpPar.DDFName Case ConstCompo.MATCHING_INI ' devo caricare la lista dei Brand da associare @@ -2499,8 +2565,9 @@ Public Class ComboBoxParam EnableCopy = False End If NotifyPropertyChanged("ErrorParameter") - ' verifico di essere nella configurazione HardwareManager e che la Compo chiamata si chiama "Match File" - If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage And Me.CurrCompo.TemplateName = "Match File" Then + ' verifico di essere nella configurazione HardwareManager e che la Compo chiamata si chiama "Match File" MATCHING_FILE_TEMPLATE_DOOR + If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage AndAlso + (Me.CurrCompo.TemplateName = MATCHING_FILE_TEMPLATE OrElse Me.CurrCompo.TemplateName = MATCHING_FILE_TEMPLATE_DOOR) Then ' leggo quale è il nome del parametro che sto caricando Select Case Me.DDFName Case ConstCompo.MATCHING_INI diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb index 9b9396f..0ee4cfe 100644 --- a/DoorParameters/Part.vb +++ b/DoorParameters/Part.vb @@ -2757,7 +2757,13 @@ Public Class Part If GetKey(sLine) = K_IDCODECOMPONENT Then Dim IdCode As String = String.Empty IdCode = GetValueWithKey(sLine, K_IDCODECOMPONENT) - If Not String.IsNullOrEmpty(IdCode) Then m_CurrCompo.IdCode = IdCode + If Not String.IsNullOrEmpty(IdCode) Then + Dim ItemCode As String() = IdCode.Split(","c) + m_CurrCompo.IdCode = Trim(ItemCode(0)) + If ItemCode.Count > 1 AndAlso Trim(ItemCode(1)) = "matched" Then + m_CurrCompo.MatchedDoor = True + End If + End If Index = NextIndex(Index) End If End If diff --git a/DoorParameters/PartPageV.xaml b/DoorParameters/PartPageV.xaml index 9602ab1..0866ad6 100644 --- a/DoorParameters/PartPageV.xaml +++ b/DoorParameters/PartPageV.xaml @@ -664,7 +664,7 @@ - + @@ -702,7 +702,7 @@ - + diff --git a/HardwareManager/Hardware.vb b/HardwareManager/Hardware.vb index c5ffc04..e534737 100644 --- a/HardwareManager/Hardware.vb +++ b/HardwareManager/Hardware.vb @@ -22,6 +22,8 @@ Public Class Hardware Dim sLastTemplate As String = String.Empty Dim m_LastDirectory As CompoBrandDir + Dim m_MatchingDoor_Door As Boolean = False + ' Path StdTemplate.ini Private m_StdTemplate As String = String.Empty ' il percorso viene aggiornato ad ogni scelta dell'hardware in LoadType() Public ReadOnly Property StdTemplate As String @@ -298,7 +300,7 @@ Public Class Hardware ' carcio la lista "LocalHardwareListDDFName" l'elemco IniFile.GetPrivateProfileMatchHardware(ConstCompo.MATCHING_INI, "List", LocalHardwareListDDFName, LocalHardwareListName, m_HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME) ' verifico se esistano cartelle con estensione ".Frame" nel direttorio della componente - If m_HardwareGeneral.FrameFolderList.Count > 0 Then + If m_HardwareGeneral.FrameFolderList.Count > 0 AndAlso LocalHardwareListDDFName.IndexOf(m_HardwareGeneral.DDFName) < 0 Then ' allora aggiungo alla lista il riferiento della compoenente stessa LocalHardwareListName.Add(m_HardwareGeneral.Name) LocalHardwareListDDFName.Add(m_HardwareGeneral.DDFName) @@ -321,7 +323,44 @@ Public Class Hardware ' aggiungo il primo parametro "Matching" (lista appena costruita) Dim ComboBoxMatch As New ComboBoxParam(ConstCompo.MATCHING_INI, EgtMsg(50224), CompoMatch, LocalHardwareListName, LocalHardwareListDDFName, LocalHardwareListName(0)) CompoMatch.CompoParamList.Add(ComboBoxMatch) - If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then CompoMatch.GroupVisibilityChapter = Visibility.Collapsed + If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then + CompoMatch.GroupVisibilityChapter = Visibility.Collapsed + End If + Return CompoMatch + End Function + + ' permette di creare il Matching Door-Door (quindi non solo con le componenti di tipo frame) + Private Function CreateChapterMatchingDoor() As Compo + If Me.SelBrand.ModelDir.ToLower.Contains(FRAME_FOLDER) Then Return Nothing + ' verifico se la componente deve gestire degli accomppiamenti Anta-Anta + m_MatchingDoor_Door = IniFile.GetPrivateProfileRefCompoDoor(ConstCompo.MATCHING_INI, "Door", m_HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME) + If Not m_MatchingDoor_Door Then Return Nothing + ' creo la classe che ospiterà gli oggetti di tipo ComboBox + Dim CompoMatch As New Compo(m_HardwareGeneral, True) + CompoMatch.TemplateDDFName = MATCHING_FILE_TEMPLATE_DOOR + CompoMatch.TemplateName = MATCHING_FILE_TEMPLATE_DOOR + ' creo le liste delle configurazioni + Dim LocalHardwareListName As New ObservableCollection(Of String) + Dim LocalHardwareListDDFName As New ObservableCollection(Of String) + ' se questo file non esiste dovrei interrompere il caricamento? + If File.Exists(m_HardwareGeneral.Path & "\" & MATCHING_FILE_NAME) Then + LocalHardwareListName.Add(MATCHING_FILE_AUTOMATIC) + LocalHardwareListDDFName.Add(MATCHING_FILE_AUTOMATIC) + End If + ' aggiungo alla lista il riferiemento "None" + LocalHardwareListName.Add(MATCHING_FILE_NONE) + LocalHardwareListDDFName.Add(MATCHING_FILE_NONE) + ' ricerco il capitolo [Matching] nel file di configurazione della componente + ' carcio la lista "LocalHardwareListDDFName" l'elemco + IniFile.GetPrivateProfileMatchHardware(ConstCompo.MATCHING_INI, "List", LocalHardwareListDDFName, LocalHardwareListName, m_HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME) + If LocalHardwareListDDFName.Count < 1 Then Return Nothing + ' aggiungo il primo parametro "Matching" (lista appena costruita) + Dim ComboBoxMatch As New ComboBoxParam(ConstCompo.MATCHING_INI, EgtMsg(50224), CompoMatch, LocalHardwareListName, LocalHardwareListDDFName, LocalHardwareListName(0)) + CompoMatch.CompoParamList.Add(ComboBoxMatch) + ' disabilito il capitolo se non è specificato nel file Config.ini "[Matching.ini] Door = 1" + If OptionModule.m_ConfigurationSoftware = ConfigType.Door OrElse Not m_MatchingDoor_Door Then + CompoMatch.GroupVisibilityChapter = Visibility.Collapsed + End If Return CompoMatch End Function @@ -330,7 +369,11 @@ Public Class Hardware Dim BrandList As New ObservableCollection(Of CompoBrandDir) For Each Item In Map.refCompoPanelHardwareVM.CompoTypeList If Item.Name = ComboBoxMatch.SelItem Then - BrandList = Item.FrameFolderList + If m_MatchingDoor_Door AndAlso CompoMatch.TemplateDDFName = MATCHING_FILE_TEMPLATE_DOOR Then + BrandList = Item.FolderList + Else + BrandList = Item.FrameFolderList + End If Exit For End If Next @@ -343,14 +386,17 @@ Public Class Hardware Dim CompoMatch As Compo = ComboBoxMatch.CurrCompo Dim BrandListGraphic As New ObservableCollection(Of String) ' estrapolo dalla lista del BrandList - For Each Item In Map.refCompoPanelHardwareVM.CompoTypeList - If Item.Name = ComboBoxMatch.SelItem Then - BrandList = Item.FrameFolderList - For Each Element In BrandList - BrandListGraphic.Add(Element.ModelDirGraphic) - Next - Exit For - End If + If IsNothing(BrandList) Then + ' se l'oggetto lista + For Each Item In Map.refCompoPanelHardwareVM.CompoTypeList + If Item.Name = ComboBoxMatch.SelItem Then + BrandList = Item.FrameFolderList + Exit For + End If + Next + End If + For Each Element In BrandList + BrandListGraphic.Add(Element.ModelDirGraphic) Next ' prima di procedere ripulisco completamente l'elenco If CompoMatch.CompoParamList.Count > 1 Then @@ -385,6 +431,9 @@ Public Class Hardware For Each Item In Map.refCompoPanelHardwareVM.CompoTypeList If Item.Name = ComboBoxMatch.SelItem Then BrandList = Item.FrameFolderList + If m_MatchingDoor_Door Then + BrandList = Item.FolderList + End If For Each Element In BrandList BrandListGraphic.Add(Element.ModelDirGraphic) Next @@ -722,6 +771,12 @@ Public Class Hardware LocalCompoMatch.SetIsFixed(True) GroupChapters.Add(LocalCompoMatch) End If + ' se la componente lo prevede allora aggiungo + Dim LocalCompoMatchDoor As Compo = CreateChapterMatchingDoor() + If Not IsNothing(LocalCompoMatchDoor) AndAlso LocalCompoMatchDoor.GroupVisibilityChapter = Visibility.Visible Then + LocalCompoMatchDoor.SetIsFixed(True) + GroupChapters.Add(LocalCompoMatchDoor) + End If End Sub ' carico la liste dei nomi dei capitoli @@ -752,6 +807,7 @@ Public Class Hardware Dim FileContent() As String Dim CurrItemPath As String = CurrPath() Dim MatchingFile As String = String.Empty + Dim MatchingFileDoor As String = String.Empty Dim Version As String = "2" ' 2 è la versione nuova, 1 la versione vecchia Dim IsActiveVersion As Integer = 0 @@ -837,9 +893,13 @@ Public Class Hardware CascadedChapter(m_GroupChapters, m_GroupChapterName(IndexName)) Next - ' ricerco il nome dell'associazione - MatchingFile = ReadMatchingFile(FileContent) - LoadMatchingFile(MatchingFile) + ' ricerco il nome dell'associazione Frame + MatchingFile = ReadMatchingFile(FileContent, K_MATCHING_FILE) + LoadMatchingFile(MatchingFile, MATCHING_FILE_TEMPLATE) + ' ricerco il nome dell'associazione Door + MatchingFileDoor = ReadMatchingFile(FileContent, K_MATCHING_FILE_DOOR) + LoadMatchingFile(MatchingFileDoor, MATCHING_FILE_TEMPLATE_DOOR) + ' carcio i valori di default della componente ReadDefaultParamDDF(FileContent) Return True End Function @@ -1057,16 +1117,16 @@ Public Class Hardware End Function ' ricerco nel file .lua dell'hardware se esiste un'associazione - Private Function ReadMatchingFile(sFile() As String) As String + Private Function ReadMatchingFile(sFile() As String, sKey As String) As String Dim LineIndex As Integer = 0 Dim ParamIndex As Integer = 1 Dim FrameFile As String = String.Empty For LineIndex = 0 To sFile.Count - 1 If RegexFunction.IsMatchingParameterTitle(sFile(LineIndex)) Then - FrameFile = Trim(RegexFunction.ParamLine(sFile(LineIndex + ParamIndex), K_MATCHING_FILE)) + FrameFile = Trim(RegexFunction.ParamLine(sFile(LineIndex + ParamIndex), sKey)) While String.IsNullOrEmpty(FrameFile) And LineIndex + ParamIndex < sFile(LineIndex + ParamIndex).Count ParamIndex += 1 - FrameFile = Trim(RegexFunction.ParamLine(sFile(LineIndex + ParamIndex), K_MATCHING_FILE)) + FrameFile = Trim(RegexFunction.ParamLine(sFile(LineIndex + ParamIndex), sKey)) Exit For End While End If @@ -1110,10 +1170,10 @@ Public Class Hardware End Function ' aggiorna la grafica (dato il nome del file) --> devo stampare gli errori - Private Function LoadMatchingFile(MatchingFile As String) As Boolean + Private Function LoadMatchingFile(MatchingFile As String, sNameChapter As String) As Boolean If String.IsNullOrEmpty(MatchingFile) Then Return False For Each ItemChapter In m_GroupChapters - If ItemChapter.TemplateDDFName = "Match File" Then + If ItemChapter.TemplateDDFName = sNameChapter Then Dim ComboBoxMatch As ComboBoxParam = DirectCast(ItemChapter.CompoParamList(0), ComboBoxParam) Dim sItem() As String = MatchingFile.Split("\"c) ' Hinge\StdMort.Frame\1_5s @@ -1718,7 +1778,34 @@ Public Class Hardware If NameParam = K_MATCHING_FILE Then For IndexGroupChapters As Integer = 0 To m_GroupChapters.Count - 1 - If m_GroupChapters(IndexGroupChapters).TemplateName = MATCHING_FILE_TEMPLATE Then + If m_GroupChapters(IndexGroupChapters).TemplateDDFName = MATCHING_FILE_TEMPLATE Then + sValue = String.Empty + If DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(0), ComboBoxParam).SelItem = MATCHING_FILE_AUTOMATIC Then + sValue = String.Empty + Return True + ElseIf DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(0), ComboBoxParam).SelItem = MATCHING_FILE_NONE Then + sValue = MATCHING_FILE_NONE + Return True + End If + For Each Item In Map.refCompoPanelVM.CompoTypeList + If Item.Name = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(0), ComboBoxParam).SelItem Then + sValue &= Path.GetFileName(Item.Path) + Exit For + End If + Next + If m_GroupChapters(IndexGroupChapters).CompoParamList.Count > 2 Then + sValue &= "\" & DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(1), ComboBoxParam).SelItem + sValue &= "\" & DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(2), ComboBoxParam).SelItem + Return True + End If + End If + Next + Return False + End If + + If NameParam = K_MATCHING_FILE_DOOR Then + For IndexGroupChapters As Integer = 0 To m_GroupChapters.Count - 1 + If m_GroupChapters(IndexGroupChapters).TemplateDDFName = MATCHING_FILE_TEMPLATE_DOOR Then sValue = String.Empty If DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(0), ComboBoxParam).SelItem = MATCHING_FILE_AUTOMATIC Then sValue = String.Empty diff --git a/IniFile.vb b/IniFile.vb index 855b157..14df65d 100644 --- a/IniFile.vb +++ b/IniFile.vb @@ -338,14 +338,23 @@ Friend Module IniFile Dim sVal As String = String.Empty EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, "", sVal, CompoIniPath) If Not String.IsNullOrEmpty(sVal) Then - - Name = sVal + Name = sVal Return True Else Return False End If End Function + Public Function GetPrivateProfileRefCompoDoor(IpAppName As String, IpKeyName As String, CompoIniPath As String) As Boolean + Dim sVal As String = String.Empty + EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, "", sVal, CompoIniPath) + If String.IsNullOrEmpty(sVal) OrElse Trim(sVal) = "0" Then + Return False + Else + Return True + End If + End Function + ' lettura del nome layer dal file di configurazioe Public Function GetPrivateProfileLayerName(IpAppName As String, IpKeyName As String, ByRef Name As String, CompoIniPath As String) As Boolean Dim sVal As String = String.Empty diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb index 69b68b1..41f241a 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -488,7 +488,7 @@ Friend Module OptionModule Catch ex As Exception End Try End If - DefaultGetPrivateProfileString("Error", "MissingParameter", "Yellow", sColor) + DefaultGetPrivateProfileString("Error", "MissingParameter", "Orange", sColor) If Not String.IsNullOrEmpty(sColor) Then Try ColorConvert = DirectCast(New BrushConverter().ConvertFrom(sColor), SolidColorBrush) @@ -512,7 +512,7 @@ Friend Module OptionModule Catch ex As Exception End Try End If - DefaultGetPrivateProfileString("Error", "ModifyingParamRef", "Yellow", sColor) + DefaultGetPrivateProfileString("Error", "ModifyingParamRef", "Orange", sColor) If Not String.IsNullOrEmpty(sColor) Then Try ColorConvert = DirectCast(New BrushConverter().ConvertFrom(sColor), SolidColorBrush)