diff --git a/Assembly/Assembly.vb b/Assembly/Assembly.vb index f628289..635bac6 100644 --- a/Assembly/Assembly.vb +++ b/Assembly/Assembly.vb @@ -1546,6 +1546,7 @@ Public Class Assembly BuiltReffCompo = True Map.refAssemblyManagerVM.CreateAssociation(Me) MatchCompo() + 'Map.refProjectManagerVM.NotifyPropertyChanged("VisibilityCreateAssembly") Return 1 End Function @@ -1835,12 +1836,14 @@ Public Class Assembly ' setta per ogni componente sul telaio la proprietà "IsReadOnly" letta dal file Matching Private Sub ResearchMatchJamb(Door As Part, Jamb As Part) For IndexCompo As Integer = 0 To Door.CompoList.Count - 1 + ReSearchFrameFile(Door.CompoList(IndexCompo)) 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 Door.CompoList(IndexCompo).refJambCompo = Jamb.CompoList(IndexCompoJamb) Jamb.CompoList(IndexCompoJamb).refCompoDoor = Door.CompoList(IndexCompo) + Door.CompoList(IndexCompo).refJambCompo.VisibilitiReloadBtn = Visibility.Visible Door.CompoList(IndexCompo).refJambCompo.IsReadOnly = False Door.CompoList(IndexCompo).IsReadOnly = True ' definisco la proprietà ReadOnly per i parametri inseriti @@ -1925,6 +1928,57 @@ Public Class Assembly End Sub + ' in fase di cricamento della porta verifico se posso esistere delle componenti da associare + ' infatti potrebbe esistere una componente sull'anta ma non sul telaio + ' il caso contrario è vietato dal programma (a meno che non sia stato modificato il ddf manualmente) + Public Function ReSearchFrameFile(ByVal CurrCompo As Compo) As Boolean + ' se è la configurazione è di songola porta allora interrompi la costruzione + If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return False + ' nome del file Matchting.ini + Dim FrameFile As String = String.Empty + ' percorso del file di Config.ini del file frame + Dim FrameFileConfig As String = String.Empty + ' numero di ante presenti nel progetto corrente + Dim nDoorNbr As Integer = 1 + + ' 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 + End If + ' se non esiste nessun accoppiamento allora esco ed elimino la componente + If FrameFile.Contains("None") Then + CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed + Return False + End If + ' converto il numero di porte da string a int + Int32.TryParse(Map.refAssemblyPageVM.CurrAssembly.DoorNumber, nDoorNbr) + ' cerco il nome nella tabella: se lo script lua da errori, e la variabile FrameFile è vuota esco + If String.IsNullOrEmpty(FrameFile) AndAlso + Not CalcCompoMatching(CurrCompo.CompoType.Path, nDoorNbr, CurrCompo.TemplateSelItem, FrameFile) Then + CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed + Return False + End If + CurrCompo.VisibilitiReloadBtn = Visibility.Visible + Return True + End Function + #End Region ' Associazione delle compo lette da ddf #End Region ' Lettura Assemblato @@ -1988,19 +2042,26 @@ Public Class Assembly ' ricerco il PartDoor associato al side Dim refPartDoor As PartDoor = Nothing - For Each ItemPartDoor In ListPartDoor - If ItemPartDoor.Type = Map.refPartPageVM.CurrPart.TypePart Then - For Each ItemAssociation In ItemPartDoor.ListAssociation - ' verifico che esiesta un Part sul lato indicato dal side - If ItemAssociation.Side > nSide AndAlso ItemAssociation.Side < nSide + 100 Then - refPartDoor = ItemAssociation.refPartDoor - End If - Next - Exit For - End If - Next + If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then + For Each ItemPartDoor In ListPartDoor + If ItemPartDoor.Type = Map.refPartPageVM.CurrPart.TypePart Then + For Each ItemAssociation In ItemPartDoor.ListAssociation + ' verifico che esiesta un Part sul lato indicato dal side + If ItemAssociation.Side > nSide AndAlso ItemAssociation.Side < nSide + 100 Then + refPartDoor = ItemAssociation.refPartDoor + End If + Next + Exit For + End If + Next + Else + refPartDoor = Map.refAssemblyPageVM.ReserchPartDoor(Map.refPartPageVM.CurrPart.TypePart) + End If ' se non è stata trovata nessuna associazione esco - If IsNothing(refPartDoor) Then Return False + If IsNothing(refPartDoor) Then + CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed + Return False + End If ' cerco il nome della componente da associare FrameFile Dim CurrDoorHArdwareFile As String = CurrCompo.CompoType.Path & "\" & CurrCompo.TemplateSelItem @@ -2031,6 +2092,7 @@ Public Class Assembly End If ' 50144 =Warning, 50166 =Jamb compo does not exist 'MessageBox.Show(EgtMsg(50166), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning) + CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed Return False End If ' converto il numero di porte da string a int @@ -2043,6 +2105,7 @@ Public Class Assembly Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo, True) CurrCompo.refJambCompo = Nothing End If + CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed Return False End If @@ -2056,6 +2119,7 @@ Public Class Assembly CurrCompo.refJambCompo = Nothing End If ' restituisco false perchè la componente non è stata creata + CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed Return False Else ' inizio la lettura di FrameFileConfig @@ -2088,6 +2152,7 @@ Public Class Assembly CurrCompo.refJambCompo.refCompoDoor = CurrCompo Else MessageBox.Show("File '" & FrameFile & "' exist, but it is not in the correct Directory!", EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning) + CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed Return False End If End If @@ -2102,6 +2167,121 @@ Public Class Assembly MessageBox.Show(Msg, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) End If ' se sono arrivato in fondo significa che il riferiemnto è stato costruito + CurrCompo.VisibilitiReloadBtn = Visibility.Visible + CurrCompo.refJambCompo.VisibilitiReloadBtn = Visibility.Visible + Return True + End Function + + ' questa funzione è utilizzata per ricostruire (da Matching.lua) una componente del telaio a partire da essa stessa + Public Function CreateCompoOnJambFromJamb(ByRef CurrCompo As Compo, ByVal sSide As String) As Boolean + Dim IndexRefCompo As Integer = -1 + ' se è la configurazione è di songola porta allora interrompi la costruzione + If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return False + ' nome del file Matchting.ini + Dim FrameFile As String = String.Empty + ' percorso del file di Config.ini del file frame + Dim FrameFileConfig As String = String.Empty + ' 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 + ' se non è stata trovata nessuna associazione esco + If IsNothing(refPartDoor) Then + CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed + Return False + End If + + ' 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 + IndexRefCompo = Index + End If + Next + + ' ricerco l'anta a cui devo fare riferimento (dalle informazioni della Compo e del tipo di Frame) + Dim LocalDoor As Part = Map.refAssemblyPageVM.ReserchPartDoor("DO_1").Door + If IsNothing(LocalDoor) Then + Return False + End If + If m_DoorNumber <> "1" Then + If refPartDoor.Door.TypePart.Contains("FT_") AndAlso CurrCompo.OtherDoor Then + LocalDoor = Map.refAssemblyPageVM.ReserchPartDoor("DO_2").Door + ElseIf refPartDoor.Door.TypePart.Contains("FB_") AndAlso Not CurrCompo.OtherDoor Then + LocalDoor = Map.refAssemblyPageVM.ReserchPartDoor("DO_2").Door + ElseIf refPartDoor.Door.TypePart.Contains("FR_") Then + LocalDoor = Map.refAssemblyPageVM.ReserchPartDoor("DO_2").Door + End If + End If + + ' costruisco il nome del FrameFile + Dim DirectoryCompo As String = Path.GetFileName(CurrCompo.refJambCompo.CompoType.Path) + FrameFile = DirectoryCompo & "\" & CurrCompo.refJambCompo.TemplateSelItem + + ' costruisco il percosrso del file Config.ini associato al FrameFile + If Not SearchFileConfig(FrameFile, FrameFileConfig) Then + ' 50144 =Warning, 50166 =Jamb compo does not exist + ' MessageBox.Show(EgtMsg(50166), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning) + ' se il file FrameFileConfig.ini non esiste allora elimino il riferimento + If Not IsNothing(CurrCompo.refJambCompo) Then + LocalDoor.RemoveCompo(CurrCompo, True) + CurrCompo.refJambCompo = Nothing + End If + ' restituisco false perchè la componente non è stata creata + Return False + Else + ' inizio la lettura di FrameFileConfig + Dim FrameNameDDF As String = String.Empty + Dim FrameName As String = String.Empty + Dim FrameSide As String = String.Empty + Dim FrameFolderName As String = String.Empty + GetPrivateProfileCompoName(ConstCompo.S_COMPO, ConstCompo.K_NAME, FrameNameDDF, FrameName, FrameFileConfig) + GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, FrameSide, FrameFileConfig) + GetPrivateProfileFolderName(S_TEMPLATE, K_FOLDER_NAME, FrameFolderName, FrameFileConfig) + + 'Ogni volta che creo una componente elimino i precedenti riferimenti + If Not IsNothing(CurrCompo.refJambCompo) Then LocalDoor.RemoveCompo(CurrCompo, True) + 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) + 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 + CurrCompo.refJambCompo.OtherDoor = True + ElseIf sSide = "Bottom" And LocalDoor.TypePart.Contains("DO_1") And m_DoorNumber <> "1" Then + CurrCompo.refJambCompo.OtherDoor = True + End If + End If + ' setto il nome della componente da caricare + If Not IsNothing(CurrCompo.refJambCompo) Then + CurrCompo.refJambCompo.SplitBrandFile(FrameFile) + CurrCompo.refJambCompo.refCompoDoor = CurrCompo + Else + MessageBox.Show("File '" & FrameFile & "' exist, but it is not in the correct Directory!", EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning) + CurrCompo.VisibilitiReloadBtn = Visibility.Collapsed + Return False + End If + End If + + ' assegno i parametri letti dallo script per il corretto posizionamento del pezzo ( solo se il pezzo corrente è un DO_) + If LoadCompoParam(CurrCompo, LocalDoor.TypePart) Then + UpDateCurrCompoJamb(CurrCompo, LocalDoor.TypePart) + ResetSTU() + ResetCompoParam() + Else + Dim Msg As String = String.Format(EgtMsg(50157), CurrCompo.CompoType.Path, MATCHING_FILE_NAME) + MessageBox.Show(Msg, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) + End If + ' se sono arrivato in fondo significa che il riferiemnto è stato costruito + CurrCompo.VisibilitiReloadBtn = Visibility.Visible + CurrCompo.refJambCompo.VisibilitiReloadBtn = Visibility.Visible Return True End Function @@ -2207,7 +2387,9 @@ Public Class Assembly Case "Swing" UpDateCompolistOnJamb() SwingJamb() - UpDateAllCompo() + SetPartDoorCurrAssembly() + CreateAssembly(True) + 'UpDateAllCompo() Case "DoorNumber" ClearRefOnAssembly() @@ -2231,20 +2413,56 @@ Public Class Assembly #Region "UpDateRefCompo" - Public Sub CreateAssembly() + ' ricostruisce tutte le componenti del telaio + Public Sub CreateAssembly(Optional bAllDoors As Boolean = False) If ListPartDoorOfDoor.Count < 1 Then Return 'If Not JambExists Then SetDimension("JambIsCheked") Dim nIndexDoor As Integer = 0 - If Not IsNothing(Map.refPartPageVM.CurrPart) Then + If Not IsNothing(Map.refPartPageVM.CurrPart) AndAlso Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage AndAlso Not bAllDoors Then If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then + If IsThereModifyCompoParamRef(Map.refPartPageVM.CurrPart.CompoList) Then + If MessageBox.Show("Every componente on jambs will be relocated, do you want to continue", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Asterisk) = MessageBoxResult.No Then + Return + End If + End If For IndexCompo = 0 To Map.refPartPageVM.CurrPart.CompoList.Count - 1 CreateCompoOnJamb(Map.refPartPageVM.CurrPart.CompoList(IndexCompo)) Next End If + ElseIf Not IsNothing(Map.refPartPageVM.CurrPart) AndAlso Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage AndAlso bAllDoors Then + ' verifico per entrmabe le ante se posso procedere + For Each ItemPart In ListPartDoorOfDoor + For IndexCompo = 0 To ItemPart.Door.CompoList.Count - 1 + If IsThereModifyCompoParamRef(ItemPart.Door.CompoList) Then + If MessageBox.Show("Every componente on jambs will be relocated, do you want to continue", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Asterisk) = MessageBoxResult.No Then + Return + Else + Exit For + End If + End If + Next + Next + For Each ItemPart In ListPartDoorOfDoor + For IndexCompo = 0 To ItemPart.Door.CompoList.Count - 1 + CreateCompoOnJamb(ItemPart.Door.CompoList(IndexCompo)) + Next + Next End If Map.refSceneManagerVM.RefreshBtn() End Sub + ' appena verifico che esiste anche solo una componente modificata esco + Private Function IsThereModifyCompoParamRef(ByVal CompoList As ObservableCollection(Of Compo)) As Boolean + For Each ItemCompo In CompoList + If Not IsNothing(ItemCompo.refJambCompo) Then + For Each ItemParam In ItemCompo.refJambCompo.CompoParamList + If ItemParam.IsModifingRefCompoParam Then Return True + Next + End If + Next + Return False + End Function + ' è chiamata ogni volta che viene modificato un parametro del general dell'assemblato Public Sub UpDateAllCompo() Dim IdexDoorNumber As Integer = 0 @@ -2268,6 +2486,26 @@ Public Class Assembly Next End Sub + ' quando carico un assemblato devo ricalcolare tutti i parametri OrigValue + Public Sub UpDateAllOrigValue() + Dim IdexDoorNumber As Integer = 0 + IdexDoorNumber = CInt(m_DoorNumber) + If ListPartDoorOfDoor.Count < 1 Then Return + For IndexDoor As Integer = 0 To IdexDoorNumber - 1 + For IndexCompo As Integer = 0 To ListPartDoorOfDoor(IndexDoor).Door.CompoList.Count - 1 + ' per ogni componente di ogni porta, se esiste una componente di riferimento + Dim CurrCompo As Compo = ListPartDoorOfDoor(IndexDoor).Door.CompoList(IndexCompo) + If Not IsNothing(CurrCompo.refJambCompo) Then + ' ricerco il file lua che gestisce le associazioni delle componenti + If LoadCompoParam(CurrCompo, ListPartDoorOfDoor(IndexDoor).Door.TypePart) Then + UpdateOrigValue(CurrCompo, ListPartDoorOfDoor(IndexDoor).Door.TypePart) + ResetCompoParam() + End If + End If + Next + Next + End Sub + ' Ricevuta la componente Compo aggiorna la refCompo - Usata fino alla versione 2.2e1 del 7/5/2020 Public Sub UpDateCurrCompoJamb_OldVersion(ByRef CurrCompo As Compo, ByRef sCurrTypeDoor As String) CurrCompo.refJambCompo.IsReadOnly = False @@ -2324,7 +2562,7 @@ Public Class Assembly End Sub ' Ricevuta la componente Compo aggiorna la refCompo - In uso dalla versione 2.2e1 del 8/5/2020 - Public Sub UpDateCurrCompoJamb(ByRef CurrCompo As Compo, ByRef sCurrTypeDoor As String) + Public Sub UpDateCurrCompoJamb(ByRef CurrCompo As Compo, ByRef sCurrTypeDoor As String, Optional bOverWrite As Boolean = True) CurrCompo.refJambCompo.IsReadOnly = False ' ad ogni parametro (sul compo frame) associo il parametro con lo stesso nome (sul compo door) For Each ItemCompoRef In CurrCompo.refJambCompo.CompoParamList @@ -2336,8 +2574,14 @@ Public Class Assembly If TypeOf ItemCompoRef Is TextBoxOnOffParam AndAlso TypeOf ItemCompo Is TextBoxOnOffParam Then Dim TBoxPar As TextBoxOnOffParam = DirectCast(ItemCompo, TextBoxOnOffParam) Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(ItemCompoRef, TextBoxOnOffParam) + ' non ricalcolo il parametro + If TBoxRefPar.IsModifingRefCompoParam AndAlso Not bOverWrite Then + CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters) + Continue For + End If ' assegno i valori della componente dell'anta, e ricevo i valori da asseganre alla compente sul jamb CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters) + TBoxRefPar.OrigValue = TBoxRefPar.m_Value TBoxRefPar.SetIsActive(TBoxPar.IsActive) ElseIf TypeOf ItemCompoRef Is ComboBoxOnOffParam AndAlso TypeOf ItemCompo Is ComboBoxOnOffParam Then ' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta @@ -2356,8 +2600,13 @@ Public Class Assembly ' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta Dim TBoxRefPar As TextBoxParam = DirectCast(ItemCompoRef, TextBoxParam) Dim TBoxPar As TextBoxParam = DirectCast(ItemCompo, TextBoxParam) + If TBoxRefPar.IsModifingRefCompoParam AndAlso Not bOverWrite Then + CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters) + Continue For + End If ' assegno i valori della componente dell'anta, e ricevo i valori da asseganre alla compente sul jamb CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters) + TBoxRefPar.OrigValue = TBoxRefPar.m_Value ElseIf TypeOf ItemCompoRef Is ComboBoxParam AndAlso TypeOf ItemCompo Is ComboBoxParam Then ' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta ' l'unica operazione che eseguo è di abilitare la combobox @@ -2378,6 +2627,43 @@ Public Class Assembly Next End Sub + ' carico i valori OrigValue in fase di lettura di un assemblato nuovo + Public Sub UpdateOrigValue(ByRef CurrCompo As Compo, ByRef sCurrTypeDoor As String) + CurrCompo.refJambCompo.IsReadOnly = False + ' ad ogni parametro (sul compo frame) associo il parametro con lo stesso nome (sul compo door) + For Each ItemCompoRef In CurrCompo.refJambCompo.CompoParamList + ' cerco il parametro con lo stesso nome nella componente della porta + For Each ItemCompo In CurrCompo.CompoParamList + ' se trovo lo stesso nome + If ItemCompoRef.DDFName = ItemCompo.DDFName Then + ' verifico che siano anche dello stesso tipo + If TypeOf ItemCompoRef Is TextBoxOnOffParam AndAlso TypeOf ItemCompo Is TextBoxOnOffParam Then + Dim TBoxPar As TextBoxOnOffParam = DirectCast(ItemCompo, TextBoxOnOffParam) + Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(ItemCompoRef, TextBoxOnOffParam) + ' assegno i valori della componente dell'anta, e ricevo i valori da asseganre alla compente sul jamb + 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 + 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 + Dim TBoxRefPar As TextBoxParam = DirectCast(ItemCompoRef, TextBoxParam) + Dim TBoxPar As TextBoxParam = DirectCast(ItemCompo, TextBoxParam) + ' assegno i valori della componente dell'anta, e ricevo i valori da asseganre alla compente sul jamb + 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 + End If + End If + ' passo al parametro successivo della lista del CompoRef + Exit For + End If + Next + Next + End Sub + ' copia i parametri di una componente (PrecCompo) su un'altra componente (NewCompo, solo se hanno lo stesso nome) Public Sub CopyParam(ByRef PrecCompo As Compo, ByRef NewCompo As Compo) If PrecCompo.TemplateSelItem <> NewCompo.TemplateSelItem Then Return @@ -2416,6 +2702,8 @@ Public Class Assembly Next End Sub + + #End Region ' UpDateRefCompo #Region "HEIGHT" diff --git a/AssemblyManager/AssemblyManagerVM.vb b/AssemblyManager/AssemblyManagerVM.vb index 2614167..2f713b5 100644 --- a/AssemblyManager/AssemblyManagerVM.vb +++ b/AssemblyManager/AssemblyManagerVM.vb @@ -88,6 +88,10 @@ Public Class AssemblyManagerVM ' aggiorno elenco quotature Map.refDimensioningPanelVM.LoadHardwareDimList() ExecDoors(Map.refSceneManagerVM.ProjectScene, sTempFile, False) + ' rendo visibili quotature + For Each HardwareDimension In Map.refDimensioningPanelVM.HardwareDimensionList + PrintWndVM.TurnDimensioningLayer(HardwareDimension.NameLayer, HardwareDimension.SelectedLayer) + Next EgtZoom(ZM.ALL) Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage Else @@ -95,6 +99,10 @@ Public Class AssemblyManagerVM ' aggiorno elenco quotature Map.refDimensioningPanelVM.LoadHardwareDimList() ExecDoors(Map.refSceneManagerVM.ProjectScene, sTempFile, False) + ' rendo visibili quotature + For Each HardwareDimension In Map.refDimensioningPanelVM.HardwareDimensionList + PrintWndVM.TurnDimensioningLayer(HardwareDimension.NameLayer, HardwareDimension.SelectedLayer) + Next EgtZoom(ZM.ALL) Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage End If @@ -977,6 +985,7 @@ Public Class AssemblyManagerVM Next EgtZoom(ZM.ALL) m_CurrProject.SelAssemblyName.SelAssembly.MatchCompo() + m_CurrProject.SelAssemblyName.SelAssembly.UpDateAllOrigValue() Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage End If ' ogni progetto salvato è l'ultimo da aprire, anche se il programma è chiuso dall'HardwareManager @@ -1568,8 +1577,7 @@ Public Class AssemblyManagerVM SaveFileDialog.Extension = DDF_EXTENSION ' Se annullo esco If Not SaveFileDialogWnd.ShowDialog Then - 'm_CurrProject.SelAssemblyName = New AssemblyName - m_CurrProject.SelAssemblyName = Nothing + 'm_CurrProject.SelAssemblyName = Nothing Return End If Dim FilePath As String = Path.GetFileNameWithoutExtension(SaveFileDialog.FileName) diff --git a/CompoMatch.vb b/CompoMatch.vb index 1fdbbf8..fcdfff2 100644 --- a/CompoMatch.vb +++ b/CompoMatch.vb @@ -114,15 +114,36 @@ Module CompoMatch Dim dThicknessDoor As Double Dim dHeightDoor As Double - If Not IsNothing(Map.refPartPageVM.CurrPart) Then - EgtLuaSetGlobStringVar("STU.SelDoor", Map.refPartPageVM.CurrPart.TypePart) - StringToDouble(Map.refPartPageVM.CurrPart.Thickness, dThicknessDoor) - StringToDouble(Map.refPartPageVM.CurrPart.Height, dHeightDoor) - ElseIf CurrAssembly.ListPartDoorOfDoor.Count > 0 Then - StringToDouble(CurrAssembly.ListPartDoorOfDoor(0).Door.Thickness, dThicknessDoor) - StringToDouble(CurrAssembly.ListPartDoorOfDoor(0).Door.Height, dHeightDoor) + + If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then + If Not IsNothing(Map.refPartPageVM.CurrPart) Then + EgtLuaSetGlobStringVar("STU.SelDoor", Map.refPartPageVM.CurrPart.TypePart) + StringToDouble(Map.refPartPageVM.CurrPart.Thickness, dThicknessDoor) + StringToDouble(Map.refPartPageVM.CurrPart.Height, dHeightDoor) + ElseIf CurrAssembly.ListPartDoorOfDoor.Count > 0 Then + StringToDouble(CurrAssembly.ListPartDoorOfDoor(0).Door.Thickness, dThicknessDoor) + StringToDouble(CurrAssembly.ListPartDoorOfDoor(0).Door.Height, dHeightDoor) + End If + Else + Dim LocalDoor As Part = Map.refAssemblyPageVM.ReserchPartDoor("DO_1").Door + If Not IsNothing(LocalDoor) Then + If Map.refAssemblyPageVM.CurrAssembly.DoorNumber <> "1" Then + If Map.refPartPageVM.CurrPart.TypePart.Contains("FT_") AndAlso CurrCompo.OtherDoor Then + LocalDoor = Map.refAssemblyPageVM.ReserchPartDoor("DO_2").Door + ElseIf Map.refPartPageVM.CurrPart.TypePart.Contains("FB_") AndAlso Not CurrCompo.OtherDoor Then + LocalDoor = Map.refAssemblyPageVM.ReserchPartDoor("DO_2").Door + End If + End If + EgtLuaSetGlobStringVar("STU.SelDoor", LocalDoor.TypePart) + StringToDouble(LocalDoor.Thickness, dThicknessDoor) + StringToDouble(LocalDoor.Height, dHeightDoor) + ElseIf CurrAssembly.ListPartDoorOfDoor.Count > 0 Then + StringToDouble(CurrAssembly.ListPartDoorOfDoor(0).Door.Thickness, dThicknessDoor) + 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 aba9ec6..2e7be40 100644 --- a/Constants/ConstCompo.vb +++ b/Constants/ConstCompo.vb @@ -65,6 +65,7 @@ Module ConstCompo Public Const K_NAME As String = "Name" Public Const S_TEMPLATE As String = "Template" Public Const K_ISACTIVE As String = "IsActive" + Public Const K_MATERIAL As String = "Material" Public Const K_CASCADED As String = "Cascaded" Public Const K_FOLDER_NAME As String = "FolderName" ' K_NAME come sopra indicato diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb index 28957ef..3fc9f4d 100644 --- a/DoorParameters/Compo.vb +++ b/DoorParameters/Compo.vb @@ -156,6 +156,21 @@ Public Class Compo End Set End Property + ' gestisce la visibilità del bottone accanto al nome componente per rigenerare il riferimento + Private m_VisibilitiReloadBtn As Visibility = Visibility.Collapsed + Public Property VisibilitiReloadBtn As Visibility + Get + If OptionModule.m_ConfigurationSoftware <> ConfigType.Assembly Then + m_VisibilitiReloadBtn = Visibility.Collapsed + End If + Return m_VisibilitiReloadBtn + End Get + Set(value As Visibility) + m_VisibilitiReloadBtn = value + NotifyPropertyChanged("VisibilitiReloadBtn") + End Set + End Property + #Region "Gestione Errori DOORCreator" Public m_ParameterDDfList As New List(Of String) @@ -214,7 +229,8 @@ Public Class Compo Set(value As Boolean) m_ErrorValue = value For Each Param In Me.CompoParamList - If Param.ErrorParameter then + ' non evidenzio tutta la componete se è una modifica del parametro + If Param.ErrorParameter AndAlso Not Param.IsModifingRefCompoParam Then m_ErrorValue = True Exit For End If @@ -1857,6 +1873,7 @@ Public Class Compo ' Definizione comando Private m_CmdDelete As ICommand + Private m_CmdReload As ICommand ' creo una copia dell'oggetto Sub New(CompoType As CompoType) @@ -1897,6 +1914,70 @@ Public Class Compo #End Region ' DeleteCommand +#Region "ReloadCompoRef" + + Public ReadOnly Property ReloadCompoRefCmd As ICommand + Get + If m_CmdReload Is Nothing Then + m_CmdReload = New Command(AddressOf ReloadCompoRef) + End If + Return m_CmdReload + End Get + End Property + + Public Sub ReloadCompoRef() + If Not IsNothing(Map.refAssemblyPageVM) AndAlso Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) Then + ' FRAME + If Not IsNothing(Me.refCompoDoor) Then + Dim sSide As String = "" + If Map.refPartPageVM.CurrPart.TypePart.Contains(ConstGen.PART_FRAME_TOP) Then + sSide = "Top" + ElseIf Map.refPartPageVM.CurrPart.TypePart.Contains(ConstGen.PART_FRAME_BOTTOM) Then + sSide = "Bottom" + End If + ' se decido di non sovrascrivere allora devo ricalcoare tutte le compoenti non modificate + Map.refAssemblyPageVM.CurrAssembly.CreateCompoOnJambFromJamb(Me.refCompoDoor, sSide) + ' aggiorno la grafica + Map.refSceneManagerVM.RefreshBtn() + Return + End If + ' DOOR + ' controllo se le componenti sono già state modificate + If Not IsNothing(Me.refJambCompo) Then + Dim sMsg As String = "The current parameters have been modified: " + Dim sListParam As String = "" + For Each Param In Me.refJambCompo.CompoParamList + If Param.IsModifingRefCompoParam Then + sListParam &= Param.Name & ", " + Exit For + End If + Next + If Not String.IsNullOrEmpty(sListParam) Then + sMsg = sMsg & sListParam & vbCrLf & "Do you want to overwrite?" + Select Case MessageBox.Show(sMsg, "Warning", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning) + Case MessageBoxResult.Cancel + Return + Case MessageBoxResult.No + If Not IsNothing(Map.refPartPageVM) AndAlso + Not IsNothing(Map.refPartPageVM.CurrPart) Then + Map.refAssemblyPageVM.CurrAssembly.UpDateCurrCompoJamb(Me, Map.refPartPageVM.CurrPart.TypePart, False) + Return + End If + End Select + End If + End If + If Map.refAssemblyPageVM.CurrAssembly.CreateCompoOnJamb(Me) Then + ' aggiorno la grafica + Map.refSceneManagerVM.RefreshBtn() + Me.VisibilitiReloadBtn = Visibility.Visible + Else + Me.VisibilitiReloadBtn = Visibility.Collapsed + End If + End If + End Sub + +#End Region ' ReloadCompoRef + #End Region 'Commands Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged @@ -1910,16 +1991,40 @@ End Class Public Class CompoParam Implements INotifyPropertyChanged - Public ReadOnly Property ErrorParameter As Boolean + Public ReadOnly Property ColorParam As String Get - If m_ErrorInReading Or m_MissingParameterInReading Then - Return True + If m_IsModifingRefCompoParam Then + Return OptionModule.ColorModifyingParamRef Else - Return False + Return OptionModule.ColorErrorValue End If End Get End Property + Public ReadOnly Property ErrorParameter As Boolean + Get + If m_ErrorInReading Or m_MissingParameterInReading Or m_IsModifingRefCompoParam Then + Return True + NotifyPropertyChanged("ColorParam") + Else + Return False + NotifyPropertyChanged("ColorParam") + End If + End Get + End Property + + ' questo parametro deve essere usato solo nelle componeneti del telaio + Private m_IsModifingRefCompoParam As Boolean = False + Public Property IsModifingRefCompoParam As Boolean + Get + Return m_IsModifingRefCompoParam + End Get + Set(value As Boolean) + m_IsModifingRefCompoParam = value + NotifyPropertyChanged("ErrorParameter") + End Set + End Property + Private m_ErrorInReading As Boolean = False Public Property ErrorInReading As Boolean Get @@ -2037,6 +2142,14 @@ Public Class TextBoxParam Inherits CompoParam ' Implements INotifyPropertyChanged + ' è utilizzata nel processo di ricalcolo dei parametri sul telaio, + ' per eviatre di ripetere la stessa domanda ad ogni digitazione + Private bContinueModify As Boolean = False + ' queste due variabili sono di tipo Shared perchè ogni nuova componente deve sapere quale era la precedente selezionata + ' questa informazione ha senso soltanto se abbiamo dei riferimenti sul telaio + Shared m_PrecCompoIdCode As String = "-1" + Shared m_PrecNameParam As String = String.Empty + ' utilizzato negli Hardware Private m_TypeVar As String Public Property TypeVar As String @@ -2048,6 +2161,28 @@ Public Class TextBoxParam End Set End Property + ' in questa variabile devo salvare il valore calcolato dal Matching.lua + Private m_OrigValue As String + Public Property OrigValue As String + Get + Return m_OrigValue + End Get + Set(value As String) + m_OrigValue = value + End Set + End Property + + ' questo parametro serve per le componenti sull'anta, nel caso in cui si decida di interrompere il ricalcolo (Cancel) + Private m_PrecValue As String + Public Property PrecValue As String + Get + Return m_PrecValue + End Get + Set(value As String) + m_PrecValue = value + End Set + End Property + Private m_IsReadOnly As Boolean = True Public Property IsReadOnly As Boolean Get @@ -2064,25 +2199,43 @@ Public Class TextBoxParam Return m_Value End Get Set(value As String) + ' prima di caricare un nuovo valore, salvo il precedente + m_PrecValue = m_Value m_Value = value NotifyPropertyChanged("ToolTipValue") + ' per evitare di evideziare tutta la componente come errore + IsModifingRefCompoParam = False + '----------------------------------------------------- If Not IsNumeric(ToolTipValue) Then ErrorInReading = True CurrCompo.ErrorValue = True - Else + Else ErrorInReading = False - CurrCompo.ErrorValue = False + CurrCompo.ErrorValue = False End If - MissingParameterInReading = False + MissingParameterInReading = False SetModified() If Not IsNothing(Map.refAssemblyManagerVM) Then Map.refAssemblyManagerVM.RefreshAssembly(CurrCompo) NotifyPropertyChanged("ErrorParameter") + '-------------------------------------------------------------------------------------------- + ' significa che sto modificando una componente del telaio + If Not IsNothing(CurrCompo.refCompoDoor) AndAlso Trim(m_Value) <> Trim(m_OrigValue) Then + IsModifingRefCompoParam = True + NotifyPropertyChanged("ErrorParameter") + ElseIf Not IsNothing(CurrCompo.refCompoDoor) AndAlso Trim(m_Value) = Trim(m_OrigValue) Then + IsModifingRefCompoParam = False + NotifyPropertyChanged("ErrorParameter") + End If If IsNothing(CurrCompo.refJambCompo) Then Return ' se fallisce il caricamento dei parametri esce If Not LoadCompoParam(CurrCompo, Map.refPartPageVM.CurrPart.TypePart) Then Return ' 50168=No matching param If Not UpdateParam() Then MessageBox.Show(EgtMsg(50168), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) ResetCompoParam() + ' questi due parametri identificano univocamente il parametri modificato + m_PrecCompoIdCode = CurrCompo.IdCode + m_PrecNameParam = DDFName + '--------------------------------------------------------------------------------------------- End Set End Property Public Sub SetValue(sValue As String) @@ -2136,6 +2289,7 @@ Public Class TextBoxParam End Set End Property + ' aggiorno il valore dal parametro in funzione della modifica del parametro sull'anta Public Function UpdateParam() As Boolean Dim CmpPar As CompoParam = Me Dim IndexP As Integer = CurrCompo.CompoParamList.IndexOf(Me) @@ -2144,7 +2298,31 @@ Public Class TextBoxParam If TypeOf CmpRefPar Is TextBoxOnOffParam AndAlso CmpPar.DDFName = CmpRefPar.DDFName Then Dim TBoxPar As TextBoxOnOffParam = DirectCast(CmpPar, TextBoxOnOffParam) Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(CmpRefPar, TextBoxOnOffParam) + If TBoxRefPar.IsModifingRefCompoParam Then + Dim sMsg As String = "The current parameters have been modified: " & TBoxRefPar.Name + sMsg = sMsg & vbCrLf & "Do you want to overwrite?" + ' se l'IdCode cambia rispetta al precedente significa che sto cambiando Compo + If bContinueModify AndAlso Trim(m_PrecCompoIdCode) = Trim(CurrCompo.IdCode) AndAlso + m_PrecNameParam = TBoxPar.DDFName Then + CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, 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.YesNoCancel, MessageBoxImage.Warning) + Case MessageBoxResult.No + bContinueModify = True + CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters) + Return True + Case MessageBoxResult.Cancel + TBoxPar.SetValue(m_PrecValue & " ") + Return True + End Select + End If CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters) + TBoxRefPar.OrigValue = TBoxRefPar.m_Value + ' ricalcolo il parametro, perdo le modifiche manuali + TBoxRefPar.IsModifingRefCompoParam = False TBoxRefPar.SetIsActive(TBoxPar.IsActive) Return True ElseIf TypeOf CmpRefPar Is ComboBoxOnOffParam AndAlso CmpPar.DDFName = CmpRefPar.DDFName Then @@ -2155,7 +2333,30 @@ Public Class TextBoxParam ElseIf TypeOf CmpRefPar Is TextBoxParam AndAlso CmpPar.DDFName = CmpRefPar.DDFName Then Dim TBoxPar As TextBoxParam = DirectCast(CmpPar, TextBoxParam) Dim TBoxRefPar As TextBoxParam = DirectCast(CmpRefPar, TextBoxParam) + 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.m_Value, TBoxRefPar.OrigValue, 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.YesNoCancel, MessageBoxImage.Warning) + Case MessageBoxResult.No + bContinueModify = True + CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters) + Return True + Case MessageBoxResult.Cancel + TBoxPar.SetValue(m_PrecValue & " ") + Return True + End Select + End If CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters) + TBoxRefPar.OrigValue = TBoxRefPar.m_Value + ' ricalcolo il parametro, perdo le modifiche manuali + TBoxRefPar.IsModifingRefCompoParam = False Return True ElseIf TypeOf CmpRefPar Is ComboBoxParam AndAlso CmpPar.DDFName = CmpRefPar.DDFName Then DirectCast(CmpRefPar, ComboBoxParam).IsReadOnly = False diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb index a2588f5..9b9396f 100644 --- a/DoorParameters/Part.vb +++ b/DoorParameters/Part.vb @@ -314,6 +314,7 @@ Public Class Part Return m_PropertiesIsVisible End Get Set(value As Visibility) + If m_PropertiesIsVisible <> Visibility.Visible Then Return m_PropertiesIsVisible = value NotifyPropertyChanged("PropertiesIsVisible") End Set @@ -1202,7 +1203,7 @@ Public Class Part End Function 'Gestione ComboBox e TextBox di ogni compo della pulsantiera letta da Compo.ini (Door) - Friend Function AddNewCompo(CurrCompoType As CompoType, Optional IsFrame As Boolean = False) As Compo + Friend Function AddNewCompo(CurrCompoType As CompoType, Optional IsFrame As Boolean = False, Optional IndecRefCompo As Integer = -1) As Compo Dim FileNameComplete As String = String.Empty ' converto tutti gli sfondi in bianco dei nomi delle componenti (solo se sono su un'anta) 'For Each Compo In Map.refPartPageVM.CurrPart.CompoList @@ -1277,7 +1278,11 @@ Public Class Part End If Lastindex += 1 End While - CompoList.Insert(CompoIndex + Lastindex, NewCompo) + If IndecRefCompo > -1 Then + CompoList.Insert(IndecRefCompo, NewCompo) + Else + CompoList.Insert(CompoIndex + Lastindex, NewCompo) + End If bInsert = True If Not IsNothing(PrecCompo) AndAlso Not (IsFrame And NewCompo.CompoType.DDFName = "rabbet") Then Map.refAssemblyPageVM.CurrAssembly.CopyParam(PrecCompo, NewCompo) @@ -1290,7 +1295,11 @@ Public Class Part If Not bInsert Then ' se la componenteaggiunta è un a Hinge allora il nome del template da visualizzare è di una Mortise AdviceHinge(NewCompo) - CompoList.Add(NewCompo) + If IndecRefCompo > -1 Then + CompoList.Insert(IndecRefCompo, NewCompo) + Else + CompoList.Add(NewCompo) + End If NewCompo.LoadDefaultFromLua = True FileNameComplete = CurrCompoType.Path & "\" & NewCompo.TemplateSelItem & LUA_EXTENSION If Not File.Exists(FileNameComplete) Then @@ -1677,10 +1686,10 @@ Public Class Part ' se la porta esiste allora mostro i suoi parametri Map.refPartPageVM.CurrPart = ReadDoor - ' se non passo dalla funzione che raccoglie queste informazioni + ' se non passo dalla funzione che raccoglie queste informazioni (utilizzato nella versione precedente all'inserimento della ComboBox) If Not bProperties AndAlso ReadDoor.PropertiesIsVisible = Visibility.Visible Then For Each Item In ReadDoor.PropertiesList - Item.IsChecked = False + 'Item.IsChecked = False Next End If @@ -2995,8 +3004,8 @@ Public Class Part 'SelItem = List(0) End If ' assegno al parametro della compnente il valore "filtrato" - ' DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetSelItem(SelItem) - DirectCast(CurrCompoParam, ComboBoxOnOffParam).SelItem = SelItem + DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetSelItem(SelItem) + 'DirectCast(CurrCompoParam, ComboBoxOnOffParam).SelItem = SelItem ' se il nome esiste ma è sbagliato ElseIf Not String.IsNullOrWhiteSpace(GetKey(sLine)) Then ' significa che la TextBoxOnOff è stata disattivata diff --git a/DoorParameters/PartPageV.xaml b/DoorParameters/PartPageV.xaml index 29ede22..9602ab1 100644 --- a/DoorParameters/PartPageV.xaml +++ b/DoorParameters/PartPageV.xaml @@ -571,7 +571,14 @@ - + + @@ -766,7 +773,7 @@ - + diff --git a/HardwareManager/Hardware.vb b/HardwareManager/Hardware.vb index 51cc5d5..c5ffc04 100644 --- a/HardwareManager/Hardware.vb +++ b/HardwareManager/Hardware.vb @@ -679,6 +679,16 @@ Public Class Hardware Chapter.SetIsActiveChapter(False) Chapter.GroupVisibilityChapter = Visibility.Collapsed End Select + ' leggo se il capitolo appartiene al tipo di materiale + Dim sMaterialList As New List(Of String) + StdTemplateGetPrivateProfileList(S_CHAPTER & ChapterIndex, K_MATERIAL, sMaterialList) + For Each ItemMaterial In sMaterialList + Chapter.GroupVisibilityChapter = Visibility.Collapsed + If ItemMaterial = Map.refHardwarePageVM.GenericPart.SelectedMaterial.NameDDF Then + Chapter.GroupVisibilityChapter = Visibility.Visible + Exit For + End If + Next While EgtUILib.GetPrivateProfileString(S_CHAPTER & ChapterIndex, K_PARAM & ParamIndex, "", sParam, m_StdTemplate) > 0 ' Verifico che esista il parametro nuovo "Param-ParamIndex" If Not String.IsNullOrWhiteSpace(sParam) Then diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb index d53c04d..69b68b1 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -149,6 +149,7 @@ Friend Module OptionModule Friend ColorMissingParameter As String = "Yellow" Friend ColorLoadByDefault As String = "Red" Friend ColorErrorAndMissing As String = "Red" + Friend ColorModifyingParamRef As String = "Yellow" Friend m_CompoPaneOrder As List(Of String) = New List(Of String) @@ -338,17 +339,17 @@ Friend Module OptionModule m_MaterialIsVisible = Visibility.Collapsed End If Dim PropertyList As New ObservableCollection(Of String) - ' se non trovo l'elenco dei materiali allora eseguo le vecchie istruzioni - If Not DefaultGetPrivateProfileMaterialProperties(ConstIni.S_PROPERTIES_INI, "Property", m_MaterialList) then - DefaultGetPrivateProfileObservableCollection(ConstIni.S_PROPERTIES_INI, ConstIni.K_PROPRTIESLIST_INI, PropertyList) + ' se non trovo l'elenco dei materiali allora eseguo le vecchie istruzioni + If Not DefaultGetPrivateProfileMaterialProperties(ConstIni.S_PROPERTIES_INI, "Property", m_MaterialList) Then + DefaultGetPrivateProfileObservableCollection(ConstIni.S_PROPERTIES_INI, ConstIni.K_PROPRTIESLIST_INI, PropertyList) m_MaterialIsVisible = Visibility.Collapsed ' carico la vecchia lista di proprietà LoadPropertiesList(PropertyList, m_PropertList) ' genero una lista fittizia di materiali MaterialList.Add(GENERICMATERIAL) - LoadMaterialList (MaterialList) + LoadMaterialList(MaterialList) m_MaterialList(0).PropertiesList = m_PropertList - If PropertyList.Count < 1 then + If PropertyList.Count < 1 Then OptionModule.m_DisableProperties = Visibility.Collapsed End If PropertyList.Clear() @@ -479,7 +480,7 @@ Friend Module OptionModule 'carico i colori da associare agli errori Dim sColor As String = String.Empty Dim ColorConvert As SolidColorBrush - DefaultGetPrivateProfileString("Error", "Value", "Red", sColor) + DefaultGetPrivateProfileString("Error", "ErrorValue", "Red", sColor) If Not String.IsNullOrEmpty(sColor) Then Try ColorConvert = DirectCast(New BrushConverter().ConvertFrom(sColor), SolidColorBrush) @@ -503,7 +504,7 @@ Friend Module OptionModule Catch ex As Exception End Try End If - DefaultGetPrivateProfileString("Error", "ValueAndMissing", "Red", sColor) + DefaultGetPrivateProfileString("Error", "ErrorValueAndMissing", "Red", sColor) If Not String.IsNullOrEmpty(sColor) Then Try ColorConvert = DirectCast(New BrushConverter().ConvertFrom(sColor), SolidColorBrush) @@ -511,6 +512,14 @@ Friend Module OptionModule Catch ex As Exception End Try End If + DefaultGetPrivateProfileString("Error", "ModifyingParamRef", "Yellow", sColor) + If Not String.IsNullOrEmpty(sColor) Then + Try + ColorConvert = DirectCast(New BrushConverter().ConvertFrom(sColor), SolidColorBrush) + ColorModifyingParamRef = sColor + Catch ex As Exception + End Try + End If '----------------------------------------------------------------------------------------------------------------- ' SIZE JAMB Dim ThicknessHead As String = String.Empty @@ -762,7 +771,7 @@ Friend Module OptionModule Friend Sub CreateNewPropertiesList(ByRef LocalPart As Part) If OptionModule.m_DisableProperties <> Visibility.Visible Then Return - If OptionModule.m_MaterialList.Count > 1 Then + If OptionModule.m_MaterialList.Count > 0 Then LocalPart.SetMaterial(OptionModule.m_MaterialList(0)) LocalPart.SetPropertiesList(OptionModule.m_MaterialList(0).PropertiesList) Return @@ -776,7 +785,7 @@ Friend Module OptionModule Friend Sub CreateNewPropertiesListJamb(ByRef LocalPart As Part) If OptionModule.m_DisableProperties <> Visibility.Visible Then Return - If OptionModule.m_MaterialList.Count > 1 Then + If OptionModule.m_MaterialList.Count > 0 Then LocalPart.SetMaterial(OptionModule.m_MaterialList(0)) LocalPart.SetPropertiesList(OptionModule.m_MaterialList(0).PropertiesList) Return diff --git a/ProjectManager/ProjectManagerVM.vb b/ProjectManager/ProjectManagerVM.vb index 87ee47c..a1b8df9 100644 --- a/ProjectManager/ProjectManagerVM.vb +++ b/ProjectManager/ProjectManagerVM.vb @@ -1491,6 +1491,16 @@ Public Class ProjectManagerVM Not IsNothing(Map.refPartPageVM.CurrPart.refPartDoor) AndAlso Not IsNothing(Map.refPartPageVM.CurrPart.refPartDoor.Door) AndAlso Map.refPartPageVM.CurrPart.refPartDoor.Door.TypePart.Contains("DO_") Then + ' se sono sono nella schermata principale oppure su un'anta + 'If (Not IsNothing(Map.refPartPageVM) AndAlso Not IsNothing(Map.refPartPageVM.CurrPart) AndAlso + ' Not IsNothing(Map.refPartPageVM.CurrPart.refPartDoor) AndAlso + ' Not IsNothing(Map.refPartPageVM.CurrPart.refPartDoor.Door) AndAlso + ' Map.refPartPageVM.CurrPart.refPartDoor.Door.TypePart.Contains("DO_")) OrElse + ' Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage Then + ' m_VisibilityCreateAssembly = Visibility.Visible + 'Else + ' m_VisibilityCreateAssembly = Visibility.Collapsed + 'End If m_VisibilityCreateAssembly = Visibility.Visible Else m_VisibilityCreateAssembly = Visibility.Collapsed @@ -1509,7 +1519,9 @@ Public Class ProjectManagerVM End Property Public Sub CreateAssembly() - Map.refAssemblyPageVM.CurrAssembly.CreateAssembly() + If Not IsNothing(Map.refAssemblyPageVM) AndAlso Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) Then + Map.refAssemblyPageVM.CurrAssembly.CreateAssembly() + End If End Sub #End Region ' CreateAssemblyCommand