diff --git a/Assembly/Assembly.vb b/Assembly/Assembly.vb index 4c034ff..0b9f80b 100644 --- a/Assembly/Assembly.vb +++ b/Assembly/Assembly.vb @@ -18,6 +18,7 @@ Public Class Assembly End Get Set(value As Boolean) m_OneDoorProperty = value + NotifyPropertyChanged("OneDoorProperty") End Set End Property @@ -852,7 +853,11 @@ Public Class Assembly End Get Set(value As String) m_DoorNumber = value - 'ReplaceHardware() + If Trim(m_DoorNumber) = "1" Then + OneDoorProperty = True + Else + OneDoorProperty = False + End If NotifyPropertyChanged("DoorNumber") SetDimension("DoorNumber") Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True @@ -1571,6 +1576,12 @@ Public Class Assembly ' ha lo scopo di creare una copia dei riferimenti dei PartDoor ' per permettere di scrivere in modo più semplice i metodi Private Sub SetPartDoorCurrAssembly() + m_JambT = Nothing + m_JambB = Nothing + m_JambL = Nothing + m_JambR = Nothing + m_Door1 = Nothing + m_Door2 = Nothing For IndexPartDoor As Integer = 0 To ListPartDoor.Count - 1 If ListPartDoor(IndexPartDoor).Type.Contains("FT_") Then m_JambT = ListPartDoor(IndexPartDoor).Door @@ -1654,13 +1665,19 @@ Public Class Assembly UpDateAllCompo() Case "DoorNumber" + ClearRefOnAssembly() + SetPartDoorCurrAssembly() + ReverseDoor() Map.refAssemblyManagerVM.CreateDoor(Me) Map.refAssemblyManagerVM.CreateAssociation(Me) SetPartDoorCurrAssembly() SetVarAssembly() + ReloadAllCompoDoor1() + ReverseDoor() TopBottomWidth() SwingJamb() HeightDoor() + TopRabbetJamb() End Select End Sub @@ -1706,7 +1723,7 @@ Public Class Assembly Dim TBoxPar As TextBoxParam = DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam) Dim TBoxRefPar As TextBoxParam = DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), 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.m_Value, TBoxRefPar.IsReadOnly, sCurrTypeDoor) + CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.refJambCompo.ConfigurationParameters) ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is ComboBoxParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then ' ho controllato che i nome ddf del parametro sul jamb è lo stesso che sta sull'anta @@ -1718,7 +1735,7 @@ Public Class Assembly Dim TBoxPar As TextBoxOnOffParam = DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam) Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), 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.m_Value, TBoxRefPar.IsReadOnly, sCurrTypeDoor) + CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly, sCurrTypeDoor, CurrCompo.refJambCompo.ConfigurationParameters) End If Next End Sub @@ -2083,11 +2100,13 @@ Public Class Assembly TempDoor1.IsActive = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.IsActive TempDoor2.TypePart = "DO_1" Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door = TempDoor2 + Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.refPartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_1") Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.SwingTypeList = OptionModule.m_SwingTypeListLeftDoor Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.SetSwing(TempDoor1.Swing) TempDoor1.TypePart = "DO_2" Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door = TempDoor1 + Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.refPartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2") Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.SwingTypeList = OptionModule.m_SwingTypeListRightDoor SwingDoor(Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door, Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door) @@ -2202,11 +2221,68 @@ Public Class Assembly End Select End Sub - Public Sub UpDateNumberOfDoor() - If IsNothing(m_Door1) And IsNothing(m_Door2) Then Return - If m_Door1.SwingAlias.Name.Contains("I") Then - + ' elimina tutti i riferimenti esistenti + Public Sub ClearRefOnAssembly() + ' elimino tutti i riferimenti esistenti + If Not IsNothing(m_Door1) Then + For Each ItemCompo In m_Door1.CompoList + If Not IsNothing(ItemCompo.refJambCompo) Then + m_Door1.RemoveCompo(ItemCompo, True) + End If + Next End If + ' elimino tutti i riferimenti esistenti + If Not IsNothing(m_Door2) Then + For Each ItemCompo In m_Door2.CompoList + If Not IsNothing(ItemCompo.refJambCompo) Then + m_Door2.RemoveCompo(ItemCompo, True) + End If + Next + End If + End Sub + + ' costruisce i riferminti della prima anta + Public Sub ReloadAllCompoDoor1() + If IsNothing(m_Door1) Then Return + ' ricalcolo tutti i riferimenti + Map.refPartPageVM.CurrPart = m_Door1 + For Each ItemCompo In m_Door1.CompoList + CreateCompoOnJamb(ItemCompo) + Next + End Sub + + Public Sub ReverseDoor() + If IsNothing(m_Door1) OrElse IsNothing(m_Door2) Then Return + If Not m_Door1.SwingAlias.Name.Contains("I") Then Return + ' copio l'anta uno al posto dell'anta due e viceversa + Dim TempDoor1 As Part = Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.ShallowCopy() + Dim TempDoor2 As Part = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.ShallowCopy() + TempDoor2.IsActive = TempDoor1.IsActive + TempDoor1.IsActive = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.IsActive + TempDoor2.TypePart = "DO_1" + Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door = TempDoor2 + Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.refPartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_1") + Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.SwingTypeList = OptionModule.m_SwingTypeListLeftDoor + Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.SetSwing(TempDoor1.Swing) + + TempDoor1.TypePart = "DO_2" + Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door = TempDoor1 + Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.refPartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2") + Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door.SwingTypeList = OptionModule.m_SwingTypeListRightDoor + SwingDoor(Map.refAssemblyManagerVM.ReserchPartDoor("DO_2").Door, Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door) + + If IsNothing(m_JambR) OrElse IsNothing(m_JambL) Then Return + Dim TempJambL As Part = Map.refAssemblyManagerVM.ReserchPartDoor("FL_").Door.ShallowCopy() + Dim TempJambR As Part = Map.refAssemblyManagerVM.ReserchPartDoor("FR_").Door.ShallowCopy() + TempJambR.IsActive = TempJambL.IsActive + TempJambL.IsActive = Map.refAssemblyManagerVM.ReserchPartDoor("FR_").Door.IsActive + TempJambR.TypePart = ConstGen.PART_FRAME_LEFT + Map.refAssemblyManagerVM.ReserchPartDoor("FL_").Door = TempJambR + TempJambL.TypePart = ConstGen.PART_FRAME_RIGHT + Map.refAssemblyManagerVM.ReserchPartDoor("FR_").Door = TempJambL + + ' aggiorno le copie presenti nell'assemblato + SetPartDoorCurrAssembly() End Sub ' permette di settare lo swing della seconda anta in funzione della selezione dello swing sulla prima anta. @@ -2521,38 +2597,6 @@ Public Class Assembly #End Region ' Rabbet - '' ricalcola la posizione di tutti gli hardware se esiste un riferimento - 'Public Sub ReplaceHardware() - ' For IndexDoor As Integer = 0 To CInt(DoorNumber) - 1 - ' For IndexCompo As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList.Count - 1 - ' If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo) Then - ' Dim x As String = Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo.TemplateSelItem - ' For IndexParam As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList.Count - 1 - ' If TypeOf Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam) Is TextBoxParam Then - ' DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value = DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value - ' End If - ' Next - ' End If - ' Next - ' Next - 'End Sub - - 'Public Sub AddHardware() - ' For IndexDoor As Integer = 0 To CInt(DoorNumber) - 1 - ' For IndexCompo As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList.Count - 1 - ' If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo) Then - ' 'If Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo.Si Then - ' Dim x As String = Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo.TemplateSelItem - ' For IndexParam As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList.Count - 1 - ' If TypeOf Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam) Is TextBoxParam Then - ' DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value = DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value - ' End If - ' Next - ' End If - ' Next - ' Next - 'End Sub - #End Region ' Rules Assembly Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged diff --git a/AssemblyManager/AssemblyManagerVM.vb b/AssemblyManager/AssemblyManagerVM.vb index 265f568..7bc9313 100644 --- a/AssemblyManager/AssemblyManagerVM.vb +++ b/AssemblyManager/AssemblyManagerVM.vb @@ -380,6 +380,7 @@ Public Class AssemblyManagerVM nDoorNumber = 1 End If If nDoorNumber > 0 Then sDN = "1" + ' creo le Ante For IndexDoor As Integer = 0 To nDoorNumber - 1 Dim Type As String = ConstGen.PART_DO_ & IndexDoor + 1 If IsNothing(ReserchPartDoor(Type)) Then @@ -393,27 +394,44 @@ Public Class AssemblyManagerVM CurrAssembly.ListPartDoor.Add(Local_PartDoor) End If Next + ' eliminazione porta If nDoorNumber < CurrAssembly.ListPartDoorOfDoor.Count Then If Not IsNothing(ReserchPartDoor("DO_2")) Then - Dim LocalPartDorr As PartDoor = ReserchPartDoor("DO_2") - For IndexPartDoor As Integer = 1 To CurrAssembly.ListPartDoor.Count - 1 - If CurrAssembly.ListPartDoor(IndexPartDoor).Type = "DO_2" Then + Dim LocalPartDoor2 As PartDoor = ReserchPartDoor("DO_2") + Dim Type As String = "DO_2" + For IndexPartDoor As Integer = 0 To CurrAssembly.ListPartDoor.Count - 1 + If CurrAssembly.ListPartDoor(IndexPartDoor).Type = Type Then CurrAssembly.ListPartDoor.RemoveAt(IndexPartDoor) Exit For End If Next - LocalPartDorr.Door = Nothing - LocalPartDorr = Nothing + LocalPartDoor2.Door = Nothing + LocalPartDoor2 = Nothing ' aggiorno la lista delle ante CurrAssembly.NotifyPropertyChanged("ListPartDoorOfDoor") ' devo eliminare tutti riferiemnti che possono esistere CreateAssociation(CurrAssembly) End If End If + + ' prima di cambiare lo swing + Dim IndexSwing As Integer = 0 + If Not IsNothing(ReserchPartDoor("DO_1")) Then + Dim LocalPartDorr As PartDoor = ReserchPartDoor("DO_1") + If LocalPartDorr.Door.TypePart.Contains("DO_1") Then + For Each Item In LocalPartDorr.Door.SwingTypeList + If Item = LocalPartDorr.Door.SwingAlias.AliasName Then + Exit For + End If + IndexSwing += 1 + Next + End If + End If + ' carica la lista degli swing For Each ItemPartDoor In CurrAssembly.ListPartDoorOfDoor - SetSwingOnDoor(CurrAssembly.DoorNumber, ItemPartDoor.Door) + SetSwingOnDoor(CurrAssembly.DoorNumber, ItemPartDoor.Door, IndexSwing) Next CurrAssembly.NotifyPropertyChanged("ListPartDoorOfDoor") End Sub @@ -442,27 +460,29 @@ Public Class AssemblyManagerVM End Sub ' carica la lista degli swing a seconda del numero di porte selezionato - Public Sub SetSwingOnDoor(sDN As String, ByRef CurrPart As Part) + Public Sub SetSwingOnDoor(sDN As String, ByRef CurrPart As Part, nIndexSwing As Integer) Select Case sDN Case "1" CurrPart.SwingTypeList = OptionModule.m_SwingTypeListSinlgeDoor - CurrPart.SetSwing(OptionModule.m_Swing) + CurrPart.SetSwing(CurrPart.SwingTypeList(nIndexSwing)) Case "2" If CurrPart.TypePart.Contains("DO_1") Then CurrPart.SwingTypeList = OptionModule.m_SwingTypeListLeftDoor - CurrPart.SetSwing(CurrPart.SwingTypeList(0)) + CurrPart.SetSwing(CurrPart.SwingTypeList(nIndexSwing)) End If If CurrPart.TypePart.Contains("DO_2") Then CurrPart.SwingTypeList = OptionModule.m_SwingTypeListRightDoor - CurrPart.SetSwing(CurrPart.SwingTypeList(0)) - End If + CurrPart.SetSwing(CurrPart.SwingTypeList(nIndexSwing)) + End If Case Else CurrPart.SwingTypeList = OptionModule.m_SwingTypeList CurrPart.SetSwing(OptionModule.m_Swing) End Select End Sub -#Region "ASSOCIATION" +#End Region ' Creazione e caricamento degli oggetti dell'assemblato + +#Region "Association" ' questa è la funzione principale che esegue l'aggiunta/aggiornamento dei riferimenti ' per tutti gli oggetti presenti nell'assemblato viene costruito il riferimento @@ -618,8 +638,6 @@ Public Class AssemblyManagerVM #End Region ' Association -#End Region ' Creazione e caricamento degli oggetti dell'assemblato - #End Region ' METHODS #Region "COMMANDS" diff --git a/CompoMatch.vb b/CompoMatch.vb index fed009a..8115206 100644 --- a/CompoMatch.vb +++ b/CompoMatch.vb @@ -93,6 +93,7 @@ Module CompoMatch 'StringToDouble(CurrAssembly.GetArrayPartDoor(0).Door.Width, dDoor1Width) If Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1")) Then StringToDouble(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.Width, dDoor1Width) + EgtLuaSetGlobStringVar("STU.Swing", Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.SwingAlias.Name) End If EgtLuaSetGlobNumVar("STU.Door1Width", dDoor1Width) Dim dDoor2Width As Double = 0.0 @@ -105,10 +106,11 @@ Module CompoMatch End Function ' asseganto un parametro restituisce il valore da associare allo stesso parametro sul jamb - Friend Function CalcCompoParamValue(sInParamName As String, sInParamValue As String, ByRef sOutParamValue As String, ByRef IsEnable As Boolean, ByRef sSelDoor As String) As Boolean + Friend Function CalcCompoParamValue(sInParamName As String, sInParamValue As String, ByRef sOutParamValue As String, ByRef IsEnable As Boolean, ByRef sSelDoor As String, Optional ByRef sConfigurationCompo As String = "Graphic parameters1") As Boolean ' Assegno dati parametro EgtLuaSetGlobStringVar("STU.InParamName", sInParamName) EgtLuaSetGlobStringVar("STU.SelDoor", sSelDoor) + EgtLuaSetGlobStringVar("STU.ConfigDefault", sConfigurationCompo) Dim dInParamValue As Double StringToDouble(sInParamValue, dInParamValue) EgtLuaSetGlobNumVar("STU.InParamValue", dInParamValue) diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb index 5a5b1ba..83323da 100644 --- a/DoorParameters/Compo.vb +++ b/DoorParameters/Compo.vb @@ -28,9 +28,13 @@ Public Class Compo ' creo la stringa che contiene la lista degli errori Dim ErrorList As String = String.Empty - Dim SetCompo As Integer = 0 - + Private m_ConfigurationParameters As String + Public ReadOnly Property ConfigurationParameters As String + Get + Return m_ConfigurationParameters + End Get + End Property Private m_BorderColor As SolidColorBrush = New BrushConverter().ConvertFrom("#DCDCDC") Public Property BorderColor As SolidColorBrush @@ -1358,9 +1362,6 @@ Public Class Compo #Region "DeleteCommand" - ''' - ''' Returns a command that do Exec. - ''' Public ReadOnly Property DeleteCommand As ICommand Get If m_CmdDelete Is Nothing Then @@ -1370,10 +1371,6 @@ Public Class Compo End Get End Property - ''' - ''' Execute the Exec. This method is invoked by the ExecCommand. - ''' - Public Sub Delete() Dim DeleteNameHardware As String = Me.CompoType.Name Map.refPartPageVM.CurrPart.RemoveCompo(Me) diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb index 40b00e6..6567cb2 100644 --- a/DoorParameters/Part.vb +++ b/DoorParameters/Part.vb @@ -2077,6 +2077,10 @@ Public Class Part Else LoadBrandFileList(m_CurrCompo) End If + If IsNothing(m_CurrCompo) Then + SkipParams(Index + 1) + Exit While + End If '----------------------------------------------------------------------------------------------------------------------------------- ' Se c'è "- " iniziale If sKey.StartsWith("- ") Then diff --git a/IniFile.vb b/IniFile.vb index a8a11f3..b1517f0 100644 --- a/IniFile.vb +++ b/IniFile.vb @@ -83,7 +83,7 @@ Friend Module IniFile DefaultGetPrivateProfileString(lpAppName, lpKeyName, "", sVal) Dim sItems() As String = sVal.Split(",".ToCharArray) ' se la lista ha almeno un elemento - If sItems.Count > 0 Then + If sItems.Count > 0 And Not String.IsNullOrWhiteSpace(sItems(0)) Then For Index = 0 To sItems.Count() - 1 List.Add(Trim(sItems(Index))) Next diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 9d86d89..e541e80 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -72,5 +72,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb index 9bca7a0..317b519 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -249,7 +249,7 @@ Friend Module OptionModule Dim nDisableProperties As Integer = 1 nDisableProperties = GetMainPrivateProfileInt(S_GENERAL, "DisableProperties", 1) If nDisableProperties = 0 Then - m_DDisableProperties = Visibility.Visible + m_DisableProperties = Visibility.Visible Else m_DisableProperties = Visibility.Collapsed End If @@ -288,7 +288,7 @@ Friend Module OptionModule LoadPropertiesList(PropertyList, m_PropertList) PropertyList.Clear() DefaultGetPrivateProfileObservableCollection(ConstIni.S_PROPERTIES_INI, ConstIni.K_PROPRTIESLISTJAMB_INI, PropertyList) - LoadPropertiesList(PropertyList, m_PropertListJamb) + If PropertyList.Count > 0 Then LoadPropertiesList(PropertyList, m_PropertListJamb) ' Leggo le dimensioni della porta dal file Default.ini Dim Width As String = String.Empty @@ -569,7 +569,7 @@ Friend Module OptionModule Friend Sub CreateNewPropertiesListJamb(ByRef List As ObservableCollection(Of PropertyItem)) If OptionModule.m_DisableProperties <> Visibility.Visible Then Return Dim LocalList As ObservableCollection(Of PropertyItem) - If Not String.IsNullOrEmpty(OptionModule.m_PropertListJamb(0).Name) Then + If OptionModule.m_PropertListJamb.Count > 0 Then LocalList = OptionModule.m_PropertListJamb Else LocalList = OptionModule.m_PropertList @@ -592,15 +592,23 @@ Friend Module OptionModule Private Sub LoadSwingTypeList(ByRef List As List(Of String)) If List.Count = 0 Then Return For Each ItemSwing In List + Dim Vis As Visibility = Visibility.Visible + If ItemSwing.Contains("-"c) Then + Dim ItemSwingVisibility() As String = ItemSwing.Split("-"c) + ItemSwing = ItemSwingVisibility(0) + If ItemSwingVisibility(1) = "0" Then Vis = Visibility.Collapsed + End If If ItemSwing.Contains("/"c) Then Dim ItemAlias() As String = ItemSwing.Split("/"c) Dim Swing As New SwingItemTypeList(ItemAlias(0)) + Swing.VisibilityName = Vis For IndexItem As Integer = 1 To ItemAlias.Count - 1 Swing.AliasList.Add(ItemAlias(IndexItem)) Next m_SwingList.Add(Swing) Else Dim Swing As New SwingItemTypeList(ItemSwing) + Swing.VisibilityName = Vis m_SwingList.Add(Swing) End If Next @@ -609,6 +617,7 @@ Friend Module OptionModule ' carico le liste che devono essere rappresentate a video Private Sub LoadSwingList() For Index As Integer = 0 To 3 + If Not m_SwingList(Index).VisibilityName = Visibility.Visible Then Continue For ' carico gli swing della porta singola da mostrare a video If m_SwingList(Index).AliasList.Count = 0 Then m_SwingTypeListSinlgeDoor.Add(m_SwingList(Index).Name) @@ -621,6 +630,7 @@ Friend Module OptionModule End If Next For Index As Integer = 4 To 7 + If Not m_SwingList(Index).VisibilityName = Visibility.Visible Then Continue For ' carico gli swing della prima anta If m_SwingList(Index).AliasList.Count = 0 Then m_SwingTypeListLeftDoor.Add(m_SwingList(Index).Name) @@ -633,6 +643,7 @@ Friend Module OptionModule End If Next For Index As Integer = 8 To 11 + If Not m_SwingList(Index).VisibilityName = Visibility.Visible Then Continue For ' carico gli swing della seconda anta If m_SwingList(Index).AliasList.Count = 0 Then m_SwingTypeListRightDoor.Add(m_SwingList(Index).Name) @@ -648,6 +659,22 @@ Friend Module OptionModule Public Sub SetCurrSwing(ByRef SwingAlias As SwingItemTypeList, ByRef SwingDDF As String) SwingAlias = Nothing + ' controllo che lo swing letto da ddf appartenga alla lista degli swing visibili ( solo su porta Singola) + If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then + For Each ItemSwing In OptionModule.m_SwingList + If Trim(SwingDDF) = Trim(ItemSwing.Name) And Not ItemSwing.VisibilityName = Visibility.Visible Then + If SwingDDF.Contains("HR") Then + SwingDDF = Trim(SwingDDF) + SwingDDF = SwingDDF.Substring(0, 1) & "HR" + Else + SwingDDF = Trim(SwingDDF) + SwingDDF = SwingDDF.Substring(0, 2) + End If + Exit For + End If + Next + End If + For Each Item In OptionModule.m_SwingList If Trim(SwingDDF) = Trim(Item.Name) Then SwingAlias = Item diff --git a/OptionsWindow/OptionsViewModel.vb b/OptionsWindow/OptionsViewModel.vb index 4d7a26c..c074e01 100644 --- a/OptionsWindow/OptionsViewModel.vb +++ b/OptionsWindow/OptionsViewModel.vb @@ -679,7 +679,7 @@ Public Class OptionsVM Return OptionModule.m_DoorsNumber End Get Set(value As String) - + OptionModule.m_DoorsNumber = value End Set End Property @@ -1332,9 +1332,6 @@ Public Class OptionsVM #Region "CloseOptionsCommand" - ''' - ''' Returns a command that remove the current selected machining. - ''' Public ReadOnly Property CloseOptionsCommand() As ICommand Get If m_cmdCloseOptions Is Nothing Then @@ -1344,9 +1341,6 @@ Public Class OptionsVM End Get End Property - ''' - ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand. - ''' Public Sub CloseOptions() ' Chiusura finestra For Each Window In Application.Current.Windows @@ -1500,6 +1494,16 @@ Public Class SwingItemTypeList End Set End Property + Private m_VisibilityName As Visibility = Visibility.Visible + Public Property VisibilityName As Visibility + Get + Return m_VisibilityName + End Get + Set(value As Visibility) + m_VisibilityName = value + End Set + End Property + Sub New(sNameSwing As String) m_Name = sNameSwing End Sub diff --git a/RegexFunction.vb b/RegexFunction.vb index 0edc9ce..ae6a6ee 100644 --- a/RegexFunction.vb +++ b/RegexFunction.vb @@ -1,4 +1,5 @@ Imports System.Text.RegularExpressions +Imports System.IO Module RegexFunction ' restituisce vero se trova il capitoletto [Graphic parameters] @@ -14,7 +15,16 @@ Module RegexFunction ' toglie il commento da una riga (conservando i metacomandi) Friend Function RemoveComment(sLine As String) As String sLine = sLine.Replace(DDF_METADATA, "§") - If sLine.Contains("#"c) Then sLine = Regex.Match(sLine, "\s*(.*?)\s*#.*$").Groups(1).Value + If sLine.Contains("#"c) Then + If sLine.Contains("Config") Then + Dim ConfigurationCompo As String = Regex.Match(sLine, "\s*:\s*(.*?)\s*$").Groups(1).Value + If Not String.IsNullOrWhiteSpace(ConfigurationCompo) AndAlso + ConfigurationCompo <> Path.GetFileName(IniFile.m_sDoorsDirPath) Then + MessageBox.Show("The current configuration is: " & Path.GetFileName(IniFile.m_sDoorsDirPath) & ", different from the current ddf: " & ConfigurationCompo, "Warning", MessageBoxButton.OK, MessageBoxImage.Warning) + End If + End If + sLine = Regex.Match(sLine, "\s*(.*?)\s*#.*$").Groups(1).Value + End If sLine = sLine.Replace("§", DDF_METADATA) Return sLine End Function