diff --git a/Assembly/Assembly.vb b/Assembly/Assembly.vb index 1752b40..5b4f0e5 100644 --- a/Assembly/Assembly.vb +++ b/Assembly/Assembly.vb @@ -1451,6 +1451,7 @@ Public Class Assembly End If End Sub + #End Region ' Associazione delle compo lette da ddf #End Region ' Lettura Assemblato @@ -1565,8 +1566,7 @@ Public Class Assembly 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) AndAlso - String.IsNullOrEmpty(FrameFile) Then + Not CalcCompoMatching(CurrCompo.CompoType.Path, nDoorNbr, CurrCompo.TemplateSelItem, FrameFile) Then ' elimino la componente di riferimento If Not IsNothing(CurrCompo.refJambCompo) Then Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo, True) diff --git a/Assembly/AssemblyPageVM.vb b/Assembly/AssemblyPageVM.vb index a0661cd..6f5442d 100644 --- a/Assembly/AssemblyPageVM.vb +++ b/Assembly/AssemblyPageVM.vb @@ -211,7 +211,7 @@ Public Class AssemblyPageVM ' In questa fase manca la gestione degli swing dei Jamb Select Case SelectPart Case ConstGen.PART_FRAME_LEFT - LoadSelectedPartDoor(ConstGen.PART_FRAME_LEFT, Visibility.Hidden, True) + LoadSelectedPartDoor(ConstGen.PART_FRAME_LEFT, Visibility.Collapsed, True) Case ConstGen.PART_FRAME_RIGHT LoadSelectedPartDoor(ConstGen.PART_FRAME_RIGHT, Visibility.Hidden, True) Case ConstGen.PART_FRAME_TOP diff --git a/AssemblyManager/AssemblyManagerVM.vb b/AssemblyManager/AssemblyManagerVM.vb index aac7c2c..b033629 100644 --- a/AssemblyManager/AssemblyManagerVM.vb +++ b/AssemblyManager/AssemblyManagerVM.vb @@ -96,23 +96,355 @@ Public Class AssemblyManagerVM ' questa condizione non DOVREBBE mai accadere, perchè viene interrotto prima il caricamento If SavedAssName.SelAssembly.ListPartDoorOfDoor.Count < 1 Then If MessageBox.Show("The current ddf is a part of a frame, do you want to save?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) = MessageBoxResult.Yes Then + DdfFile.SaveErrorCompo = True DdfFile.WriteDDFPart(SavedAssName.SelAssembly.ListPartDoor(0).Door, SavedAssName.Name, True, False) + DdfFile.SaveErrorCompo = False Else Return False End If Else + DdfFile.SaveErrorCompo = True DdfFile.WriteDDFPart(SavedAssName.SelAssembly.ListPartDoorOfDoor(0).Door, SavedAssName.Name, True, False) + DdfFile.SaveErrorCompo = False End If Else + DdfFile.SaveErrorCompo = True DdfFile.WriteDDFAssembly(SavedAssName.SelAssembly, SavedAssName.Name, 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 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) SavedAssName.NotifyPropertyChanged("IsModify") + Else + Return False + End If + Return True + 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 + If IsNothing(Map.refAssemblyManagerVM) OrElse + IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse + IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) OrElse + IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly) Then + Return False + End If + ' creo una copia dell'assemblato + Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly + + If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then + Dim CurrPart As Part = CurrAssembly.ListPartDoor(0).Door + Select Case Map.refMainWindowVM.selectedWatcher + + Case MainWindowVM.WatcherCalling.OnCreated + ' in fase di creazione devo scorrere tutte le componenti che sono CompoDDFName e che hanno il LoadDefault = True + If IsNothing(ErCompo) Then + Dim IndexCompo As Integer = 0 + For IndexCompo = 0 To CurrAssembly.ListPartDoor(0).Door.m_CompoList.Count - 1 + ' se non ricevo il nome del direttorio allora scorro su tutte le componeti che hanno il LoadDefault = True + If Not String.IsNullOrEmpty(Map.refMainWindowVM.CompoDDFName) Then + If Map.refMainWindowVM.CompoDDFName = CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo).CompoType.DDFName AndAlso + CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo).LoadByDefault Then + Dim ErrCompo As Compo = CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo) + ReCreateCompo(ErrCompo, CurrPart) + 'RecreateCompoParm(ErrCompo, CurrPart) + End If + Else + If CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo).LoadByDefault Then + Dim ErrCompo As Compo = CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo) + ReCreateCompo(ErrCompo, CurrPart) + 'RecreateCompoParm(ErrCompo, CurrPart) + End If + End If + Next + Else + ' se ricevo una componente specifica + If ErCompo.LoadByDefault Then ReCreateCompo(ErCompo, CurrPart) + 'RecreateCompoParm(ErCompo, CurrPart) + End If + + Case MainWindowVM.WatcherCalling.OnDeleted + ' in fase di eliminazione devo scorrere tutte le componenti che sono CompoDDFName e che hanno il LoadDefault = false + If IsNothing(ErCompo) Then + Dim IndexCompo As Integer = 0 + For IndexCompo = 0 To CurrAssembly.ListPartDoor(0).Door.m_CompoList.Count - 1 + ' se non ricevo il nome del direttorio allora scorro su tutte le componeti che hanno il LoadDefault = False + If Not String.IsNullOrEmpty(Map.refMainWindowVM.CompoDDFName) Then + If Map.refMainWindowVM.CompoDDFName = CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo).CompoType.DDFName AndAlso + Not CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo).LoadByDefault Then + Dim ErrCompo As Compo = CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo) + ReCreateCompo(ErrCompo, CurrPart) + 'RecreateCompoParm(ErrCompo, CurrPart) + End If + Else + If Not CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo).LoadByDefault Then + Dim ErrCompo As Compo = CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo) + ReCreateCompo(ErrCompo, CurrPart) + 'RecreateCompoParm(ErrCompo, CurrPart) + End If + End If + Next + Else + ' se ricevo una componente specifica + If Not ErCompo.LoadByDefault Then ReCreateCompo(ErCompo, CurrPart) + 'RecreateCompoParm(ErCompo, CurrPart) + End If + + Case MainWindowVM.WatcherCalling.OnRenamed + ' in fase di eliminazione devo scorrere tutte le componenti che sono CompoDDFName + If IsNothing(ErCompo) Then + Dim IndexCompo As Integer = 0 + For IndexCompo = 0 To CurrAssembly.ListPartDoor(0).Door.m_CompoList.Count - 1 + ' se non ricevo il nome del direttorio allora scorro su tutte le componeti che hanno il LoadDefault = False + If Not String.IsNullOrEmpty(Map.refMainWindowVM.CompoDDFName) Then + If Map.refMainWindowVM.CompoDDFName = CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo).CompoType.DDFName Then + Dim ErrCompo As Compo = CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo) + ReCreateCompo(ErrCompo, CurrPart) + 'RecreateCompoParm(ErrCompo, CurrPart) + End If + Else + Dim ErrCompo As Compo = CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo) + ReCreateCompo(ErrCompo, CurrPart) + 'RecreateCompoParm(ErrCompo, CurrPart) + End If + Next + Else + ' se ricevo una componente specifica + ReCreateCompo(ErCompo, CurrPart) + 'RecreateCompoParm(ErCompo, CurrPart) + End If + + Case MainWindowVM.WatcherCalling.OnChanged + + Case MainWindowVM.WatcherCalling.OnLoadTempFile + LoadTempFile() + + Case Else + If Not IsNothing(ErCompo) Then + ' ReCreateCompo(ErCompo, CurrPart) + RecreateCompoParm(ErCompo, CurrPart) + Else + Dim IndexCompo As Integer = 0 + For IndexCompo = 0 To CurrAssembly.ListPartDoor(0).Door.m_CompoList.Count - 1 + Dim ErrCompo As Compo = CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo) + ReCreateCompo(ErrCompo, CurrPart) + Next + End If + ' se sto forzando un ricalcolo completo di tutto faccio passare tutte le componenti senza pietà? + + End Select + ' comunico che nessun evento particolare è stato selezionato + Map.refMainWindowVM.selectedWatcher = MainWindowVM.WatcherCalling.NoEvents + + Else + Dim IndexPart As Integer = 0 + For IndexPart = 0 To CurrAssembly.ListPartDoor.Count - 1 + Dim IndexCompo As Integer = 0 + For IndexCompo = 0 To CurrAssembly.ListPartDoor(IndexPart).Door.m_CompoList.Count - 1 + If CurrAssembly.ListPartDoor(IndexPart).Door.m_CompoList(IndexCompo).LoadByDefault Then + Dim ErrCompo As Compo = CurrAssembly.ListPartDoor(IndexPart).Door.m_CompoList(IndexCompo) + Dim CurrPart As Part = CurrAssembly.ListPartDoor(IndexPart).Door + ReCreateCompo(ErrCompo, CurrPart) + ElseIf CurrAssembly.ListPartDoor(0).Door.m_CompoList(IndexCompo).ErrorValue Then + + End If + Next + Next + End If + Return True + End Function + + ' ricerca il tipo di compoente chiamato + Private Function SearchCompotypeIndex(sDDFName As String) As Integer + Dim CompoListIndex As Integer = -1 + For CmpInd = 0 To Map.refCompoPanelVM.CompoTypeList.Count() - 1 + ' eseguo il confronto con il nome dei componenti che è stato caricato dal file Default.ini + If Map.refCompoPanelVM.CompoTypeList(CmpInd).DDFName = sDDFName Then + CompoListIndex = CmpInd + Exit For + End If + Next + Return CompoListIndex + End Function + + ' ricarica l'elenco dei file per la componnete selezionata + Private Function ReCreateCompo(ByRef ErrCompo As Compo, CurrPart As Part) As Boolean + ' Controllo esistenza del componente + Dim CompoListIndex As Integer = -1 + CompoListIndex = SearchCompotypeIndex(ErrCompo.CompoType.DDFName) + ' verifico che la componente non esiste + If CompoListIndex = -1 Then Return False + + Dim m_CurrCompo = New Compo(Map.refCompoPanelVM.CompoTypeList(CompoListIndex)) + ' Se previsto template o shape da configurazione + Dim CurrCompoTypePath As String = Map.refCompoPanelVM.CompoTypeList(CompoListIndex).Path + Dim nIsActive As Integer = EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME) + + ' leggo se template o shape + Dim Name As String = String.Empty + Dim DDFName As String = String.Empty + IniFile.GetPrivateProfileCompoName(S_TEMPLATE, K_NAME, DDFName, Name, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME) + + ' inizializzazione della componente + m_CurrCompo.TemplateDDFName = DDFName + m_CurrCompo.TemplateName = Name + If ErrCompo.SelBrandPart.Contains(".frame") Then + CurrPart.LoadBrandFileList(m_CurrCompo, True) + Else + CurrPart.LoadBrandFileList(m_CurrCompo) + End If + If IsNothing(m_CurrCompo) Then Return False + + ' verifico che i nomi che sono caricati esistano + Dim bBrandExists As Boolean = False + Dim bFileExists As Boolean = False + + Dim sBrand As String = ErrCompo.SelBrandPart + For IndexBrand As Integer = 0 To m_CurrCompo.BrandListPart.Count - 1 + If sBrand.ToLower = m_CurrCompo.BrandListPart(IndexBrand).ToLower Then + m_CurrCompo.SelBrandPart = m_CurrCompo.BrandListPart(IndexBrand) + bBrandExists = True + Exit For + End If + Next + If bBrandExists Then + For IndexFile As Integer = 0 To m_CurrCompo.FileList.Count - 1 + If ErrCompo.SelFile.ToLower = m_CurrCompo.FileList(IndexFile).ToLower Then + m_CurrCompo.SelFile = m_CurrCompo.FileList(IndexFile) + bFileExists = True + Exit For + End If + Next End If + ' in caso sia fallita la ricera dei direttori o dei file + If Not bBrandExists OrElse Not bFileExists Then + ErrCompo.LoadByDefault = True + Return False + End If + + ' termmino la creazione della nuova componente + m_CurrCompo.CompoParamList = ErrCompo.CompoParamList + ErrCompo.LoadByDefault = False + ErrCompo = m_CurrCompo + Return True + End Function + + ' 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) + If CompoListIndex = -1 Then Return False + + Dim IndexParam As Integer = 0 + For IndexParam = 0 To ErrCompo.CompoParamList.Count - 1 + If ErrCompo.CompoParamList(IndexParam).ErrorInReading Then + If TypeOf ErrCompo.CompoParamList(IndexParam) Is TextBoxParam Then + Dim Param As TextBoxParam = DirectCast(ErrCompo.CompoParamList(IndexParam), TextBoxParam) + Dim dVal As Double + If StringToDouble(Param.Value, dVal) Then + ErrCompo.CompoParamList(IndexParam).ErrorInReading = False + End If + ElseIf TypeOf ErrCompo.CompoParamList(IndexParam) Is ComboBoxParam Then + Dim Param As ComboBoxParam = DirectCast(ErrCompo.CompoParamList(IndexParam), ComboBoxParam) + Dim IndexItem As Integer = -1 + For IndexItem = 0 To Param.ItemListDDF.Count - 1 + If Param.SelItem = Param.ItemList(IndexItem) Then + If Param.ItemList.Count > Param.ItemListDDF.Count Then + Param.ItemList.RemoveAt(Param.ItemList.Count - 1) + End If + Param.ErrorInReading = False + Exit For + End If + Next + ElseIf TypeOf ErrCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam Then + Dim Param As TextBoxOnOffParam = DirectCast(ErrCompo.CompoParamList(IndexParam), TextBoxOnOffParam) + Dim dVal As Double + If StringToDouble(Param.Value, dVal) Then + ErrCompo.CompoParamList(IndexParam).ErrorInReading = False + End If + ElseIf TypeOf ErrCompo.CompoParamList(IndexParam) Is ComboBoxOnOffParam Then + Dim Param As ComboBoxOnOffParam = DirectCast(ErrCompo.CompoParamList(IndexParam), ComboBoxOnOffParam) + For Each Item In Param.ItemListDDF + If Param.SelItem = Item Then + If Param.ItemList.Count > Param.ItemListDDF.Count Then + Param.ItemList.RemoveAt(Param.ItemList.Count - 1) + End If + Param.ErrorInReading = False + Exit For + End If + Next + End If + End If + Next + + ErrCompo.ErrorValue = False + For Each Param In ErrCompo.CompoParamList + If Param.ErrorInReading Then + ErrCompo.ErrorValue = True + Exit For + End If + Next + Return True + End Function + + ' rielegge il file temporaneo e qundi permette di stampare gli errori attuali + Public Function LoadTempFile() As Boolean + Dim sTempFile As String = IniFile.m_sTempDir & "\" & TEMP_FILE + If Not File.Exists(sTempFile) Then Return False + ' verifico che un progetto esiste + If IsNothing(Map.refAssemblyManagerVM) OrElse + IsNothing(Map.refAssemblyManagerVM.CurrProject) OrElse + IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) OrElse + IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly) Then + Return False + End If + Dim TempAssembly As New Assembly + Assembly.ReadDDFAssembly(sTempFile, TempAssembly) + Try + File.Delete(sTempFile) + Catch + End Try + ' If IsNothing(TempAssembly) Then Return False + Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly = TempAssembly + If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then + DdfFile.WriteDDFPart(TempAssembly.ListPartDoor(0).Door, sTempFile, False, False) + ' aggiorno elenco quotature + Map.refDimensioningPanelVM.LoadHardwareDimList() + ExecDoors(Map.refSceneManagerVM.ProjectScene, sTempFile, False) + Map.refSceneManagerVM.ShowGraphicError() + Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage + ' rendo visibili quotature + For Each HardwareDimension In Map.refDimensioningPanelVM.HardwareDimensionList + PrintWndVM.TurnDimensioningLayer(HardwareDimension.NameLayer, HardwareDimension.SelectedLayer) + Next + EgtZoom(ZM.ALL) + Else + ' ! questa parte non funziona ! + Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage + DdfFile.WriteDDFAssembly(TempAssembly, sTempFile, False) + ' aggiorno elenco quotature + Map.refDimensioningPanelVM.LoadHardwareDimList() + ExecDoors(Map.refSceneManagerVM.ProjectScene, sTempFile, False) + Map.refSceneManagerVM.ShowGraphicError() + Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage + ' rendo visibili quotature + For Each HardwareDimension In Map.refDimensioningPanelVM.HardwareDimensionList + PrintWndVM.TurnDimensioningLayer(HardwareDimension.NameLayer, HardwareDimension.SelectedLayer) + Next + EgtZoom(ZM.ALL) + End If Return True End Function @@ -194,7 +526,7 @@ Public Class AssemblyManagerVM m_CurrProject.SelAssemblyName = m_CurrProject.AssemblyList(SelIndex) Open(m_CurrProject.SelAssemblyName) End If - ' se non ci sono altre porte nella lista allora + ' se non ci sono altre porte nella lista allora Else ' elimino qualsiasi resto di porta m_CurrProject.SelAssemblyName = Nothing @@ -214,8 +546,11 @@ Public Class AssemblyManagerVM Dim sText As String = String.Format(EgtMsg(50109), Path.GetFileNameWithoutExtension(m_CurrProject.SelAssemblyName.Name)) Select Case MessageBox.Show(sText, "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) Case MessageBoxResult.Yes - Save(m_CurrProject.SelAssemblyName) - m_CurrProject.SelAssemblyName.IsModified = False + If Save(m_CurrProject.SelAssemblyName) Then + m_CurrProject.SelAssemblyName.IsModified = False + Else + Return False + End If Case MessageBoxResult.No If Not File.Exists(m_CurrProject.SelAssemblyName.Name) Then Delete(m_CurrProject.SelAssemblyName) @@ -249,7 +584,7 @@ Public Class AssemblyManagerVM ' carico come progetto corrente l'assemblato che sto creando in locale (così da poter gestire i Jamb), l'array delle porte è ancora vuoto! m_CurrProject.SelAssemblyName.SelAssembly = Local_SelAssembly ' costruisco le associazioni tra i pezzi - CreateAssociation(Local_SelAssembly) + CreateAssociation(Local_SelAssembly) ' carico le dimensioni dell'assemblato Local_SelAssembly.SetNewDimensionAssembly() Return Local_SelAssembly @@ -312,7 +647,7 @@ Public Class AssemblyManagerVM Else LeftJamb.IsChecked = False LeftJamb.Door.IsActive = False - End If + End If CreateNewPropertiesListJamb(LeftJamb.Door.PropertiesList) ' aggiungo alla lista dei PartDoor CurrAssembly.ListPartDoor.Add(LeftJamb) @@ -391,12 +726,12 @@ Public Class AssemblyManagerVM LocalJamb = Nothing End If - ' i parametri che non sono ancora stati caricati sono: - ' Swing -> dalla porta - ' Size -> dalla porta - ' OverMaterial -> LoadOM_M_ET - ' Machining -> LoadOM_M_ET - ' EdgeType -> LoadOM_M_ET + ' i parametri che non sono ancora stati caricati sono: + ' Swing -> dalla porta + ' Size -> dalla porta + ' OverMaterial -> LoadOM_M_ET + ' Machining -> LoadOM_M_ET + ' EdgeType -> LoadOM_M_ET End Sub diff --git a/CompoPanel/CompoPanelVM.vb b/CompoPanel/CompoPanelVM.vb index 1f7f6ec..636f217 100644 --- a/CompoPanel/CompoPanelVM.vb +++ b/CompoPanel/CompoPanelVM.vb @@ -112,7 +112,7 @@ Public Class CompoPanelVM If Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nCancel Then Return ' controllo se devo salvare le modifiche ' elimino CurrHardware Map.refHardwarePageVM.CurrHardware.DeleteTempFile() - End If + End If ' seleziono il nuovo Hardware Dim m_CurrCompoType As CompoType = DirectCast(param, CompoType) For IndexCompoType As Integer = 0 To Map.refCompoPanelHardwareVM.CompoTypeList.Count - 1 @@ -128,21 +128,14 @@ Public Class CompoPanelVM Map.refHardwareHelpSceneHostV.LoadHelpProject() End If '------------------------------------------------------------------------------------------------------------------------------ - Else ' se non sono nella configurazione Hardware Dim m_CurrCompoType As CompoType = DirectCast(param, CompoType) m_CurrCompoType.LoadListTemplate() If Not IsNothing(Map.refPartPageVM.CurrPart) Then Dim NewCompo As Compo = Map.refPartPageVM.CurrPart.AddNewCompo(m_CurrCompoType) - ' aggiorno lista hardware di quotatura Map.refDimensioningPanelVM.LoadHardwareDimList() - '' appena aggiungo una componente nuova calcolo le sue componenti correttamente modificate - 'If Not IsNothing(NewCompo.refJambCompo) Then - ' If Not LoadCompoParam(NewCompo, Map.refPartPageVM.CurrPart.TypePart) Then Return - ' Map.refAssemblyPageVM.CurrAssembly.UpDateCurrCompoJamb(NewCompo) - ' ResetCompoParam() - 'End If + ' aggiungo le componenti sui Jamb Map.refAssemblyPageVM.CurrAssembly.CreateCompoOnJamb(NewCompo) Map.refSceneManagerVM.RefreshBtn() Else diff --git a/CompoPanel/CompoType.vb b/CompoPanel/CompoType.vb index 1656389..2e5b519 100644 --- a/CompoPanel/CompoType.vb +++ b/CompoPanel/CompoType.vb @@ -103,10 +103,17 @@ Public Class CompoType FolderList.Clear() m_HardwareFolderList.Clear() m_FrameFolderList.Clear() + m_FolderList.Clear() GetDirectoryCompoModel(m_Path, m_FolderList, m_FrameFolderList, m_HardwareFolderList) Return True End Function + Public Function DeepCopy() As CompoType + Dim other As CompoType = DirectCast(Me.MemberwiseClone, CompoType) + other.LoadListTemplate() + Return other + End Function + Sub New(sName As String, sDDFName As String, sPath As String, sJambSide As String, sFolderName As String) m_Name = sName m_DDFName = sDDFName diff --git a/DdfFile.vb b/DdfFile.vb index b0ccc61..f924c43 100644 --- a/DdfFile.vb +++ b/DdfFile.vb @@ -9,6 +9,12 @@ Friend Module DdfFile Friend CompoListOrder As New List(Of String) ' se riesco a scrivere un DDF (o una parte dell'essamblato) diventa true Friend DDFIsCorrect As Boolean = False + ' se no sono in grado di creare la porta devo fermare tutto + Friend DoorExists As Boolean = False + ' scommenta le righe del file che contengono dei file mancanti + Friend SaveErrorCompo As Boolean = False + ' raccoglie gli errori in fase di scrittura del ddf + Friend ErrorInWriting As String = String.Empty Private ParamInCompoIsCorrect As Boolean = True #Region "SCRITTURA DDF" @@ -17,7 +23,9 @@ Friend Module DdfFile Private IdIndex As Integer = 0 Friend Sub WriteDDFPart(Part As Part, sPath As String, bIsDDF As Boolean, bIsForAssembly As Boolean) + ErrorInWriting = String.Empty DDFIsCorrect = False + DoorExists = False ' pulisco lista prima di iniziare a scrivere Dim DdfFileContent As New List(Of String) ' quindi significa che non è mai stato caricato il valore @@ -298,6 +306,7 @@ Friend Module DdfFile DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & Part.BottomOverMaterial) End If End If + DoorExists = True ' Riordino e stampo le compo SearchCompo(DdfFileContent, Part, bIsDDF) If Not Directory.Exists(Path.GetDirectoryName(sPath)) Then @@ -318,6 +327,10 @@ Friend Module DdfFile ' la funzione è quasi identica alla precedente per piccole differenze (evito di richiamare dei riferimenti all'assemblato) Friend Sub WriteDDFPartForTestHardware(Part As Part, sPath As String, bIsDDF As Boolean, bIsForAssembly As Boolean) + Dim CurrHardwareReference As String = String.Empty + If Not IsNothing(Map.refHardwarePageVM) AndAlso Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then + CurrHardwareReference = Map.refHardwarePageVM.CurrHardware.SelBrand.ModelDir & "\" & Map.refHardwarePageVM.CurrHardware.SelTemplate & LUA_EXTENSION + End If DDFIsCorrect = False ' pulisco lista prima di iniziare a scrivere Dim DdfFileContent As New List(Of String) @@ -326,6 +339,9 @@ Friend Module DdfFile If Not IsNothing(Part.TypePart) Then DdfFileContent.Add("#" & PrintTitleDDFPart(Part.TypePart)) End If + If Not String.IsNullOrEmpty(CurrHardwareReference) Then + DdfFileContent.Add("#" & CurrHardwareReference) + End If DdfFileContent.Add("") DdfFileContent.Add("produce: " & If(Part.IsActive, "true", "false")) 'Genero una lista di stringhe @@ -713,6 +729,8 @@ Friend Module DdfFile End Select End Function +#Region "Funzioni per la scrittura delle componenti" + ' stampa le compo seguedo l'ordine della lista delle componenti del ddf Public Sub SearchCompo(DdfFileContent As List(Of String), ByRef Door As Part, bIsDDF As Boolean) ParamInCompoIsCorrect = True @@ -721,25 +739,6 @@ Friend Module DdfFile Dim TempList As New ObservableCollection(Of Compo) DdfFileContent.Add("") '------------------------------------------------------------------------------------------------------------------------------------------ - '' ' cerco la prima componente da aggiungere alla lista delle componenti - ''For Index1 = 0 To DdfFile.CompoListOrder.Count() - 1 - '' For Index2 = 0 To Door.CompoList.Count() - 1 - '' ' se trovo la componenete da aggiungere - '' If DdfFile.CompoListOrder(Index1) = Door.CompoList(Index2).CompoType.DDFName Then - '' ' se il nome della componente da aggiungere già esiste - '' If Index2 >= 1 AndAlso String.Equals(Door.CompoList(Index2).CompoType.DDFName, Door.CompoList(Index2 - 1).CompoType.DDFName) Then - '' NewCompoNameDDF = True - '' Else - '' ' aggiungo una riga vuota per separare il nome della nuova componente - '' DdfFileContent.Add("") - '' End If - '' ' Carico nella lista dei componenti la lista di stringhe da stampare - '' DdfFileContent.AddRange(GenerateCompolistDDF(Door.CompoList(Index2), WritingError, NewCompoNameDDF, bIsDDF)) - '' End If - '' NewCompoNameDDF = False - '' Next - ''Next - '------------------------------------------------------------------------------------------------------------------------------------------ ' cerco la prima componente da aggiungere alla lista delle componenti For Index1 = 0 To DdfFile.CompoListOrder.Count() - 1 For Index2 = 0 To Door.CompoList.Count() - 1 @@ -782,7 +781,6 @@ Friend Module DdfFile End Function Private Function AscendingOrder(List As ObservableCollection(Of Compo), DdfFileContent As List(Of String), bIsDDF As Boolean) As Boolean - Dim NewCompoNameDDF = False Dim tidyParamIndex1 As Integer = -1 Dim tidyParamIndex2 As Integer = -1 Dim WritingError As String = String.Empty @@ -790,7 +788,8 @@ Friend Module DdfFile For IndexList1 As Integer = 0 To List.Count - 2 For IndexList2 As Integer = IndexList1 + 1 To List.Count - 1 ' se hanno lo stesso parametrro di posizionamento allora riordino - If Not String.IsNullOrEmpty(List(IndexList1).TidyParam) And Not String.IsNullOrEmpty(List(IndexList2).TidyParam) Then + If Not String.IsNullOrEmpty(List(IndexList1).TidyParam) And Not String.IsNullOrEmpty(List(IndexList2).TidyParam) And + Not List(IndexList1).LoadByDefault And Not List(IndexList2).LoadByDefault Then For IndexParam As Integer = 0 To List(0).CompoParamList.Count - 1 If List(IndexList1).CompoParamList(IndexParam).DDFName = List(IndexList1).TidyParam Then tidyParamIndex1 = IndexParam Exit For @@ -818,11 +817,15 @@ Friend Module DdfFile Next End If ' stampa lista - DdfFileContent.AddRange(GenerateCompolistDDF(List(0), WritingError, False, bIsDDF)) + DdfFileContent.AddRange(GenerateCompolistDDF(List(0), WritingError, True, bIsDDF)) For IndexItem As Integer = 1 To List.Count - 1 - DdfFileContent.AddRange(GenerateCompolistDDF(List(IndexItem), WritingError, True, bIsDDF)) + DdfFileContent.AddRange(GenerateCompolistDDF(List(IndexItem), WritingError, False, bIsDDF)) Next DdfFileContent.Add("") + ' scrivo il messaggio di errore + If Not String.IsNullOrEmpty(WritingError) Then + ErrorInWriting &= vbCrLf & WritingError & vbCrLf + End If Return True End Function @@ -830,14 +833,19 @@ Friend Module DdfFile Public Function GenerateCompolistDDF(Compo As Compo, ByRef sErrorList As String, bNewCompoNameDDF As Boolean, bIsDDF As Boolean) As List(Of String) Dim CompoListDDF As New List(Of String) ' se il nome non esiste ancora nella lista lo aggiungo - If Not bNewCompoNameDDF Then + If bNewCompoNameDDF Then ' aggiungo il nome DDF della componente CompoListDDF.Add(Compo.CompoType.DDFName & ":") End If ' se esiste il template If Not String.IsNullOrWhiteSpace(Compo.TemplateDDFName) Then ' aggiungo " - nomeTemplate: TemplateSelezionato" - CompoListDDF.Add(DDF_HYPHEN & Compo.TemplateDDFName & ": " & Compo.TemplateSelItem) + If Compo.LoadByDefault And Not SaveErrorCompo Then + CompoListDDF.Add(DDF_METADATA & DDF_HYPHEN & Compo.TemplateDDFName & ": " & Compo.TemplateSelItem) + Else + CompoListDDF.Add(DDF_HYPHEN & Compo.TemplateDDFName & ": " & Compo.TemplateSelItem) + End If + End If ' creo l'indice dei parametri della compo Dim ParamIndex As Integer @@ -858,11 +866,16 @@ Friend Module DdfFile 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)) - CompoListDDF.Add(DDF_SPACE5 & cbParam.DDFName & ": " & SelItemDDF) + 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 - sErrorList &= String.Format(EgtMsg(50114), cbParam.Name, CurrCompoParam.DDFName) + ' 50125: Error reading {0} param in {1} compo: do not exist value. + sErrorList &= String.Format(EgtMsg(50125), cbParam.Name, Compo.CompoType.DDFName) ParamInCompoIsCorrect = False End If End If @@ -878,28 +891,48 @@ Friend Module DdfFile 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)) - CompoListDDF.Add(DDF_SPACE5 & cbParam.DDFName & ": " & SelItemDDF) + 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 - sErrorList &= String.Format(EgtMsg(50114), cbParam.Name, CurrCompoParam.DDFName) + ' 50125: Error reading {0} param in {1} compo: do not exist value. + sErrorList &= String.Format(EgtMsg(50125), cbParam.Name, Compo.CompoType.DDFName) ParamInCompoIsCorrect = False 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 + ' 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 - sErrorList &= String.Format(EgtMsg(50141), tboParam.Name, CurrCompoParam.DDFName) - CompoListDDF.Add(DDF_SPACE5 & tboParam.DDFName & ": ") - ParamInCompoIsCorrect = False + ' 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 - CompoListDDF.Add(DDF_SPACE5 & tboParam.DDFName & ": " & tboParam.ToolTipValue) + 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 @@ -912,19 +945,34 @@ Friend Module DdfFile ' 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 - sErrorList &= String.Format(EgtMsg(50141), tbParam.Name, CurrCompoParam.DDFName) - CompoListDDF.Add(DDF_SPACE5 & tbParam.DDFName & ": ") - ParamInCompoIsCorrect = False + ' 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 & ": ") + ParamInCompoIsCorrect = False + Else + CompoListDDF.Add(DDF_SPACE5 & tbParam.DDFName & ": ") + ParamInCompoIsCorrect = False + End If Else If bIsDDF Then - CompoListDDF.Add(DDF_SPACE5 & tbParam.DDFName & ": " & tbParam.ToolTipValue) + 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 - CompoListDDF.Add(DDF_SPACE5 & tbParam.DDFName & ": " & tbParam.Value) + 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 Else If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine - sErrorList &= String.Format(EgtMsg(50141), tbParam.Name, CurrCompoParam.DDFName) + ' 50122: Error reading {0} param in {1} compo. + sErrorList &= String.Format(EgtMsg(50122), tbParam.Name, Compo.CompoType.DDFName) End If End If Next @@ -946,6 +994,8 @@ Friend Module DdfFile Return CompoListDDF End Function +#End Region ' Funzioni per la scrittura delle componenti + ' calcola il secure da salvare e il tipo di bevel Public Function SetSecure(sSwing As String, DispositionItem As String, DoorSecure As String) As String Dim sSecure As String @@ -1046,46 +1096,11 @@ Friend Module DdfFile End If WriteDDFPart(CurrAssembly.ListPartDoor(CurrAssembly.ListPartDoor.Count - 1).Door, sPath, bIsDDF, FirstPart) File.AppendAllLines(sPath, EndAssebly, Text.Encoding.UTF8) - - '' inizio stampando l'elenco delle porte - 'Select Case CurrAssembly.DoorNumber - ' Case "1" - ' WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsDDF, FirstPart) - ' FirstPart = True - ' File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - ' Case "2" - ' 'If Not CurrAssembly.GetArrayPartDoor(0).Door.Swing.Contains("I") Then - ' WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsDDF, FirstPart) - ' FirstPart = True - ' File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - ' WriteDDFPart(CurrAssembly.GetArrayPartDoor(1).Door, sPath, bIsDDF, FirstPart) - ' File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - ' 'Else - ' ' WriteDDFPart(CurrAssembly.GetArrayPartDoor(1).Door, sPath, bIsDDF, FirstPart) - ' ' FirstPart = True - ' ' File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - ' ' WriteDDFPart(CurrAssembly.GetArrayPartDoor(0).Door, sPath, bIsDDF, FirstPart) - ' ' File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - ' 'End If - 'End Select - 'WriteDDFPart(CurrAssembly.LeftJamb, sPath, bIsDDF, FirstPart) - 'File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - 'WriteDDFPart(CurrAssembly.RightJamb, sPath, bIsDDF, FirstPart) - 'File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - '' il sill è stampato solo se è nella selezione - 'If CurrAssembly.Exterior Then - ' WriteDDFPart(CurrAssembly.TopJamb, sPath, bIsDDF, FirstPart) - ' File.AppendAllLines(sPath, SplitPart, Text.Encoding.UTF8) - ' WriteDDFPart(CurrAssembly.BottomJamb, sPath, bIsDDF, FirstPart) - ' File.AppendAllLines(sPath, EndAssebly, Text.Encoding.UTF8) - 'Else - ' WriteDDFPart(CurrAssembly.TopJamb, sPath, bIsDDF, FirstPart) - ' File.AppendAllLines(sPath, EndAssebly, Text.Encoding.UTF8) - 'End If Return True End Function + ' scrive le informazioni generali dell'assemblato in forma di metadato ## Public Function WriteGeneralAssembly(ByRef GeneralAssembly As List(Of String), CurrAssembly As Assembly) As Boolean Dim dVal As Double = 0 GeneralAssembly.Add("#EGTDOORCREATOR") diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb index 3cb0769..b408eac 100644 --- a/DoorParameters/Compo.vb +++ b/DoorParameters/Compo.vb @@ -108,6 +108,8 @@ Public Class Compo End Set End Property +#Region "Gestione Errori DOORCreator" + Private m_LoadByDefault As Boolean = False Public Property LoadByDefault As Boolean Get @@ -116,16 +118,49 @@ Public Class Compo Set(value As Boolean) m_LoadByDefault = value SetImage() - NotifyPropertyChanged("ImageButton") + ' NotifyPropertyChanged("ImageButton") + NotifyPropertyChanged("ShowParamList") + NotifyPropertyChanged("IsError") End Set End Property + Private m_MissingParameter As Boolean = False + Public Property MissingParameter As Boolean + Get + Return m_MissingParameter + End Get + Set(value As Boolean) + m_MissingParameter = value + NotifyPropertyChanged("IsError") + End Set + End Property + + Private m_ErrorValue As Boolean = False + Public Property ErrorValue As Boolean + Get + Return m_ErrorValue + End Get + Set(value As Boolean) + m_ErrorValue = value + NotifyPropertyChanged("IsError") + End Set + End Property + + Public ReadOnly Property ShowParamList As Visibility + Get + If m_LoadByDefault Then Return Visibility.Collapsed + Return Visibility.Visible + End Get + End Property + Public Sub SetImage() If m_LoadByDefault Then - m_ImageButton = "/Resources/Refresh/Error.png" + 'm_ImageButton = "/Resources/Refresh/Error.png" + m_ImageButton = "/Resources/TopCommandBar/X.png" Else m_ImageButton = "/Resources/TopCommandBar/X.png" End If + NotifyPropertyChanged("IsError") End Sub Private m_ImageButton As String = "/Resources/TopCommandBar/X.png" @@ -135,6 +170,19 @@ Public Class Compo End Get End Property + 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 + Return True + Else + Return False + End If + End Get + End Property + +#End Region ' Gestione Errori + Private m_IsFixed As Boolean Friend ReadOnly Property IsFixed As Boolean Get @@ -223,8 +271,32 @@ Public Class Compo ' distinguo il caricamento della lista dei frame If m_BrandListPart(IndexModelList) = m_SelBrandPart Then If value.ToLower.Contains(".frame") Then + If IndexModelList > CompoType.FrameFolderList.Count - 1 Then + ' se il direttorio che cerco non esiste allora ne creo uno fasullo con una lista di file vuota + Dim FakeDir As New CompoBrandDir(CompoType.Path & "\" & m_SelBrandPart, "") + If Not IsNothing(FakeDir) Then + ' se la creazione è andata a buon fine seleziono il direttorio + CompoType.FolderList.Add(FakeDir) + FileList = CompoType.FolderList(CompoType.FolderList.Count - 1).ModelFileList + End If + SelFile = String.Empty + ' quindi esco (non carico nessun file) + Return + End If m_FileList = CompoType.FrameFolderList(IndexModelList).ModelFileList Else + If IndexModelList > CompoType.FolderList.Count - 1 Then + ' se il direttorio che cerco non esiste allora ne creo uno fasullo con una lista di file vuota + Dim FakeDir As New CompoBrandDir(CompoType.Path & "\" & m_SelBrandPart, "") + If Not IsNothing(FakeDir) Then + ' se la creazione è andata a buon fine seleziono il direttorio + CompoType.FolderList.Add(FakeDir) + FileList = CompoType.FolderList(CompoType.FolderList.Count - 1).ModelFileList + End If + SelFile = String.Empty + ' quindi esco (non carico nessun file) + Return + End If m_FileList = CompoType.FolderList(IndexModelList).ModelFileList End If Exit For @@ -232,6 +304,7 @@ Public Class Compo Next NotifyPropertyChanged("FileList") Dim SelItemindex As Integer = 0 + ' seleziono il primo file del direttorio While SelItemindex < m_FileList.Count - 1 AndAlso Path.HasExtension(m_FileList(SelItemindex)) SelItemindex += 1 End While @@ -281,7 +354,7 @@ Public Class Compo End Get Set(value As String) ' se il valore è nothing significa che non è stata fatta nessuna selezione, quindi esco - If IsNothing(value) Then Return + If IsNothing(value) OrElse String.IsNullOrEmpty(value) Then Return m_SelFile = value ' ricostruisco il nome del template da passare alle funzioni Dim ModelDir As String = String.Empty @@ -401,9 +474,11 @@ Public Class Compo If Not Path.GetExtension(CurrItemPath).ToLower = LUA_EXTENSION Then CurrItemPath &= LUA_EXTENSION End If - ' controllo che esista il file altrimenti esco - If Not File.Exists(CurrItemPath) Then Return + ' seleziono il nome, controllo che esista il file altrimenti esco m_TemplateSelItem = value + If Not File.Exists(CurrItemPath) Then + Return + End If ' carico un vettore con le stringhe del file corrente Dim ReadCurrCompo() As String = File.ReadAllLines(CurrItemPath) For LineIndex = 0 To ReadCurrCompo.Count - 1 @@ -423,7 +498,6 @@ Public Class Compo ReadParamConfig(ErrorList, ConfigDefault) ReadDefaultParamLua(CurrItemPath, Me) End If - If Not String.IsNullOrWhiteSpace(ErrorList) Then EgtOutLog(ErrorList) End Sub @@ -1472,7 +1546,13 @@ Public Class Compo ' Definizione comando Private m_CmdDelete As ICommand + ' creo una copia dell'oggetto Sub New(CompoType As CompoType) + m_CompoType = CompoType.DeepCopy() + End Sub + + ' creo un riferiemento all'oggetto + Sub New(CompoType As CompoType, Reference As Boolean) m_CompoType = CompoType End Sub @@ -1512,6 +1592,18 @@ Public Class Compo End Class Public Class CompoParam + Implements INotifyPropertyChanged + + Private m_ErrorInReading As Boolean = False + Public Property ErrorInReading As Boolean + Get + Return m_ErrorInReading + End Get + Set(value As Boolean) + m_ErrorInReading = value + NotifyPropertyChanged("ErrorInReading") + End Set + End Property Private m_LayerName As String Public Property LayerName As String @@ -1563,11 +1655,17 @@ Public Class CompoParam m_LayerName = sLayerName End If End Sub + + Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged + Public Sub NotifyPropertyChanged(propName As String) + RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) + End Sub + End Class Public Class GhostParam Inherits CompoParam - Implements INotifyPropertyChanged + ' Implements INotifyPropertyChanged Private m_Value As String Public Property Value As String @@ -1584,12 +1682,12 @@ Public Class GhostParam m_Value = sValue End Sub - Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged + 'Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged End Class Public Class TextBoxParam Inherits CompoParam - Implements INotifyPropertyChanged + ' Implements INotifyPropertyChanged ' utilizzato negli Hardware Private m_TypeVar As String @@ -1602,7 +1700,6 @@ Public Class TextBoxParam End Set End Property - Private m_IsReadOnly As Boolean = True Public Property IsReadOnly As Boolean Get @@ -1620,9 +1717,16 @@ Public Class TextBoxParam End Get Set(value As String) m_Value = value - NotifyPropertyChanged("ToolTipValue") + NotifyPropertyChanged("ToolTipValue") + If Not IsNumeric(ToolTipValue) Then + ErrorInReading = True + CurrCompo.ErrorValue = True + End If + If Not IsNothing(Map.refAssemblyManagerVM) Then Map.refAssemblyManagerVM.RefreshAssembly(CurrCompo) SetModified() - CurrCompo.LoadByDefault = False + ' ErrorInReading = False + CurrCompo.MissingParameter = False + ' CurrCompo.ErrorValue = False ' se la componente non ha un riferimento esce If IsNothing(CurrCompo.refJambCompo) Then Return ' se fallisce il caricamento dei parametri esce @@ -1711,16 +1815,16 @@ Public Class TextBoxParam m_TypeVar = TypeVar End Sub - Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged - Public Sub NotifyPropertyChanged(propName As String) - RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) - End Sub + 'Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged + 'Public Sub NotifyPropertyChanged(propName As String) + ' RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) + 'End Sub End Class Public Class ComboBoxParam Inherits CompoParam - Implements INotifyPropertyChanged + ' Implements INotifyPropertyChanged Private m_IsReadOnly As Boolean = True Public Property IsReadOnly As Boolean @@ -1762,7 +1866,12 @@ Public Class ComboBoxParam Set(value As String) m_SelItem = value SetModified() - CurrCompo.LoadByDefault = False + If ErrorInReading = True Then + If Not IsNothing(Map.refAssemblyManagerVM) Then Map.refAssemblyManagerVM.RefreshAssembly(CurrCompo) + End If + ' ErrorInReading = False + CurrCompo.MissingParameter = False + ' CurrCompo.ErrorValue = False Dim CmpPar As CompoParam = Me Dim IndexP As Integer = CurrCompo.CompoParamList.IndexOf(Me) ' se il nome della combobox è side allora ed esiset un riferimento @@ -1808,10 +1917,10 @@ Public Class ComboBoxParam m_SelItem = sSelItem End Sub - Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged - Public Sub NotifyPropertyChanged(propName As String) - RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) - End Sub + 'Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged + 'Public Sub NotifyPropertyChanged(propName As String) + ' RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) + 'End Sub End Class Public Class TextBoxOnOffParam @@ -1825,7 +1934,9 @@ Public Class TextBoxOnOffParam Set(value As Boolean) m_IsActive = value SetModified() - CurrCompo.LoadByDefault = False + ' ErrorInReading = False + CurrCompo.MissingParameter = False + ' CurrCompo.ErrorValue = False Map.refSceneManagerVM.RefreshBtn() End Set End Property @@ -1983,7 +2094,7 @@ End Class Public Class CheckBoxParam Inherits CompoParam - Implements INotifyPropertyChanged + ' Implements INotifyPropertyChanged Private m_IsChecked As Boolean = False Public Property IsChecked As Boolean @@ -2007,11 +2118,10 @@ Public Class CheckBoxParam m_IsChecked = IsChecked End Sub - Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged - - Public Sub NotifyPropertyChanged(propName As String) - RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) - End Sub + 'Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged + 'Public Sub NotifyPropertyChanged(propName As String) + ' RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) + 'End Sub End Class Public Class ComboBoxOnOffParam @@ -2024,6 +2134,9 @@ Public Class ComboBoxOnOffParam End Get Set(value As Boolean) m_IsActive = value + ' ErrorInReading = False + CurrCompo.MissingParameter = False + ' CurrCompo.ErrorValue = False SetModified() Map.refSceneManagerVM.RefreshBtn() End Set @@ -2116,7 +2229,7 @@ End Class Public Class ActivateParam Inherits CompoParam - Implements INotifyPropertyChanged + 'Implements INotifyPropertyChanged Private m_IsActivated As Boolean = False Public Property IsActivated As Boolean @@ -2140,9 +2253,8 @@ Public Class ActivateParam m_IsActivated = IsActivate End Sub - Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged - - Public Sub NotifyPropertyChanged(propName As String) - RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) - End Sub + 'Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged + 'Public Sub NotifyPropertyChanged(propName As String) + ' RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) + 'End Sub End Class \ No newline at end of file diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb index d52d525..15f7aed 100644 --- a/DoorParameters/Part.vb +++ b/DoorParameters/Part.vb @@ -788,7 +788,7 @@ Public Class Part ' creo la stringa che contiene la lista degli errori Dim ErrorList As String = String.Empty ' creo il nuovo compo - Dim NewCompo As New Compo(HardwareGeneral) + Dim NewCompo As New Compo(HardwareGeneral, True) ' Leggo il file ini del componente per vedere se c'è il template: se c'è If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME) <> 0 Then ' leggo nomi @@ -830,8 +830,6 @@ Public Class Part '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 - '' disabilito la costruzione del riferimento - 'Assembly.BuiltReffCompo = False Dim FileNameComplete As String = String.Empty ' converto tutti gli sfondi in bianco dei nomi delle componenti For Each Compo In Map.refPartPageVM.CurrPart.CompoList @@ -842,7 +840,7 @@ Public Class Part ' creo la stringa che contiene la lista degli errori Dim ErrorList As String = String.Empty ' creo il nuovo oggetto compo - Dim NewCompo As New Compo(CurrCompoType) + Dim NewCompo As New Compo(CurrCompoType, True) ' Leggo il file ini del componente per vedere se c'è il template: se c'è If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME) <> 0 Then ' leggo nomi della componente scritti nel file di configurazione @@ -873,6 +871,7 @@ Public Class Part NewCompo.TemplateSelItem = sTemplateName End If End If + ' se è stata generata la componente If Not IsNothing(NewCompo) Then ' raggruppo tutte le componenti che hanno lo stesso nome vicine @@ -886,12 +885,18 @@ Public Class Part Dim Lastindex As Integer = 0 Dim PrecCompo As Compo = Nothing While CompoIndex + Lastindex < m_CompoList.Count AndAlso NewCompo.CompoType.DDFName = m_CompoList(CompoIndex + Lastindex).CompoType.DDFName - PrecCompo = m_CompoList(CompoIndex + Lastindex) + If Not m_CompoList(CompoIndex + Lastindex).LoadByDefault Then + PrecCompo = m_CompoList(CompoIndex + Lastindex) + End If Lastindex += 1 End While CompoList.Insert(CompoIndex + Lastindex, NewCompo) - Map.refAssemblyPageVM.CurrAssembly.CopyParam(PrecCompo, NewCompo) bInsert = True + If Not IsNothing(PrecCompo) Then + Map.refAssemblyPageVM.CurrAssembly.CopyParam(PrecCompo, NewCompo) + Else + AdviceHinge(NewCompo) + End If Exit For End If Next @@ -910,22 +915,13 @@ Public Class Part NewCompo.BorderColor = New BrushConverter().ConvertFrom("#DCDCDC") NewCompo.BackGroundColor = New BrushConverter().ConvertFrom("#DCDCDC") NewCompo.BorderThickness = 1 - '----------------------------------------------------------------------------------------------------------------------------------------------- - 'If Not IsFrame Then - ' BuiltReferenceCompo(NewCompo) - 'End If - '----------------------------------------------------------------------------------------------------------------------------------------------- End If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True - - ' riabilito la costruzione del riferimnto - 'Assembly.BuiltReffCompo = True - Return NewCompo End Function ' carica la lista di Hardware da mostrare nella grafica ( distinguendo i l'elenco destinato ai Frame) - Private Function LoadBrandFileList(ByRef NewCompo As Compo, Optional IsFrame As Boolean = False) As Boolean + Public Function LoadBrandFileList(ByRef NewCompo As Compo, Optional IsFrame As Boolean = False) As Boolean Dim CurrCompoType As CompoType = NewCompo.CompoType Dim CurrFolderList As ObservableCollection(Of CompoBrandDir) ' carico l'elenco dei direttori @@ -934,7 +930,8 @@ Public Class Part Else CurrFolderList = CurrCompoType.FolderList End If - + NewCompo.BrandListPart = New ObservableCollection(Of String) + NewCompo.FileList = New ObservableCollection(Of String) If CurrFolderList.Count > 0 Then ' carico nella componente l'elenco dei nome da mostrare a video For IndexModel As Integer = 0 To CurrFolderList.Count - 1 @@ -942,9 +939,10 @@ Public Class Part Next ' partendo dal fondo della lista delle componenti cerco se esiste la stessa componente, in quel caso For CompoIndex = m_CompoList.Count - 1 To 0 Step -1 - If m_CompoList(CompoIndex).CompoType.Name = CurrCompoType.Name Then + If m_CompoList(CompoIndex).CompoType.Name = CurrCompoType.Name AndAlso Not m_CompoList(CompoIndex).LoadByDefault Then NewCompo.SetSelBrand(m_CompoList(CompoIndex).SelBrandPart) NewCompo.SetSelFile(m_CompoList(CompoIndex).SelFile) + ' esco Return True End If Next @@ -1197,7 +1195,9 @@ Public Class Part Exit While End If ' Lettura del componente + RegexFunction.IsCompo = True LineIndex = ReadDoor.GetCompo(ReadDoor.NextIndex(LineIndex), sSection, sErrorInfo) + RegexFunction.IsCompo = False If LineIndex = -1 Then ' assegno una porta vuota ed esco dal ciclo ReadDoor = Nothing @@ -1253,7 +1253,7 @@ Public Class Part ' 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 " & ReadDoor.TypePart + 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 @@ -1943,9 +1943,10 @@ Public Class Part ' esco dalla lettura del compo Exit While End If - ' Creo il componente + + ' Creo il componente con un riferiemento comune Dim m_CurrCompo = New Compo(Map.refCompoPanelVM.CompoTypeList(CompoListIndex)) - Dim CurrCompoType As CompoType = m_CurrCompo.CompoType + ' Se previsto template o shape da configurazione Dim CurrCompoTypePath As String = Map.refCompoPanelVM.CompoTypeList(CompoListIndex).Path Dim nIsActive As Integer = EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME) @@ -1956,6 +1957,7 @@ Public Class Part Dim DDFName As String = String.Empty IniFile.GetPrivateProfileCompoName(S_TEMPLATE, K_NAME, DDFName, Name, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME) '----------------------------------------------------------------------------------------------------------------------------------- + ' inizializzazione della componente m_CurrCompo.TemplateDDFName = DDFName m_CurrCompo.TemplateName = Name If sLine.ToLower.Contains(".frame") Then @@ -1986,16 +1988,19 @@ Public Class Part Dim bBrandExists As Boolean = False ' ricerca nella radice della componente If sItems.Count < 2 Then - bBrandExists = True + bBrandExists = False sFile = Trim(sItems(0)) - m_CurrCompo.SelBrandPart = m_CurrCompo.BrandListPart.Last - For IndexFile As Integer = 0 To m_CurrCompo.FileList.Count - 1 - If sFile.ToLower = m_CurrCompo.FileList(IndexFile).ToLower Then - m_CurrCompo.SelFile = m_CurrCompo.FileList(IndexFile) - bFileExists = True - Exit For - End If - Next + If m_CurrCompo.BrandListPart.Last = RAD_DIR Then + m_CurrCompo.SelBrandPart = m_CurrCompo.BrandListPart.Last + bBrandExists = True + For IndexFile As Integer = 0 To m_CurrCompo.FileList.Count - 1 + If sFile.ToLower = m_CurrCompo.FileList(IndexFile).ToLower Then + m_CurrCompo.SelFile = m_CurrCompo.FileList(IndexFile) + bFileExists = True + Exit For + End If + Next + End If End If ' ricerca nei dierttori della radice If sItems.Count >= 2 Then @@ -2011,21 +2016,34 @@ Public Class Part Exit For End If Next - For IndexFile As Integer = 0 To m_CurrCompo.FileList.Count - 1 - If sFile.ToLower = m_CurrCompo.FileList(IndexFile).ToLower Then - m_CurrCompo.SelFile = m_CurrCompo.FileList(IndexFile) - bFileExists = True - Exit For - End If - Next + If bBrandExists Then + For IndexFile As Integer = 0 To m_CurrCompo.FileList.Count - 1 + If sFile.ToLower = m_CurrCompo.FileList(IndexFile).ToLower Then + m_CurrCompo.SelFile = m_CurrCompo.FileList(IndexFile) + bFileExists = True + Exit For + End If + Next + End If End If - If Not bFileExists Or Not bBrandExists Then + + ' in caso sia fallita la ricera dei direttori o dei file + If Not bBrandExists Then + ' aggiungo il brand inesistente + If String.IsNullOrEmpty(BrandDir) Then BrandDir = RAD_DIR + m_CurrCompo.BrandListPart.Add(BrandDir) + m_CurrCompo.SelBrandPart = m_CurrCompo.BrandListPart(m_CurrCompo.BrandListPart.Count - 1) + 'm_CurrCompo = m_ErrCompo + m_CurrCompo.LoadByDefault = True + End If + If Not bFileExists Then + m_CurrCompo.FileList.Add(sFile) + m_CurrCompo.SelFile = m_CurrCompo.FileList(m_CurrCompo.FileList.Count - 1) ' File {0} in directory {1} has not been found. sErrorInfo &= String.Format(EgtMsg(50160), sFile, BrandDir) & vbCrLf m_CurrCompo.LoadByDefault = True - Part.FirstReadingEdge = True End If - ' mi sposto alla riga successiva + ' mi sposto alla riga successiva, anche se la componente è sbagliata carico comunque i suoi dati Index = NextIndex(Index) ' leggo i parametri del componente ReadParams(m_CurrCompo, sErrorInfo, Index) @@ -2138,7 +2156,8 @@ Public Class Part 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 + CompoTemplateItem.MissingParameter = True + CurrCompoParam.ErrorInReading = True Else ' significa che la TextBoxOnOff è stata disattivata If TypeOf CurrCompoParam Is TextBoxOnOffParam Then DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False) @@ -2177,9 +2196,14 @@ Public Class Part sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf If String.IsNullOrEmpty(sVal) Then Part.FirstReadingEdge = True - CompoTemplateItem.LoadByDefault = True End If - SelItem = List(0) + ' 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) End If ' assegno al parametro del componente il valore "filtrato" DirectCast(CurrCompoParam, ComboBoxParam).SetSelItem(SelItem) @@ -2192,7 +2216,8 @@ Public Class Part Dim dVal As Double If String.IsNullOrEmpty(sVal) OrElse Not StringToDouble(sVal, dVal) Then Part.FirstReadingEdge = True - CompoTemplateItem.LoadByDefault = True + CompoTemplateItem.ErrorValue = True + CurrCompoParam.ErrorInReading = True End If End If ' se il nome esiste ma è sbagliato @@ -2205,7 +2230,8 @@ Public Class Part ' This param will be initialized by default. sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf Part.FirstReadingEdge = True - CompoTemplateItem.LoadByDefault = True + CompoTemplateItem.ErrorValue = True + CurrCompoParam.ErrorInReading = True ' passo al parametro successivo senza cambiare linea del file DDF IndexParam += 1 Continue While @@ -2216,7 +2242,7 @@ Public Class Part ' This param will be initialized by default. sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf Part.FirstReadingEdge = True - CompoTemplateItem.LoadByDefault = True + CompoTemplateItem.MissingParameter = True ' esco dal ciclo Exit While End If @@ -2273,9 +2299,13 @@ Public Class Part sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf If String.IsNullOrEmpty(sVal) Then Part.FirstReadingEdge = True - CompoTemplateItem.LoadByDefault = True End If - SelItem = List(0) + ' 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) diff --git a/DoorParameters/PartPageV.xaml b/DoorParameters/PartPageV.xaml index 8df30db..6b932c0 100644 --- a/DoorParameters/PartPageV.xaml +++ b/DoorParameters/PartPageV.xaml @@ -335,22 +335,46 @@ - + + - + Converter={StaticResource SplitConverter},ConverterParameter=2}" Padding="0,0,1,0"> + + + - - + diff --git a/ProjectManager/ProjectManagerVM.vb b/ProjectManager/ProjectManagerVM.vb index 2d096ac..2b6f1d7 100644 --- a/ProjectManager/ProjectManagerVM.vb +++ b/ProjectManager/ProjectManagerVM.vb @@ -54,6 +54,9 @@ Public Class ProjectManagerVM Private m_cmdDelete As ICommand Private m_cmdOpen As ICommand Private m_cmdOpenMruFile As ICommand + + Private m_cmdReload As ICommand + Private m_cmdSave As ICommand Private m_cmdSaveAs As ICommand Private m_cmdInsert As ICommand @@ -89,6 +92,11 @@ Public Class ProjectManagerVM Return EgtMsg(MSG_TOPCOMMANDBAR + 2) End Get End Property + Public ReadOnly Property ReloadToolTip As String + Get + Return "Reload Directories" + End Get + End Property Public ReadOnly Property SaveToolTip As String Get Return EgtMsg(MSG_TOPCOMMANDBAR + 3) @@ -497,6 +505,28 @@ Public Class ProjectManagerVM #End Region ' OpenMruFileCommand +#Region "ReloadCommand" + + Public ReadOnly Property ReloadCommand As ICommand + Get + If m_cmdReload Is Nothing Then + m_cmdReload = New Command(AddressOf ReloadCmd) + End If + Return m_cmdReload + End Get + End Property + + Public Sub ReloadCmd() + If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then Map.SetRefCompoPanelVM(New CompoPanelVM("PartPage")) + If IsNothing(Map.refAssemblyManagerVM.CurrProject) AndAlso IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then Return + ' Map.refSceneManagerVM.RefreshBtn() + ' Map.refAssemblyManagerVM.LoadTempFile() + ' Map.refMainWindowVM.selectedWatcher = MainWindowVM.WatcherCalling.OnLoadTempFile + Map.refAssemblyManagerVM.RefreshAssembly() + End Sub + +#End Region ' ReloadCommand + #Region "SaveCommand" Public ReadOnly Property SaveCommand As ICommand @@ -1008,24 +1038,6 @@ Public Class ProjectManagerVM #End Region ' Duplica -#Region "Reload" - - Public ReadOnly Property RefreshDirCommand As ICommand - Get - If m_cmdRefreshDir Is Nothing Then - m_cmdRefreshDir = New Command(AddressOf RefreshDir) - End If - Return m_cmdRefreshDir - End Get - End Property - - Public Sub RefreshDir() - - End Sub - - -#End Region ' Reload - #Region "Hardware" Public ReadOnly Property HardwareCommand As ICommand diff --git a/RegexFunction.vb b/RegexFunction.vb index 3342349..d8347ff 100644 --- a/RegexFunction.vb +++ b/RegexFunction.vb @@ -45,6 +45,8 @@ Module RegexFunction Return Regex.Match(sLine, "\s*--\s*(" & sKey & ")\s*=\s*(.*)\s*$").Groups(2).Value End Function + ' quando questa variabile è settata a vero allora leggo rimuovo i metacommenti in fase di lettura + Friend IsCompo As Boolean = False ' toglie il commento da una riga (conservando i metacomandi) Friend Function RemoveComment(sLine As String) As String sLine = sLine.Replace(DDF_METADATA, "§") @@ -54,7 +56,12 @@ Module RegexFunction End If sLine = Regex.Match(sLine, "\s*(.*?)\s*#.*$").Groups(1).Value End If - sLine = sLine.Replace("§", DDF_METADATA) + If Not IsCompo Then + sLine = sLine.Replace("§", DDF_METADATA) + Else + sLine = sLine.Replace("§", "") + End If + Return sLine End Function diff --git a/SceneManager/SceneManagerVM.vb b/SceneManager/SceneManagerVM.vb index 2212345..37d02ad 100644 --- a/SceneManager/SceneManagerVM.vb +++ b/SceneManager/SceneManagerVM.vb @@ -352,6 +352,9 @@ Public Class SceneManagerVM ExecDoors(m_ProjectScene, sTempFile, False) EgtZoom(ZM.ALL, True) ShowGraphicError() + Else + EgtNewFile() + EgtZoom(ZM.ALL) End If End Sub diff --git a/Utility.vb b/Utility.vb index bbedf98..a645d73 100644 --- a/Utility.vb +++ b/Utility.vb @@ -433,3 +433,32 @@ Public Class CompoBrandDir End Sub End Class + +Public Class ItemFile + + Private Property m_FileName As String + Public Property FileName As String + Get + Return m_FileName + End Get + Set(value As String) + m_FileName = value + End Set + End Property + + Private Property m_FileNameVisibility As Visibility = Visibility.Visible + Public Property FileNameVisibility As Visibility + Get + Return m_FileNameVisibility + End Get + Set(value As Visibility) + m_FileNameVisibility = value + End Set + End Property + + Sub New(Name As String, NameVisibility As Visibility) + m_FileName = Name + m_FileNameVisibility = NameVisibility + End Sub + +End Class \ No newline at end of file