Imports System.Collections.ObjectModel Imports System.ComponentModel Imports System.IO Imports EgtUILib Imports System.Text.RegularExpressions Public Class Assembly Implements INotifyPropertyChanged ' questa variabile se settata a vero da la possibilità di costruire un riferimento sui Jamb Friend Shared BuiltReffCompo As Boolean = False Public Shared FirstReadingWeight As Boolean = False ' è usata per abilitare la TextBox associata all'OverlapLock Private m_OneDoorProperty As Boolean = True Public Property OneDoorProperty As Boolean Get Return m_OneDoorProperty End Get Set(value As Boolean) m_OneDoorProperty = value NotifyPropertyChanged("OneDoorProperty") End Set End Property ' tutte queste proprietà interagiscono direttamente con le dimensioni del TELAIO ' per questo motivo la funzione set può ospitare la chiamata ad una funzione che modifica le dimensioni della porta #Region "GENERAL" #Region "Light Up/Bottom" Private m_LightUp As String Public Property LightUp As String Get Return m_LightUp End Get Set(value As String) m_LightUp = value NotifyPropertyChanged("LightUp") ' viene ricalcolata la dimensione dell'anta HeightDoor() ' viene ricalcolata l'altezza della porta e dei jamb laterali a partire dalla dimensione della porta HeightJamb() ' esegue il riposizionamento delle componeti sul telaio UpDateAllCompo() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End Set End Property ' questo metodo è utilizzato per caricare e aggiornare il valore m_lightUp senza eseguire le operazioni del Set Public Sub SetLightUp(sLightUp As String) m_LightUp = sLightUp NotifyPropertyChanged("LightUp") End Sub Private m_LightBottom As String Public Property LightBottom As String Get Return m_LightBottom End Get Set(value As String) m_LightBottom = value ' viene ricalcolata la dimensione dell'anta HeightDoor() ' viene ricalcolata l'altezza dei jamb laterali a partire dalla dimensione della porta HeightJamb() ' esegue il riposizionamento delle componeti sul telaio UpDateAllCompo() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End Set End Property Public Sub SetLightBottom(sLightBottom As String) m_LightBottom = sLightBottom NotifyPropertyChanged("LightBottom") End Sub #End Region ' Light Up/Bottom #Region "Light Hinge/Lock" Private m_LightHinge As String Public Property LightHinge As String Get Return m_LightHinge End Get Set(value As String) m_LightHinge = value ' viene ricalcolata la larghezza dei jamb orizzonati (le dimensioni della porta devono esistere) TopBottomWidth() ' esegue il riposizionamento delle componeti sul telaio UpDateAllCompo() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End Set End Property Public Sub SetLightHinge(sSetLightHinge As String) m_LightHinge = sSetLightHinge NotifyPropertyChanged("LightHinge") End Sub Private m_LightLock As String Public Property LightLock As String Get Return m_LightLock End Get Set(value As String) m_LightLock = value ' viene ricalcolata la larghezza dei jamb orizzonati (le dimensioni della porta devono esistere) TopBottomWidth() ' esegue il riposizionamento delle componeti sul telaio UpDateAllCompo() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End Set End Property Public Sub SetLightLock(sLightLock As String) m_LightLock = sLightLock NotifyPropertyChanged("LightLock") End Sub #End Region ' Light Hinge/Lock #Region "ThicknessHead" Private m_ThicknessHead As String Public Property ThicknessHead As String Get Return m_ThicknessHead End Get Set(value As String) m_ThicknessHead = value NotifyPropertyChanged("ThicknessHead") ' viene ricalcolata l'altezza del JambTop HeightJambTop() ' viene ricalcolata l'altezza della porta e dei jamb laterali a partire dalla dimensione della porta ' per il fatto che anche i jamb lateriali devono allungarsi HeightJamb() ' viene ricalcolata la dimsione dei rabbet sui jamb laterali (per ospitare la nuova dimansione del JambTop) TopRabbetJamb() ' esegue il riposizionamento delle componeti sul telaio UpDateAllCompo() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End Set End Property Public Sub SetThicknessHead(sThicknessHead As String) m_ThicknessHead = sThicknessHead NotifyPropertyChanged("ThicknessHead") End Sub #End Region ' ThicknessHead #Region "Overlap Hinge/Lock/Top/DeltaT" Private m_OverlapHinge As String Public Property OverlapHinge As String Get Return m_OverlapHinge End Get Set(value As String) m_OverlapHinge = value ' modifico le dimensioni dei Jambs 'DoorVisibilityNew() ' deve essere ricalcolata la dimensione del Top e del Bottom del telaio TopBottomWidth() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True 'SetWidthJamb() ' viene ricalcolato il valore dei rabbet (sui Jamb laterali) TopRabbetJamb() HingeRabbetJamb() BottomRabbetJamb() UpDateAllCompo() End Set End Property Public Sub SetOverlapHinge(sOverlapHinge As String) m_OverlapHinge = sOverlapHinge NotifyPropertyChanged("OverlapHinge") End Sub Private m_OverlapLock As String Public Property OverlapLock As String Get Return m_OverlapLock End Get Set(value As String) m_OverlapLock = value ' modifico le dimensioni dei Jambs 'DoorVisibilityNew() TopBottomWidth() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True 'SetWidthJamb() TopRabbetJamb() HingeRabbetJamb() BottomRabbetJamb() UpDateAllCompo() End Set End Property Public Sub SetOverlapLock(sOverlapLock As String) m_OverlapLock = sOverlapLock NotifyPropertyChanged("OverlapLock") End Sub Private m_OverlapTop As String Public Property OverlapTop As String Get Return m_OverlapTop End Get Set(value As String) m_OverlapTop = value Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True HeightJamb() SetWidthJamb() 'HingeRabbetJamb() 'BottomRabbetJamb() UpDateAllCompo() End Set End Property Public Sub SetOverlapTop(sOverlapTop As String) m_OverlapTop = sOverlapTop NotifyPropertyChanged("OverlapTop") End Sub Private m_DeltaThickness As String Public Property DeltaThickness As String Get Return m_DeltaThickness End Get Set(value As String) m_DeltaThickness = value Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True HingeRabbetJamb() UpDateAllCompo() End Set End Property Public Sub SetDeltaThickness(sDeltaThickness As String) m_DeltaThickness = sDeltaThickness NotifyPropertyChanged("DeltaThickness") End Sub #End Region ' Overlap Hinge/Lock/Top/DeltaT #Region "Jamb Thckness/Width" Private m_Thickness As String Public Property Thickness As String Get Return m_Thickness End Get Set(value As String) m_Thickness = value SetThicKnessJamb() UpDateAllCompo() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End Set End Property Public Sub SetThickness(sThickness As String) m_Thickness = sThickness NotifyPropertyChanged("Thickness") End Sub Private m_Width As String Public Property Width As String Get Return m_Width End Get Set(value As String) m_Width = value HeightJamb() SetWidthJamb() UpDateAllCompo() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End Set End Property Public Sub SetWidth(sWidth As String) m_Width = sWidth NotifyPropertyChanged("Width") End Sub #End Region ' Jamb Thickness/Width #Region "EdgeType/Machining" Friend Shared m_FrameEdgeTypeList As New ObservableCollection(Of EdgeType) Public ReadOnly Property EdgeTypeList As ObservableCollection(Of EdgeType) Get Return m_FrameEdgeTypeList End Get End Property Public ReadOnly Property DispositionList As ObservableCollection(Of EdgeType) Get Return Part.m_DispositionList End Get End Property ' elemento selezionato dalla lista delle disposizinioni Private m_DispositionItem As EdgeType Public Property DispositionItem As EdgeType Get Return m_DispositionItem End Get Set(value As EdgeType) Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.DispositionItem = value Next m_DispositionItem = value Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True NotifyPropertyChanged("DispositionItem") End Set End Property Public Sub SetDispositionItem(ObjDisposition As EdgeType) If IsNothing(m_DispositionItem) Then m_DispositionItem = ObjDisposition End If NotifyPropertyChanged("DispositionItem") End Sub Private m_LockEdgeType As New EdgeType("", Visibility.Visible) Public Property LockEdgeType As EdgeType Get If m_LockEdgeType.IsActive = Visibility.Collapsed Then m_LockEdgeType = EdgeTypeList(0) Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End If Return m_LockEdgeType End Get Set(value As EdgeType) Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.LockEdgeType = value Next m_LockEdgeType = value NotifyPropertyChanged("LockEdgeType") Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True 'm_LeftJamb.SetLockEdgeType(value) 'm_RightJamb.SetLockEdgeType(value) 'm_TopJamb.SetLockEdgeType(value) 'm_BottomJamb.SetLockEdgeType(value) End Set End Property Public Sub SetLockEdgeType(sLockEdgeType As EdgeType) m_LockEdgeType = sLockEdgeType NotifyPropertyChanged("LockEdgeType") End Sub Private m_HingeEdgeType As New EdgeType("", Visibility.Visible) Public Property HingeEdgeType As EdgeType Get If m_HingeEdgeType.IsActive = Visibility.Collapsed Then m_HingeEdgeType = EdgeTypeList(0) Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End If Return m_HingeEdgeType End Get Set(value As EdgeType) Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.HingeEdgeType = value Next m_HingeEdgeType = value NotifyPropertyChanged("HingeEdgeType") Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True 'm_LeftJamb.SetHingeEdgeType(value) 'm_RightJamb.SetHingeEdgeType(value) 'm_TopJamb.SetHingeEdgeType(value) 'm_BottomJamb.SetHingeEdgeType(value) End Set End Property Public Sub SetHingeEdgeType(sHingeEdgeType As EdgeType) m_HingeEdgeType = sHingeEdgeType NotifyPropertyChanged("HingeEdgeType") End Sub Private m_TopType As New EdgeType("", Visibility.Visible) Public Property TopType As EdgeType Get If m_TopType.IsActive = Visibility.Collapsed Then m_TopType = EdgeTypeList(0) Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End If Return m_TopType End Get Set(value As EdgeType) Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.TopType = value Next m_TopType = value NotifyPropertyChanged("TopType") Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True 'm_LeftJamb.SetTopType(value) 'm_RightJamb.SetTopType(value) 'm_TopJamb.SetTopType(value) 'm_BottomJamb.SetTopType(value) End Set End Property Public Sub SetTopType(sTopType As EdgeType) m_TopType = sTopType NotifyPropertyChanged("TopType") End Sub Private m_BottomType As New EdgeType("", Visibility.Visible) Public Property BottomType As EdgeType Get If m_BottomType.IsActive = Visibility.Collapsed Then m_BottomType = EdgeTypeList(0) Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End If Return m_BottomType End Get Set(value As EdgeType) Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.BottomType = value Next m_BottomType = value NotifyPropertyChanged("BottomType") Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True 'm_LeftJamb.SetBottomType(value) 'm_RightJamb.SetBottomType(value) 'm_TopJamb.SetBottomType(value) 'm_BottomJamb.SetBottomType(value) End Set End Property Public Sub SetBottomType(sBottomType As EdgeType) m_BottomType = sBottomType NotifyPropertyChanged("BottomType") End Sub Private m_TopMachining As Boolean Public Property TopMachining As Boolean Get Return m_TopMachining End Get Set(value As Boolean) Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.TopMachining = value Next m_TopMachining = value NotifyPropertyChanged("TopMachining") Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True 'm_LeftJamb.TopMachining = m_TopMachining 'm_RightJamb.TopMachining = m_TopMachining 'm_TopJamb.TopMachining = m_TopMachining 'm_BottomJamb.TopMachining = m_TopMachining End Set End Property Public Sub SetTopMachining(sTopMachining As Boolean) m_TopMachining = sTopMachining NotifyPropertyChanged("TopMachining") End Sub Private m_LockEdgeMachining As Boolean Public Property LockEdgeMachining As Boolean Get Return m_LockEdgeMachining End Get Set(value As Boolean) Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.LockEdgeMachining = value Next m_LockEdgeMachining = value NotifyPropertyChanged("LockEdgeMachining") Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True 'Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True 'm_LeftJamb.LockEdgeMachining = m_LockEdgeMachining 'm_RightJamb.LockEdgeMachining = m_LockEdgeMachining 'm_TopJamb.LockEdgeMachining = m_LockEdgeMachining 'm_BottomJamb.LockEdgeMachining = m_LockEdgeMachining End Set End Property Public Sub SetLockEdgeMachining(sLockEdgeMachining As Boolean) m_LockEdgeMachining = sLockEdgeMachining NotifyPropertyChanged("LockEdgeMachining") End Sub Private m_HingeEdgeMachining As Boolean Public Property HingeEdgeMachining As Boolean Get Return m_HingeEdgeMachining End Get Set(value As Boolean) Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.HingeEdgeMachining = value Next m_HingeEdgeMachining = value NotifyPropertyChanged("HingeEdgeMachining") Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True 'm_LeftJamb.HingeEdgeMachining = value 'm_RightJamb.HingeEdgeMachining = value 'm_TopJamb.HingeEdgeMachining = value 'm_BottomJamb.HingeEdgeMachining = value End Set End Property Public Sub SetHingeEdgeMachining(sHingeEdgeMachining As Boolean) m_HingeEdgeMachining = sHingeEdgeMachining NotifyPropertyChanged("HingeEdgeMachining") End Sub Private m_BottomMachining As Boolean Public Property BottomMachining As Boolean Get Return m_BottomMachining End Get Set(value As Boolean) Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.BottomMachining = value Next m_BottomMachining = value NotifyPropertyChanged("BottomMachining") Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True 'm_LeftJamb.BottomMachining = value 'm_RightJamb.BottomMachining = value 'm_TopJamb.BottomMachining = value 'm_BottomJamb.BottomMachining = value End Set End Property Public Sub SetBottomMachining(sBottomMachining As Boolean) m_BottomMachining = sBottomMachining NotifyPropertyChanged("BottomMachining") End Sub #End Region ' EdgeType #Region "EXTERIOR" Private m_Exterior As Boolean Public Property Exterior As Boolean Get Return m_Exterior End Get Set(value As Boolean) m_Exterior = value NotifyPropertyChanged("Exterior") SetDimension("JambIsCheked") JambBIsChecked = value NotifyPropertyChanged("JambBIsChecked") Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True HingeRabbetJamb() BottomRabbetJamb() End Set End Property Public Sub SetExterior(bExterior As Boolean) m_Exterior = bExterior NotifyPropertyChanged("Exterior") End Sub #End Region ' Exterior #Region "ASSEMBLY DIMENSION" Private m_Dimension As Boolean = OptionModule.m_TotalDimension Public Property Dimension As Boolean Get Return m_Dimension End Get Set(value As Boolean) m_Dimension = value NotifyPropertyChanged("Dimension") End Set End Property Public Sub SetDimension(bDimension As Boolean) m_Dimension = bDimension NotifyPropertyChanged("Dimension") End Sub Private m_AssemblyHeight As String Public Property AssemblyHeight As String Get If Not IsNothing(m_Door1) Then Dim nLU As Double = 0 Dim nLB As Double = 0 Dim nTH As Double = 0 Dim nJH As Double = 0 Dim nDO_1H As Double = 0 StringToDouble(LightUp, nLU) StringToDouble(LightBottom, nLB) StringToDouble(ThicknessHead, nTH) StringToDouble(Width, nJH) StringToDouble(m_Door1.Height, nDO_1H) m_AssemblyHeight = DoubleToString(nLU + nLB + nTH + nDO_1H, 4) If Exterior Then Dim nOLT As Double StringToDouble(OverlapTop, nOLT) m_AssemblyHeight = DoubleToString(nLU + nLB + nTH + nJH + nDO_1H - nOLT, 4) End If End If Return m_AssemblyHeight End Get Set(value As String) m_AssemblyHeight = value NotifyPropertyChanged("AssemblyHeight") SetDimension("Height") End Set End Property Public Sub SetAssemblyHeight(sAssemblyHeight As String) m_AssemblyHeight = sAssemblyHeight NotifyPropertyChanged("AssemblyHeight") End Sub Private m_AssemblyWidth As String Public Property AssemblyWidth As String Get If Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("FT_")) AndAlso Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("FT_").Door.Width) Then Dim nFTW As Double = 0 StringToDouble(Map.refAssemblyManagerVM.ReserchPartDoor("FT_").Door.Width, nFTW) Dim nJW As Double = 0 StringToDouble(Width, nJW) Dim nOLL As Double StringToDouble(OverlapLock, nOLL) Dim nOLH As Double StringToDouble(OverlapHinge, nOLH) If DoorNumber = "1" Then m_AssemblyWidth = DoubleToString(nFTW + 2 * nJW - nOLL - nOLH, 4) Else m_AssemblyWidth = DoubleToString(nFTW + 2 * nJW - 2 * nOLH, 4) End If End If Return m_AssemblyWidth End Get Set(value As String) m_AssemblyWidth = value SetWidthJamb() SetDimension("Width") NotifyPropertyChanged("AssemblyWidth") End Set End Property Public Sub SetAssemblyWidth(sAssemblyWidth As String) m_AssemblyWidth = sAssemblyWidth NotifyPropertyChanged("AssemblyWidth") End Sub #End Region ' Assembly Dimension #Region "OverMaterial" Private m_LockEdgeOverMaterial As String = String.Empty Public Property LockEdgeOverMaterial As String Get Return m_LockEdgeOverMaterial End Get Set(value As String) If String.IsNullOrEmpty(value) Then value = "0" Dim dVal As Double If StringToDouble(value, dVal) Then m_LockEdgeOverMaterial = value Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.LockEdgeOverMaterial = value Next 'm_LeftJamb.LockEdgeOverMaterial = value 'm_RightJamb.LockEdgeOverMaterial = value 'm_TopJamb.LockEdgeOverMaterial = value 'm_BottomJamb.LockEdgeOverMaterial = value End Set End Property Public Sub SetLockEdgeOverMaterial(sLockEdgeOverMaterial As String) m_LockEdgeOverMaterial = sLockEdgeOverMaterial NotifyPropertyChanged("LockEdgeOverMaterial") End Sub Private m_HingeEdgeOverMaterial As String = String.Empty Public Property HingeEdgeOverMaterial As String Get Return m_HingeEdgeOverMaterial End Get Set(value As String) If String.IsNullOrEmpty(value) Then value = "0" Dim dVal As Double If StringToDouble(value, dVal) Then m_HingeEdgeOverMaterial = value Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.HingeEdgeOverMaterial = value Next 'm_LeftJamb.HingeEdgeOverMaterial = value 'm_RightJamb.HingeEdgeOverMaterial = value 'm_TopJamb.HingeEdgeOverMaterial = value 'm_BottomJamb.HingeEdgeOverMaterial = value End Set End Property Public Sub SetHingeEdgeOverMaterial(sHingeEdgeOverMaterial As String) m_HingeEdgeOverMaterial = sHingeEdgeOverMaterial NotifyPropertyChanged("HingeEdgeOverMaterial") End Sub Private m_TopOverMaterial As String = String.Empty Public Property TopOverMaterial As String Get Return m_TopOverMaterial End Get Set(value As String) If String.IsNullOrEmpty(value) Then value = "0" Dim dVal As Double If StringToDouble(value, dVal) Then m_TopOverMaterial = value Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.TopOverMaterial = value Next 'm_LeftJamb.TopOverMaterial = value 'm_RightJamb.TopOverMaterial = value 'm_TopJamb.TopOverMaterial = value 'm_BottomJamb.TopOverMaterial = value End Set End Property Public Sub SetTopOverMaterial(sTopOverMaterial As String) m_TopOverMaterial = sTopOverMaterial NotifyPropertyChanged("TopOverMaterial") End Sub Private m_BottomOverMaterial As String = String.Empty Public Property BottomOverMaterial As String Get Return m_BottomOverMaterial End Get Set(value As String) If String.IsNullOrEmpty(value) Then value = "0" Dim dVal As Double If StringToDouble(value, dVal) Then m_BottomOverMaterial = value Else MessageBox.Show(EgtMsg(50148), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Asterisk) End If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True Dim CurrAssembly As Assembly = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly For Each ItemPartDoor In CurrAssembly.ListPartDoor If ItemPartDoor.Type.Contains("F") Then ItemPartDoor.Door.BottomOverMaterial = value Next 'm_LeftJamb.BottomOverMaterial = value 'm_RightJamb.BottomOverMaterial = value 'm_TopJamb.BottomOverMaterial = value 'm_BottomJamb.BottomOverMaterial = value End Set End Property Public Sub SetBottomOverMaterial(sBottomOverMaterial As String) m_BottomOverMaterial = sBottomOverMaterial NotifyPropertyChanged("BottomOverMaterial") End Sub #End Region ' OverMaterial #End Region ' General Private m_JambT As Part = Nothing Private m_JambB As Part = Nothing Private m_JambL As Part = Nothing Private m_JambR As Part = Nothing Private m_Door1 As Part = Nothing Private m_Door2 As Part = Nothing Public Property JambTIsChecked As Boolean Get If IsNothing(m_JambT) Then Return False Return m_JambT.IsActive End Get Set(value As Boolean) ' se il pezzo non esiste deve essere creato OptionModule.m_TopJambChk = value ' setto la sua variabile If Not IsNothing(m_JambT) Then m_JambT.IsActive = value NotifyPropertyChanged("JambTIsChecked") End If ' se non esiste l'oggeto prima lo creo SetDimension("JambIsCheked") End Set End Property Public Property JambBIsChecked As Boolean Get If IsNothing(m_JambB) Then Return False Return m_JambB.IsActive End Get Set(value As Boolean) OptionModule.m_BottomJambChk = value ' setto la sua variabile If Not IsNothing(m_JambB) Then m_JambB.IsActive = value NotifyPropertyChanged("JambBIsChecked") End If ' se non esiste l'oggeto prima lo creo SetDimension("JambIsCheked") End Set End Property Public Property JambLIsChecked As Boolean Get If IsNothing(m_JambL) Then Return False Return m_JambL.IsActive End Get Set(value As Boolean) OptionModule.m_LeftJambChk = value ' setto la sua variabile If Not IsNothing(m_JambL) Then m_JambL.IsActive = value NotifyPropertyChanged("JambLIsChecked") End If ' se non esiste l'oggeto prima lo creo SetDimension("JambIsCheked") End Set End Property Public Property JambRIsChecked As Boolean Get If IsNothing(m_JambR) Then Return False Return m_JambR.IsActive End Get Set(value As Boolean) OptionModule.m_RightJambChk = value ' setto la sua variabile If Not IsNothing(m_JambR) Then m_JambR.IsActive = value NotifyPropertyChanged("JambRIsChecked") End If ' se non esiste l'oggeto prima lo creo SetDimension("JambIsCheked") End Set End Property #Region "DOOR NUMBER" ' carica il numero di porte da mostrare nella combobox Private m_DoorListNumber As New List(Of String) Public Property DoorListNumber As List(Of String) Get Return m_DoorListNumber End Get Set(value As List(Of String)) m_DoorListNumber = value End Set End Property ' converto il numero di porte letto nella combobox in una lista di stringhe (sDoorList) Private m_DoorNumber As String Public Property DoorNumber As String Get Return m_DoorNumber End Get Set(value As String) m_DoorNumber = value If Trim(m_DoorNumber) = "1" Then OneDoorProperty = True Else OneDoorProperty = False End If NotifyPropertyChanged("DoorNumber") SetDimension("DoorNumber") Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True Map.refSceneManagerVM.RefreshBtn() End Set End Property Public Sub SetDoorNumber(sDoorNumber As String) DoorListNumber = OptionModule.m_DoorsListNumber For Each sNumber In DoorListNumber If sNumber = sDoorNumber Then m_DoorNumber = sNumber End If Next If Trim(m_DoorNumber) = "1" Then OneDoorProperty = True Else OneDoorProperty = False End If NotifyPropertyChanged("DoorNumber") End Sub #End Region ' Door Number #Region "LIST PART" ' al momento della creazione di un nuovo assembalto vengono caricati di defualt: ' JambLeft, JambTop, JambRight, JambBottom, Door_1 Private m_ListPartDoor As New ObservableCollection(Of PartDoor) Public Property ListPartDoor As ObservableCollection(Of PartDoor) Get Return m_ListPartDoor End Get Set(value As ObservableCollection(Of PartDoor)) m_ListPartDoor = value ' ogni volta che si aggiunge una compoenente riallinea la lista sotto NotifyPropertyChanged("ListPartDoorOfDoor") End Set End Property ' questo elenco estrae dall'elenco sopra tutte le ante, cosi da poter essre passata come lista di solo ante nella grafica Private m_ListPartDoorOfDoor As New ObservableCollection(Of PartDoor) Public ReadOnly Property ListPartDoorOfDoor As ObservableCollection(Of PartDoor) Get m_ListPartDoorOfDoor.Clear() For Each ItemPartDoor In m_ListPartDoor If ItemPartDoor.Type.Contains("DO_") Then m_ListPartDoorOfDoor.Add(ItemPartDoor) End If Next Return m_ListPartDoorOfDoor End Get End Property #End Region ' List Part #Region "Lettura Assemblato" Public Enum ResultReadingAssembInfo MissingAssembInfo ErrorInAssembInfo CorrectAssembInfo End Enum Public bOk As ResultReadingAssembInfo = ResultReadingAssembInfo.CorrectAssembInfo Private FileContent() As String Shared Sub ReadDDFAssembly(sPathDDF As String, ByRef ReadAssembly As Assembly) BuiltReffCompo = False ' restituisce un problema nella lettura di un valore della compo Dim sErrorInfo As String = String.Empty ' controllo se esiste il file DDF If Not File.Exists(sPathDDF) Then Return End If ReadAssembly.FileContent = File.ReadAllLines(sPathDDF) ' se il file esiste ma è vuoto If ReadAssembly.FileContent.Count = 0 Then MessageBox.Show(EgtMsg(50107), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) End If '--------------------------------------------------------------------------------------------------------------------------------- ' leggo riga per riga Dim IndexLine As Integer = 0 Map.refAssemblyManagerVM.LoadAssemblyInformation(ReadAssembly) ReadAssembly.bOk = ReadAssembly.GetGeneralAssembly(IndexLine, sErrorInfo) '--------------------------------------------------------------------------------------------------------------------------------- If ReadAssembly.bOk <> ResultReadingAssembInfo.ErrorInAssembInfo Then If IndexLine = -1 Then ' 50163= Error in reading General Assembly in DDF sErrorInfo += String.Format(EgtMsg(50102), EgtMsg(50163) + vbCrLf) ReadAssembly = Nothing Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected Else If ReadAssembly.GetDDFDoor(IndexLine, sErrorInfo) = -1 Then ' errore nella lettura di un part: blocco tutto ReadAssembly = Nothing Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected End If End If Else ' 50163= Error in reading General Assembly in DDF sErrorInfo += String.Format(EgtMsg(50102), EgtMsg(50163) + vbCrLf) ReadAssembly = Nothing Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected End If If Not String.IsNullOrWhiteSpace(sErrorInfo) Then ' 50164=In General Assembly: sErrorInfo = EgtMsg(50164) & vbCrLf & sErrorInfo MessageBox.Show(sErrorInfo, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) End If End Sub Private Function GetGeneralAssembly(ByRef IndexLine As Integer, sErrorInfo As String) As ResultReadingAssembInfo IndexLine = SkipWhiteSpace(IndexLine) ' Size If IndexLine < FileContent.Count - 1 Then If SearchKey(FileContent(IndexLine), ConstIni.S_SIZE_INI) Then IndexLine = GetSize(IndexLine + 1) If IndexLine = -1 Then sErrorInfo += String.Format(EgtMsg(50102), ConstIni.S_SIZE_INI + vbCrLf) Return ResultReadingAssembInfo.ErrorInAssembInfo End If End If End If If IndexLine = 0 Then Return ResultReadingAssembInfo.MissingAssembInfo IndexLine = SkipWhiteSpace(IndexLine) ' Light If IndexLine < FileContent.Count - 1 Then If SearchKey(FileContent(IndexLine), ConstIni.S_LIGHT) Then IndexLine = GetLight(IndexLine + 1) If IndexLine = -1 Then sErrorInfo += String.Format(EgtMsg(50102), ConstIni.S_LIGHT + vbCrLf) Return ResultReadingAssembInfo.ErrorInAssembInfo End If End If End If IndexLine = SkipWhiteSpace(IndexLine) ' Overlap If IndexLine < FileContent.Count - 1 Then If SearchKey(FileContent(IndexLine), ConstIni.S_OVERLAP) Then IndexLine = GetOverlap(IndexLine + 1) If IndexLine = -1 Then sErrorInfo += String.Format(EgtMsg(50102), ConstIni.S_OVERLAP + vbCrLf) Return ResultReadingAssembInfo.ErrorInAssembInfo End If End If End If IndexLine = SkipWhiteSpace(IndexLine) ' Exterior If IndexLine < FileContent.Count - 1 Then If SearchKey(FileContent(IndexLine), ConstIni.K_EXTERIOR) Then IndexLine = GetExterior(IndexLine + 1) If IndexLine = -1 Then sErrorInfo += String.Format(EgtMsg(50102), ConstIni.K_EXTERIOR + vbCrLf) Return ResultReadingAssembInfo.ErrorInAssembInfo End If End If End If IndexLine = SkipWhiteSpace(IndexLine) ' Profiles If IndexLine < FileContent.Count - 1 Then If SearchKey(FileContent(IndexLine), ConstIni.S_PROFILES) Then IndexLine = GetProfiles(IndexLine + 1) If IndexLine = -1 Then sErrorInfo += String.Format(EgtMsg(50102), ConstIni.S_PROFILES + vbCrLf) Return ResultReadingAssembInfo.ErrorInAssembInfo End If End If End If IndexLine = SkipWhiteSpace(IndexLine) ' Doors If IndexLine < FileContent.Count Then If SearchKey(FileContent(IndexLine), ConstIni.S_DOORS_ASSEMBY) Then ' in questo modo non passo dalla proprietà ( in breve quello che accadrebbe usando il metodo Set) IndexLine = GetValue(IndexLine, ConstIni.S_DOORS_ASSEMBY, m_DoorNumber) SetDoorNumber(m_DoorNumber) If IndexLine = -1 Then sErrorInfo += String.Format(EgtMsg(50102), ConstIni.S_DOORS_ASSEMBY + vbCrLf) Return ResultReadingAssembInfo.ErrorInAssembInfo End If ' se sono arrivato fino a qui significa che ormai è terminata la pagina If IsNothing(m_Exterior) OrElse Not m_Exterior Then m_Exterior = False m_OverlapTop = OptionModule.m_OverlapTop End If End If End If Return ResultReadingAssembInfo.CorrectAssembInfo End Function ' salta le righe che non contengono un metadata Private Function SkipWhiteSpace(Index As Integer) As Integer Dim ExitLoop As Boolean = False While Not ExitLoop And Index < FileContent.Count - 1 ' se la riga contiene un commeto allora faccio questo controllo If FileContent(Index).Contains(ConstCompo.DDF_METADATA) Then If Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*" & DDF_METADATA & "\s*(.*?\b)\s*:\s*$").Groups(1).Value) Then ExitLoop = True ElseIf Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*" & DDF_METADATA & "\s*(.*?\b)\s*:\s*(.*?\.*)$").Groups(1).Value) Then ExitLoop = True ElseIf Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*(" & ConstCompo.S_MEASURES & ")\s*:\s*(.*?\.*)$").Groups(1).Value) Then ExitLoop = True Else Index += 1 End If ' utilizzando una funzione regex ElseIf Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*(" & ConstCompo.S_MEASURES & ")\s*:\s*(.*?\.*)$").Groups(1).Value) Or Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*(" & ConstCompo.S_PRODUCE & ")\s*:\s*(.*?\.*)$").Groups(1).Value) Then '' utilizzando il semplice controllo se la stringa contiene le parole 'ElseIf Not FileContent(Index).Contains(ConstCompo.S_MEASURES) Or ' Not FileContent(Index).Contains(ConstCompo.S_PRODUCE) Then Index = 0 ExitLoop = True Else Index += 1 End If End While Return Index End Function ' funzione per la ricerca dei valori, restituice la riga successiva Private Function GetValue(Index As Integer, Name As String, ByRef Var As String) As Integer If Index = -1 Then Return -1 Dim Local_Var As String = GetValueWithKey(FileContent(Index), Name) If String.IsNullOrWhiteSpace(Local_Var) Then ' se non c'è la parola chiave allora esci If Not SearchKey(FileContent(Index), Name) Then Return -1 ' altrimenti lascia il valore vuoto Else Var = Local_Var End If Return Index + 1 End Function ' funzione per la ricerca dei profili, restituisce la riga successiva Private Function GetValueProfiles(Index As Integer, Name As String, ByRef Var As EdgeType, ByRef VarMachining As Boolean, ByRef VarOverMaterial As String) As Integer ' Creo una stringa per scrivere gli errori Dim bError As Boolean = False If Index = -1 Then Return Index Else ' Lock Dim Bevel As String Bevel = GetValueWithKey(FileContent(Index), Name) ' se il valore restituito è nullo o vuoto If String.IsNullOrWhiteSpace(Bevel) Then ' se non c'è la parola chiave allora esci If Not SearchKey(FileContent(Index), Bevel) Then ' restituisco il valore -1 Return -1 Else Var = EdgeTypeList(0) End If Index += 1 Else 'Dim IndexEdge As Integer = EdgeTypeList.IndexOf(Var) Dim IndexEdge As Integer = 0 For I As Integer = 0 To EdgeTypeList.Count - 1 If Bevel = EdgeTypeList(I).Name And EdgeTypeList(I).IsActive = Visibility.Visible Then Var = EdgeTypeList(I) IndexEdge = I Exit For Else IndexEdge = -1 End If Next If IndexEdge = -1 And Bevel = ConstGen.BEVEL_UP Then Var = EdgeTypeList(0) bError = True MsgBevel(bError, Bevel) Index += 1 Else Var.Name = EdgeTypeList(IndexEdge).Name ' restituisco la riga successiva all'ultimo valore letto Index += 1 End If End If End If If Index = -1 Then Return Index Else Dim Machining = GetValueWithKey(FileContent(Index), K_MACHINING) If String.IsNullOrWhiteSpace(Machining) Then If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1 Index += 1 Else VarMachining = Utility.ConvertOnOffToBoolean(Machining) Index += 1 End If End If If Index = -1 Then Return Index Else VarOverMaterial = GetValueWithKey(FileContent(Index), K_OVERMATERIAL) If String.IsNullOrWhiteSpace(VarOverMaterial) Then If Not SearchKey(FileContent(Index), K_OVERMATERIAL) Then Return -1 Index += 1 Else Index += 1 End If End If Return Index End Function Private Sub MsgBevel(bFound As Boolean, Edge As String) If bFound And Not Part.FirstReadingEdge Then ' Bevel {0} can not be acceptable in Jamb Dim CautionBevel As String = String.Format(EgtMsg(50158), Edge) MessageBox.Show(CautionBevel, EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk) Part.FirstReadingEdge = True End If End Sub ' Size Private Function GetSize(Index As Integer) As Integer If Index = -1 Then Return -1 Index = GetValue(Index, "thickness", m_Thickness) If Index = -1 Then Return -1 Index = GetValue(Index, "width", m_Width) Return Index End Function ' light Private Function GetLight(Index As Integer) As Integer If Index = -1 Then Return -1 Index = GetValue(Index, SIDE_UP, m_LightUp) If Index = -1 Then Return -1 Index = GetValue(Index, SIDE_LOCK, m_LightLock) If Index = -1 Then Return -1 Index = GetValue(Index, SIDE_HINGE, m_LightHinge) If Index = -1 Then Return -1 Index = GetValue(Index, K_BOTTOM, m_LightBottom) Return Index End Function ' Overlap Private Function GetOverlap(Index As Integer) As Integer If Index = -1 Then Return -1 Index = GetValue(Index, "thickness", m_ThicknessHead) If Index = -1 Then Return -1 Index = GetValue(Index, SIDE_HINGE, m_OverlapHinge) If Index = -1 Then Return -1 Index = GetValue(Index, SIDE_LOCK, m_OverlapLock) If Index = -1 Then Return -1 Index = GetValue(Index, "deltaT", m_DeltaThickness) Return Index End Function ' Profiles Private Function GetProfiles(Index As Integer) As Integer If Index = -1 Then Return -1 Index = GetValueProfiles(Index, K_LOCKEDGE, m_LockEdgeType, m_LockEdgeMachining, m_LockEdgeOverMaterial) If Index = -1 Then Return -1 Index = GetValueProfiles(Index, K_HINGEEDGE, m_HingeEdgeType, m_HingeEdgeMachining, m_HingeEdgeOverMaterial) If Index = -1 Then Return -1 Index = GetValueProfiles(Index, K_TOP, m_TopType, m_TopMachining, m_TopOverMaterial) If Index = -1 Then Return -1 Index = GetValueProfiles(Index, K_BOTTOM, m_BottomType, m_BottomMachining, m_BottomOverMaterial) Return Index End Function ' exterior Private Function GetExterior(Index As Integer) As Integer m_Exterior = True If Index = -1 Then Return -1 Index = GetValue(Index, K_TOP, m_OverlapTop) 'If Index = -1 Then Return -1 'Index = GetValue(Index, "deltaT", m_DeltaThickness) Return Index End Function ' dopo la lettura delle informazioni dell'assemblato Private Function GetDDFDoor(IndexLine As Integer, ByRef sErrorInfo As String) As Integer Dim Line As Integer = IndexLine While Line < FileContent.Count - 1 AndAlso Not Search3Dots(FileContent(Line)) Dim Local_PartDoor As New PartDoor Dim Local_Door As New Part(Local_PartDoor) ' carcio la liste delle propiretà CreateNewPropertiesList(Local_Door.PropertiesList) If Line > 0 Then ' per saltare la riga che è stata appena restituita che contiene "---" Line += 1 End If ' se la lettura di un oggetto fallisce allora restituisce nothing Part.ReadDDFPartDoor(FileContent, Line, Local_Door) If IsNothing(Local_Door) Then Return -1 If String.IsNullOrEmpty(Local_Door.TypePart) Then Local_Door.TypePart = ConstGen.PART_DO_ & "1" Dim sDoorPiece As String = Local_Door.TypePart ' per eliminare lo swing associato al jamb FL_L --> FL_ If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then If sDoorPiece.Count > 3 AndAlso sDoorPiece.Contains(ConstGen.PART_FRAME) Then sDoorPiece = sDoorPiece.Remove(sDoorPiece.LastIndexOf("_"c) + 1) End If Map.refCompoPanelVM.GoBackVisibility = Visibility.Visible Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage Else ' significa che stiamo per leggere una porta singola, cerco una porta If Not Local_Door.TypePart.Contains("DO_") Then sErrorInfo = "The current ddf is an Assembly. Any modify will be saved as single door." Continue While End If Local_Door.IsActive = True Local_PartDoor.Door = Local_Door Local_PartDoor.Door.SwingTypeList = OptionModule.m_SwingTypeList Local_PartDoor.SetIsChecked(Local_Door.IsActive) ListPartDoor.Add(Local_PartDoor) Map.refPartPageVM.CurrPart = Local_Door Map.refCompoPanelVM.GoBackVisibility = Visibility.Collapsed Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage Exit While End If ' impedisco di costruire i riferminti BuiltReffCompo = False Select Case sDoorPiece Case ConstGen.PART_DO_ & "1" Local_PartDoor.Door = Local_Door Local_PartDoor.Door.SwingTypeList = m_SwingTypeListSinlgeDoor Local_PartDoor.SetIsChecked(Local_Door.IsActive) ListPartDoor.Add(Local_PartDoor) Case ConstGen.PART_DO_ & "2" Local_PartDoor.Door = Local_Door If Not IsNothing(Map.refAssemblyManagerVM.ReserchPartDoor("DO_1")) Then Local_PartDoor.Door.SwingTypeList = m_SwingTypeListRightDoor Map.refAssemblyManagerVM.ReserchPartDoor("DO_1").Door.SwingTypeList = m_SwingTypeListLeftDoor Else Local_PartDoor.Door.SwingTypeList = m_SwingTypeListSinlgeDoor End If Local_PartDoor.SetIsChecked(Local_Door.IsActive) ListPartDoor.Add(Local_PartDoor) Case ConstGen.PART_DO_ & "3" Local_PartDoor.Door = Local_Door Local_PartDoor.SetIsChecked(Local_Door.IsActive) ListPartDoor.Add(Local_PartDoor) 'SetArrayPartDoor(Local_PartDoor, 2) Case ConstGen.PART_DO_ & "4" Local_PartDoor.Door = Local_Door Local_PartDoor.SetIsChecked(Local_Door.IsActive) ListPartDoor.Add(Local_PartDoor) 'SetArrayPartDoor(Local_PartDoor, 3) Case ConstGen.PART_DO_ & "5" Local_PartDoor.Door = Local_Door Local_PartDoor.SetIsChecked(Local_Door.IsActive) 'SetArrayPartDoor(Local_PartDoor, 4) Case ConstGen.PART_DO_ & "6" Local_PartDoor.Door = Local_Door Local_PartDoor.SetIsChecked(Local_Door.IsActive) ListPartDoor.Add(Local_PartDoor) 'SetArrayPartDoor(Local_PartDoor, 5) Case ConstGen.PART_FRAME_LEFT Local_PartDoor.Door = Local_Door Local_Door.SwingTypeList = m_SwingTypeList ListPartDoor.Add(Local_PartDoor) 'm_LeftJamb = Local_Door Case ConstGen.PART_FRAME_RIGHT Local_PartDoor.Door = Local_Door Local_Door.SwingTypeList = m_SwingTypeList ListPartDoor.Add(Local_PartDoor) 'm_RightJamb = Local_Door Case ConstGen.PART_FRAME_TOP Local_PartDoor.Door = Local_Door Local_Door.SwingTypeList = m_SwingTypeList ListPartDoor.Add(Local_PartDoor) 'm_TopJamb = Local_Door Case ConstGen.PART_FRAME_BOTTOM Local_PartDoor.Door = Local_Door Local_Door.SwingTypeList = m_SwingTypeList ListPartDoor.Add(Local_PartDoor) 'm_BottomJamb = Local_Door If Not m_Exterior Then Local_PartDoor.Door.IsActive = False End Select End While ' controllo che gli oggetti che sono stati caricati If Not ControlAssemblyInformation() Then Return -1 Else Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False End If ' scrivo in locale un a copia dei riferiemti ai part SetPartDoorCurrAssembly() If Not OptionModule.m_ConfigurationSoftware = ConfigType.Door Then If Not ControlListDoor() Then Return -1 End If If Not ControlSwing() Then Return -1 End If End If BuiltReffCompo = True Map.refAssemblyManagerVM.CreateAssociation(Me) MatchCompo() Return 1 End Function ' verifico che la dicitaura delle porte sia coerente Private Function ControlListDoor() As Boolean Dim WritingError As String = String.Empty Select Case ListPartDoorOfDoor.Count Case 1 ' se ho una porta soltanto deve essere la prima If IsNothing(m_Door1) Then WritingError = EgtMsg(50506) MessageBox.Show(WritingError, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return False Else Return True End If Case 2 If ListPartDoorOfDoor.Count < 2 Then Return False If IsNothing(m_Door1) OrElse IsNothing(m_Door2) Then ' 50513=Impossible to find the first door (DO_1) or the second door (DO_2)! WritingError = EgtMsg(50513) MessageBox.Show(WritingError, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return False End If If Not ListPartDoorOfDoor(0).Door.TypePart = "DO_1" Then ' 50515=The first door is not realy the first, check the ddf. WritingError = EgtMsg(50515) MessageBox.Show(WritingError, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return False End If Return True End Select Return False End Function ' controllo che gli swing siano coerenti: Private Function ControlSwing() As Boolean Dim ErrorSwingMessages As String = String.Empty Select Case ListPartDoorOfDoor.Count Case 1 Dim Local_Door1 As Part = ListPartDoorOfDoor(0).Door Dim Local_Swing As String = Local_Door1.Swing Local_Door1.SwingTypeList = OptionModule.m_SwingTypeListSinlgeDoor If String.IsNullOrEmpty(Local_Swing) Then Return False Dim Index As Integer = Local_Door1.SwingTypeList.FindIndex(Function(sValue) Trim(sValue) = Trim(Local_Swing)) ' se Index = -1 significa che non è stata trovata nessuna corrispondenza If Index < 0 Then ' 50507=The swing is not a member of the swing list of single door. ErrorSwingMessages = EgtMsg(50507) MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return False End If Local_Door1.Swing = Local_Door1.SwingTypeList(Index) Return True Case 2 Dim Index_1 As Integer = -1 Dim Index_2 As Integer = -1 If Not IsNothing(m_Door1) Then Index_1 = OptionModule.m_SwingTypeListLeftDoor.FindIndex(Function(sValue) Trim(sValue) = Trim(m_Door1.Swing)) End If If Not IsNothing(m_Door2) Then Index_2 = OptionModule.m_SwingTypeListRightDoor.FindIndex(Function(sValue) Trim(sValue) = Trim(m_Door2.Swing)) End If ' Se uno swing è corretto e l'altro è sbagliato If (Index_1 < 0 AndAlso Index_2 > -1) Then ' 50508=The swing of left door is not a member of the swing list of left door. ErrorSwingMessages = EgtMsg(50508) MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return False ElseIf (Index_1 > -1 AndAlso Index_2 < 0) Then ' 50509=The swing of right door is not a member of the swing list of right door. ErrorSwingMessages = EgtMsg(50509) MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return False End If ' se sono entrambi sbagliati provo a verificare che non siano invertite le ante If Index_1 < 0 OrElse Index_2 < 0 Then If Not IsNothing(m_Door2) Then Index_1 = OptionModule.m_SwingTypeListLeftDoor.FindIndex(Function(sValue) Trim(sValue) = Trim(m_Door2.Swing)) End If If Not IsNothing(m_Door1) Then Index_2 = OptionModule.m_SwingTypeListRightDoor.FindIndex(Function(sValue) Trim(sValue) = Trim(m_Door1.Swing)) End If ' verifico i risultati ottenuti If (Index_1 > -1 AndAlso Index_2 > -1) Then ' 50510=The swing of left door is on the right door and viceverse. ErrorSwingMessages = EgtMsg(50510) MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return False ElseIf (Index_1 < 0 AndAlso Index_2 > -1) Then ' 50511=The swing of left door is not a member of the swing list of left door. ErrorSwingMessages = EgtMsg(50511) MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return False ElseIf (Index_1 > -1 AndAlso Index_2 < 0) Then ' 50512=The swing of right door is not a member of the swing list of right door. ErrorSwingMessages = EgtMsg(50512) MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return False Else ' 50514=The swing are absolutly wrong! ErrorSwingMessages = EgtMsg(50514) MessageBox.Show(ErrorSwingMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return False End If End If Return True End Select Return False End Function ' controllo degli oggetti caricati nell'assemblato Private Function ControlAssemblyInformation() As Boolean Dim ErrorMessages As String = String.Empty Select Case bOk Case ResultReadingAssembInfo.CorrectAssembInfo If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then ' 50520=The current ddf is an assembly ErrorMessages = EgtMsg(50520) MessageBox.Show(ErrorMessages, EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning) Return True End If ' verifico se è un assemblato If ListPartDoor.Count < 4 And ListPartDoorOfDoor.Count > 0 Then ' 50516=The ddf does not contains jambs! ErrorMessages = EgtMsg(50516) Dim sVal As String = Utility.DoubleToString(ListPartDoor.Count, 0) MessageBox.Show(String.Format(ErrorMessages, sVal), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning) Return True End If If ListPartDoor.Count < 4 And ListPartDoorOfDoor.Count = 0 Then ' 50517=The current ddf does not contains doors! ErrorMessages = EgtMsg(50517) MessageBox.Show(ErrorMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return False End If Case ResultReadingAssembInfo.MissingAssembInfo ' verifico se è un assemblato If ListPartDoor.Count < 4 And ListPartDoorOfDoor.Count > 0 Then If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return True ' 50518=The current ddf is not an assembly. ErrorMessages = EgtMsg(50518) MessageBox.Show(ErrorMessages, EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning) Return True End If ' verifico che se è una porta singola oppure un assemblato vecchio If ListPartDoor.Count < 4 And ListPartDoorOfDoor.Count = 0 Then ' 50519=Impossible to open a ddf with no doors. ErrorMessages = EgtMsg(50519) MessageBox.Show(ErrorMessages, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) Return False End If If OptionModule.m_ConfigurationSoftware = ConfigType.Door AndAlso ListPartDoor.Count > 4 Then ' 50520=The current ddf is an assembly ErrorMessages = EgtMsg(50520) MessageBox.Show(ErrorMessages, EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning) Return True End If Case Else Return False End Select Return True End Function Public Function ControlAssembly(Optional ByVal bSaving As Boolean = False) As String ' se è una porta singola oppure le info generali non sono state caricate correttamente non controllo l'assemblato If bSaving Then If bOk <> ResultReadingAssembInfo.MissingAssembInfo Then Return String.Empty Else If bOk = ResultReadingAssembInfo.ErrorInAssembInfo OrElse bOk = ResultReadingAssembInfo.MissingAssembInfo Then Return String.Empty End If Dim WritingError As String = String.Empty Dim DoorTypeList As String = String.Empty If ListPartDoor.Count < 3 Then For Each ItemPart In ListPartDoor DoorTypeList &= " ," & ItemPart.Door.TypePart Next DoorTypeList = DoorTypeList.Remove(1, 1) WritingError = String.Format(EgtMsg(50505), DoorTypeList) End If Return WritingError End Function #Region "Associazione delle compo lette da ddf" Public Sub MatchCompo() If IsNothing(m_Door1) Then Return For Each ItemDoor In ListPartDoorOfDoor If Not IsNothing(m_JambL) Then ResearchMatchJamb(ItemDoor.Door, m_JambL) If Not IsNothing(m_JambR) Then ResearchMatchJamb(ItemDoor.Door, m_JambR) If Not IsNothing(m_JambT) Then ResearchMatchJamb(ItemDoor.Door, m_JambT) If Not IsNothing(m_JambB) Then ResearchMatchJamb(ItemDoor.Door, m_JambB) Next If Not IsNothing(m_Door2) Then ResearchMatchDoor(m_Door1, m_Door2) ResearchMatchDoor(m_Door2, m_Door1) SetDoorNumber("2") Else SetDoorNumber("1") End If 'For IndexDoor As Integer = 0 To CInt(DoorNumber) - 1 ' ResearchMatchJamb(GetArrayPartDoor(IndexDoor).Door, Map.refAssemblyPageVM.CurrAssembly.LeftJamb) ' ResearchMatchJamb(GetArrayPartDoor(IndexDoor).Door, Map.refAssemblyPageVM.CurrAssembly.RightJamb) ' ResearchMatchJamb(GetArrayPartDoor(IndexDoor).Door, Map.refAssemblyPageVM.CurrAssembly.TopJamb) ' ResearchMatchJamb(GetArrayPartDoor(IndexDoor).Door, Map.refAssemblyPageVM.CurrAssembly.BottomJamb) 'Next 'If CInt(DoorNumber) > 1 Then ' ResearchMatchDoor(GetArrayPartDoor(0).Door, GetArrayPartDoor(1).Door) ' ResearchMatchDoor(GetArrayPartDoor(1).Door, GetArrayPartDoor(0).Door) 'End If End Sub Private Sub ResearchMatchJamb(Door As Part, Jamb As Part) For IndexCompo As Integer = 0 To Door.CompoList.Count - 1 If Not String.IsNullOrEmpty(Door.CompoList(IndexCompo).IdCode) Then ' cerco l'associazione delle compo 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) Door.CompoList(IndexCompo).refJambCompo.IsReadOnly = False Door.CompoList(IndexCompo).IsReadOnly = True If Not LoadCompoParam(Door.CompoList(IndexCompo), Door.TypePart) Then Return For IndexParam As Integer = 0 To Door.CompoList(IndexCompo).refJambCompo.CompoParamList.Count - 1 Dim CmpPar As CompoParam = Door.CompoList(IndexCompo).CompoParamList(IndexParam) Dim CmpRefPar As CompoParam = Door.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam) If TypeOf CmpRefPar Is TextBoxParam Then Dim TBoxPar As TextBoxParam = DirectCast(CmpPar, TextBoxParam) Dim TBoxRefPar As TextBoxParam = DirectCast(CmpRefPar, TextBoxParam) CalcCompoParamVisibility(TBoxPar.DDFName, TBoxRefPar.IsReadOnly) TBoxPar.IsReadOnly = True ElseIf TypeOf CmpRefPar Is TextBoxOnOffParam Then Dim TBoxPar As TextBoxOnOffParam = DirectCast(CmpPar, TextBoxOnOffParam) Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(CmpRefPar, TextBoxOnOffParam) CalcCompoParamVisibility(TBoxPar.DDFName, TBoxRefPar.IsReadOnly) TBoxPar.IsReadOnly = True ElseIf TypeOf CmpRefPar Is ComboBoxParam Then Dim TBoxPar As ComboBoxParam = DirectCast(CmpPar, ComboBoxParam) Dim TBoxRefPar As ComboBoxParam = DirectCast(CmpRefPar, ComboBoxParam) CalcCompoParamVisibility(TBoxPar.DDFName, TBoxRefPar.IsReadOnly) TBoxPar.IsReadOnly = True End If Next ResetCompoParam() Exit For End If Next Else Door.CompoList(IndexCompo).IsReadOnly = True End If Next End Sub Private Sub ResearchMatchDoor(DoorActive As Part, DoorInactive As Part) If Not DoorActive.SwingAlias.Name.Contains(ConstGen.INACTIVE) Then For IndexCompo As Integer = 0 To DoorActive.CompoList.Count - 1 If Not String.IsNullOrEmpty(DoorActive.CompoList(IndexCompo).IdCode) Then For IndexCompoInactiveDoor As Integer = 0 To DoorInactive.CompoList.Count - 1 If DoorInactive.CompoList(IndexCompoInactiveDoor).IdCode = DoorActive.CompoList(IndexCompo).IdCode Then DoorActive.CompoList(IndexCompo).refJambCompo = DoorInactive.CompoList(IndexCompoInactiveDoor) DoorActive.CompoList(IndexCompo).refJambCompo.IsReadOnly = False DoorActive.CompoList(IndexCompo).IsReadOnly = True If Not LoadCompoParam(DoorActive.CompoList(IndexCompo), DoorActive.TypePart) Then Return For IndexParam As Integer = 0 To DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList.Count - 1 Dim CmpPar As CompoParam = DoorActive.CompoList(IndexCompo).CompoParamList(IndexParam) Dim CmpRefPar As CompoParam = DoorActive.CompoList(IndexCompo).refJambCompo.CompoParamList(IndexParam) If TypeOf CmpRefPar Is TextBoxParam Then Dim TBoxPar As TextBoxParam = DirectCast(CmpPar, TextBoxParam) Dim TBoxRefPar As TextBoxParam = DirectCast(CmpRefPar, TextBoxParam) CalcCompoParamVisibility(TBoxPar.DDFName, TBoxRefPar.IsReadOnly) TBoxPar.IsReadOnly = True ElseIf TypeOf CmpRefPar Is TextBoxOnOffParam Then Dim TBoxPar As TextBoxOnOffParam = DirectCast(CmpPar, TextBoxOnOffParam) Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(CmpRefPar, TextBoxOnOffParam) CalcCompoParamVisibility(TBoxPar.DDFName, TBoxRefPar.IsReadOnly) TBoxPar.IsReadOnly = True ElseIf TypeOf CmpRefPar Is ComboBoxParam Then Dim TBoxPar As ComboBoxParam = DirectCast(CmpPar, ComboBoxParam) Dim TBoxRefPar As ComboBoxParam = DirectCast(CmpRefPar, ComboBoxParam) CalcCompoParamVisibility(TBoxPar.DDFName, TBoxRefPar.IsReadOnly) TBoxPar.IsReadOnly = True End If Next ResetCompoParam() Exit For End If Next Else DoorActive.CompoList(IndexCompo).IsReadOnly = True End If Next End If End Sub #End Region ' Associazione delle compo lette da ddf #End Region ' Lettura Assemblato #Region "RULES ASSEMBLY" #Region "CreateRefCompo" ' questo metodo è chiamato dalla proprietà CompoBtn nella classe CompoPanelVM ' dopo aver aggiunto una componente da pulsantiera viene chiamato questo metodo che costruisce il riferimento ' o anche solo esegue la modifica dell'associzaione Public Function CreateCompoOnJamb(ByRef CurrCompo As Compo, Optional sSide As String = "") As Boolean ' se è la configurazione è di songola porta allora interrompi la costruzione If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return False ' nome del file da caricare da tabella Matchting.ini Dim FrameFile As String = String.Empty ' percorso del file di configurazione del file caricato da tabella (da costruire) Dim FrameFileConfig As String = String.Empty ' numero di ante presenti nel progetto corrente Dim nDoorNbr As Integer = 1 ' cerco nella configurazione della componente sulla porta il parametro Side Dim Side As String = String.Empty If Not String.IsNullOrEmpty(sSide) Then Side = sSide ' se non è stato passato nessun termine che specfica il lato allora lo cerco nella configurazione If String.IsNullOrEmpty(Side) Then GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, Side, CurrCompo.CompoType.Path & "\" & CONFIGINI_FILE_NAME) If String.IsNullOrEmpty(Side) Then ' controllo nell'elenco dei parametri se esiste un parametro di tipo Side For IndexParam As Integer = 0 To CurrCompo.CompoParamList.Count - 1 If CurrCompo.CompoParamList(IndexParam).DDFName.ToLower = K_SIDE.ToLower Then Side = DirectCast(CurrCompo.CompoParamList(IndexParam), ComboBoxParam).SelItem Exit For End If Next End If ' a questo punto ricerco nella lista delle associazioni se esite il frame sul quale costruire il riferimento ' converto la posizione letta in valore numerico ' queste associazioni funzionano sulle ante, per i Jamb non ho studiato una conversione If IsNothing(Map.refPartPageVM.CurrPart) Then Return False Dim nSide As Integer = 0 Select Case Side Case "Lock" ' se è LeftHand If Map.refPartPageVM.CurrPart.SwingAlias.Name.Contains("L") Then nSide = 100 Else nSide = 300 End If Case "Hinge" If Map.refPartPageVM.CurrPart.SwingAlias.Name.Contains("L") Then nSide = 300 Else nSide = 100 End If Case "Top" nSide = 200 Case "Bottom" nSide = 400 End Select ' ricerco il PartDoor Corrente Dim refPartDoor As PartDoor = Nothing ' ricerco il PartDoor Corrente 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 ' se non è stata trovata nessuna associazione esco If IsNothing(refPartDoor) Then Return False ' verifico che il nome non sia scritto direttamente nel file lua Dim CurrDoorHArdwareFile As String = CurrCompo.CompoType.Path & "\" & CurrCompo.TemplateSelItem If Path.GetExtension(CurrDoorHArdwareFile) <> NGE_EXTENSION Then CurrDoorHArdwareFile &= LUA_EXTENSION End If If File.Exists(CurrDoorHArdwareFile) Then Dim ReadCurrCompo() As String = File.ReadAllLines(CurrDoorHArdwareFile) For LineIndex = 0 To ReadCurrCompo.Count - 1 ' cerco il titolo [Match File]: se lo trovo 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 ' quando termino il ciclo while posso uscire anche dal for Exit For End If Next End If ' se non esiste nessun accoppiamento allora esco ed elimino la componente If FrameFile.Contains("None") Then If Not IsNothing(CurrCompo.refJambCompo) Then Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo, True) CurrCompo.refJambCompo = Nothing End If ' 50144 =Warning, 50166 =Jamb compo does not exist MessageBox.Show(EgtMsg(50166), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning) 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 ' elimino la componente di riferimento If Not IsNothing(CurrCompo.refJambCompo) Then Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo, True) CurrCompo.refJambCompo = Nothing End If Return False End If ' 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 Map.refPartPageVM.CurrPart.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) ' se non esiste una componente di riferiento, allora deve essere creata per la prima volta 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) CurrCompo.refJambCompo.refCompoDoor = CurrCompo End If ' setto il nome della componente da caricare If Not IsNothing(CurrCompo.refJambCompo) Then CurrCompo.refJambCompo.SplitBrandFile(FrameFile) Else MessageBox.Show("File '" & FrameFile & "' exist, but it is not in the correct Directory!", EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning) 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, Map.refPartPageVM.CurrPart.TypePart) Then UpDateCurrCompoJamb(CurrCompo, Map.refPartPageVM.CurrPart.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 Return True End Function #End Region ' CreateRefCompo ' 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 ElseIf ListPartDoor(IndexPartDoor).Type.Contains("FB_") Then m_JambB = ListPartDoor(IndexPartDoor).Door ElseIf ListPartDoor(IndexPartDoor).Type.Contains("FL_") Then m_JambL = ListPartDoor(IndexPartDoor).Door ElseIf ListPartDoor(IndexPartDoor).Type.Contains("FR_") Then m_JambR = ListPartDoor(IndexPartDoor).Door ElseIf ListPartDoor(IndexPartDoor).Type.Contains("DO_1") Then m_Door1 = ListPartDoor(IndexPartDoor).Door ElseIf ListPartDoor(IndexPartDoor).Type.Contains("DO_2") Then m_Door2 = ListPartDoor(IndexPartDoor).Door End If Next NotifyPropertyChanged("JambExists") End Sub Public ReadOnly Property JambExists As Boolean Get If Not IsNothing(m_JambL) AndAlso Not IsNothing(m_JambR) AndAlso Not IsNothing(m_JambT) Then Return True End If Return False End Get End Property ' gestisce la chimata delle funzioni a seconda della modifica eseguita #Region "DIMENSIONING" ' Durante la costruzione di un nuovo assemblato, oppure quando viene aggiunta/rimossa un'anta ' una volta creata la prima porta questa funzione calcola le dimensioni del telaio Public Sub SetNewDimensionAssembly() ' permette di creare una copia degli oggetti di tipo PartDoor presenti nell'assemblato SetPartDoorCurrAssembly() ' se non esiste la prima porta allora non calcolo le dimensioni del telaio If IsNothing(m_Door1) Then Return ' i parametri che devono ancora essere definiti affinchè funzioni tutto sono ' Size, Swing, Rabbet If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return SwingJamb() HeightJamb() TopBottomWidth() HeightDoor() TopRabbetJamb() HingeRabbetJamb() BottomRabbetJamb() End Sub ' riceve il nome del parametro modificato ed associa la funzione per il ridimensionamento Public Sub SetDimension(sParameter As String, Optional CurrCompo As Compo = Nothing) If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return ' riceve il nome della modifica, e indirizza la funzione preposta alla modifica Select Case sParameter Case "CreateRefCompo" If BuiltReffCompo Then CreateCompoOnJamb(CurrCompo) Case "JambIsCheked" Map.refAssemblyManagerVM.CreateJamb(Me, False) Map.refAssemblyManagerVM.LoadOM_M_ET(Me) Map.refAssemblyManagerVM.CreateAssociation(Me) SetNewDimensionAssembly() ' UpDateAllCompo() Map.refSceneManagerVM.RefreshBtn() Case "Height" HeightJamb() HeightDoor() TopRabbetJamb() BottomRabbetJamb() HingeRabbetJamb() SetVarAssembly() UpDateAllCompo() Case "Width" TopBottomWidth() TopRabbetJamb() BottomRabbetJamb() HingeRabbetJamb() SetVarAssembly() UpDateAllCompo() Case "Thickness" TopRabbetJamb() UpDateAllCompo() Case "Swing" UpDateCompolistOnJamb() SwingJamb() UpDateAllCompo() Case "DoorNumber" ClearRefOnAssembly() SetPartDoorCurrAssembly() ReverseDoor() Map.refAssemblyManagerVM.CreateDoor(Me) Map.refAssemblyManagerVM.CreateAssociation(Me) SetPartDoorCurrAssembly() SetVarAssembly() ReloadAllCompoDoor1() ReverseDoor() UpDateAllCompo() TopBottomWidth() SwingJamb() HeightDoor() TopRabbetJamb() End Select End Sub #End Region ' Dimensioning #Region "UpDateRefCompo" Public Sub CreateAssembly() If ListPartDoorOfDoor.Count < 1 Then Return 'If Not JambExists Then SetDimension("JambIsCheked") Select Case ListPartDoorOfDoor.Count Case 1 Dim IndexCompo As Integer = 0 Dim EndIndex As Integer = m_Door1.CompoList.Count For IndexCompo = 0 To EndIndex - 1 CreateCompoOnJamb(m_Door1.CompoList(IndexCompo)) Next Case 2 Case Else End Select End Sub ' è chiamata ogni volta che viene modificato un parametro del general dell'assemblato Public Sub UpDateAllCompo() 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 UpDateCurrCompoJamb(CurrCompo, ListPartDoorOfDoor(IndexDoor).Door.TypePart) 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 End If Next Next End Sub ' Ricevuta la componente Compo aggiorna la refCompo Public Sub UpDateCurrCompoJamb(ByRef CurrCompo As Compo, ByRef sCurrTypeDoor As String) CurrCompo.refJambCompo.IsReadOnly = False ' devo distinguere il caso della componente sulla porta o sul jamb ' se il numero di elementi presenti nella lista riferita al jamb sono diversi da quelli riferiti all'anta If CurrCompo.refJambCompo.CompoParamList.Count <> CurrCompo.CompoParamList.Count Then Return ' se il primo controllo è andato a buon fine passo al caricamento dei dati For IndexParam As Integer = 0 To CurrCompo.refJambCompo.CompoParamList.Count - 1 If TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxParam 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 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, 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 ' l'unica operazione che eseguo è di abilitare la combobox DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), ComboBoxParam).IsReadOnly = False ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam 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 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, CurrCompo.refJambCompo.ConfigurationParameters) End If 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 For IndexParam As Integer = 0 To PrecCompo.CompoParamList.Count - 1 If TypeOf PrecCompo.CompoParamList(IndexParam) Is TextBoxParam AndAlso PrecCompo.CompoParamList(IndexParam).DDFName = NewCompo.CompoParamList(IndexParam).DDFName Then Dim TBoxPar As TextBoxParam = DirectCast(PrecCompo.CompoParamList(IndexParam), TextBoxParam) Dim TBoxNewPar As TextBoxParam = DirectCast(NewCompo.CompoParamList(IndexParam), TextBoxParam) TBoxNewPar.Value = TBoxPar.Value ElseIf TypeOf PrecCompo.CompoParamList(IndexParam) Is ComboBoxParam AndAlso PrecCompo.CompoParamList(IndexParam).DDFName = NewCompo.CompoParamList(IndexParam).DDFName Then Dim CBoxPar As ComboBoxParam = DirectCast(PrecCompo.CompoParamList(IndexParam), ComboBoxParam) Dim CBoxNewPar As ComboBoxParam = DirectCast(NewCompo.CompoParamList(IndexParam), ComboBoxParam) CBoxNewPar.SelItem = CBoxNewPar.ItemList(CBoxNewPar.ItemList.IndexOf(CBoxPar.SelItem)) ElseIf TypeOf PrecCompo.CompoParamList(IndexParam) Is TextBoxOnOffParam AndAlso PrecCompo.CompoParamList(IndexParam).DDFName = NewCompo.CompoParamList(IndexParam).DDFName Then Dim TBoxPar As TextBoxOnOffParam = DirectCast(PrecCompo.CompoParamList(IndexParam), TextBoxOnOffParam) Dim TBoxNewPar As TextBoxOnOffParam = DirectCast(NewCompo.CompoParamList(IndexParam), TextBoxOnOffParam) TBoxNewPar.Value = TBoxPar.Value TBoxNewPar.IsActive = TBoxPar.IsActive ElseIf TypeOf PrecCompo.CompoParamList(IndexParam) Is ComboBoxOnOffParam AndAlso PrecCompo.CompoParamList(IndexParam).DDFName = NewCompo.CompoParamList(IndexParam).DDFName Then Dim CBoxPar As ComboBoxOnOffParam = DirectCast(PrecCompo.CompoParamList(IndexParam), ComboBoxOnOffParam) Dim CBoxNewPar As ComboBoxOnOffParam = DirectCast(NewCompo.CompoParamList(IndexParam), ComboBoxOnOffParam) CBoxNewPar.SelItem = CBoxNewPar.ItemList(CBoxPar.ItemList.IndexOf(CBoxPar.SelItem)) CBoxNewPar.IsActive = CBoxPar.IsActive End If Next End Sub #End Region ' UpDateRefCompo #Region "HEIGHT" ' calcola l'altezza dei JambLeft e JambRight Public Sub HeightJamb() ' se ho impostanto l'area di lavoro non modifico l'altezza dei jamb If Dimension Then If Not IsNothing(m_JambL) Then m_JambL.SetHeight(m_AssemblyHeight) If Not IsNothing(m_JambR) Then m_JambR.SetHeight(m_AssemblyHeight) Return End If ' vericfico che almeno uno su due esista If (IsNothing(m_JambL) OrElse IsNothing(m_JambR)) AndAlso IsNothing(m_Door1) Then Return ' se almeno un jamb esiste continuo Dim dLightUp As Double Dim dLightBottom As Double Dim dThicknessHead As Double Dim dHeight As Double Dim dOverlapTop As Double Dim dThichknessJamb As Double StringToDouble(LightUp, dLightUp) StringToDouble(LightBottom, dLightBottom) StringToDouble(ThicknessHead, dThicknessHead) ' la modifica dell'altezza può arrivare solo da un'anta If IsNothing(Map.refPartPageVM.CurrPart) OrElse Not Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then StringToDouble(m_Door1.Height, dHeight) Else StringToDouble(Map.refPartPageVM.CurrPart.Height, dHeight) End If StringToDouble(OverlapTop, dOverlapTop) StringToDouble(Width, dThichknessJamb) Dim HJamb As Double = dLightBottom + dHeight + dLightUp + dThicknessHead Dim HJambExterior As Double = HJamb + dThichknessJamb - dOverlapTop ' se è exterior If Map.refAssemblyPageVM.CurrAssembly.Exterior Then If Not IsNothing(m_JambL) Then m_JambL.SetHeight(DoubleToString(HJambExterior, 4)) If Not IsNothing(m_JambR) Then m_JambR.SetHeight(DoubleToString(HJambExterior, 4)) Else If Not IsNothing(m_JambL) Then m_JambL.SetHeight(DoubleToString(HJamb, 4)) If Not IsNothing(m_JambR) Then m_JambR.SetHeight(DoubleToString(HJamb, 4)) End If NotifyPropertyChanged("AssemblyHeight") End Sub ' Ricalcola la dimensione di tutte le porte ricevendo come valore esterno la dimensione della porta modificata Public Sub HeightDoor() Dim HeightDoor As String = String.Empty Dim nTH As Double = 0 Dim nTJ As Double = 0 Dim nLU As Double = 0 Dim nLB As Double = 0 Dim nOLT As Double = 0 StringToDouble(m_LightUp, nLU) StringToDouble(m_LightBottom, nLB) StringToDouble(m_ThicknessHead, nTH) StringToDouble(m_OverlapTop, nOLT) StringToDouble(m_Width, nTJ) ' carico il valore che è stato modificato If Not IsNothing(Map.refPartPageVM.CurrPart) AndAlso Map.refPartPageVM.CurrPart.TypePart.Contains("DO_") Then HeightDoor = Map.refPartPageVM.CurrPart.Height Else ' altrienti prendo quello della prima porta If Not IsNothing(m_Door1) Then HeightDoor = m_Door1.Height Else Return End If End If ' devo verificare che l'altezza che è stata imposta non sia maggiore di quella consentita If Dimension Then Dim nHeightDoor As Double ' se riesco ad eseguire la conversione numerica If StringToDouble(HeightDoor, nHeightDoor) Then Dim nTotalHeight As Double = 0 StringToDouble(m_AssemblyHeight, nTotalHeight) ' dimensiono la porta sempre in funzione delle dimensioni dell'assemblato nHeightDoor = nTotalHeight - (nLU + nLB) - nTH If Exterior Then nHeightDoor = nHeightDoor + nOLT - nTJ End If m_Door1.SetHeight(DoubleToString(nHeightDoor, 4)) HeightDoor = m_Door1.Height End If End If Dim nDN As Integer = 1 Int32.TryParse(m_DoorNumber, nDN) If nDN < 2 Then Return For Each PDOfDoor In ListPartDoorOfDoor PDOfDoor.Door.SetHeight(HeightDoor) Next End Sub ' riassegna il TicnkessHead Public Sub HeightJambTop() Dim nTH As Double = 0 Dim nTJ As Double = 0 Dim nLU As Double = 0 Dim nLB As Double = 0 Dim nOLT As Double = 0 Dim nHD As Double = 0 StringToDouble(m_LightUp, nLU) StringToDouble(m_LightBottom, nLB) StringToDouble(m_ThicknessHead, nTH) StringToDouble(m_OverlapTop, nOLT) StringToDouble(m_Width, nTJ) If Not IsNothing(m_JambT) Then m_JambT.SetHeight(ThicknessHead) End If If IsNothing(m_Door1) Then Return StringToDouble(m_Door1.Height, nHD) If Not Dimension Then Return Dim nTotalHeight As Double = 0 StringToDouble(AssemblyHeight, nTotalHeight) If nTotalHeight < nTH Then nTH = nTotalHeight - (nLU + nLB) - nHD If Exterior Then nTH = nTH + nOLT - nTJ End If ThicknessHead = DoubleToString(nTH, 4) Else nHD = nTotalHeight - (nLU + nLB) - nTH If Exterior Then nHeightDoor = nHD + nOLT - nTJ End If For Each ItemListPDOD In ListPartDoorOfDoor ItemListPDOD.Door.SetHeight(DoubleToString(nHD, 4)) Next End If End Sub #End Region ' Height #Region "WIDTH" ' calcola la larghezza dei jamb orizzonatli Private Sub TopBottomWidth() ' vericfico che almeno uno su tre esista If (IsNothing(m_JambT) OrElse IsNothing(m_JambB)) AndAlso IsNothing(m_Door1) Then Return ' se almeno uno esiste Dim dLightHinge As Double Dim dLightLock As Double Dim dOverlapLock As Double Dim dOverlapHinge As Double Dim dWidth1 As Double Dim dWidth2 As Double Dim dActualWidth As Double StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightHinge, dLightHinge) StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightLock, dLightLock) StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapLock, dOverlapLock) StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapHinge, dOverlapHinge) StringToDouble(m_Door1.Width, dWidth1) Select Case m_DoorNumber Case "1" If Exterior Then dActualWidth = dLightHinge + dLightLock If Not IsNothing(m_JambB) Then m_JambB.SetWidth(DoubleToString(dWidth1 + dActualWidth, 4)) Else dActualWidth = dLightHinge + dLightLock + dOverlapLock + dOverlapHinge End If If Not IsNothing(m_JambT) Then m_JambT.SetWidth(DoubleToString(dWidth1 + dActualWidth, 4)) Case "2" If Not IsNothing(m_Door2) Then StringToDouble(m_Door2.Width, dWidth2) Else ' se la seconda anta non esiste allora devo ridimensionare il progetto ad una sola anta For Each sNumber In m_DoorListNumber If Trim(sNumber) = "1" Then m_DoorNumber = sNumber Return End If Next Return End If ' se la seconda anta esiste allora procedo nel calcolo If Exterior Then dActualWidth = dLightHinge + dLightHinge + dLightLock + dWidth1 If Not IsNothing(m_JambB) Then m_JambB.SetWidth(DoubleToString(dWidth2 + dActualWidth, 4)) Else dActualWidth = dLightHinge + dLightHinge + dLightLock + dOverlapHinge + dOverlapHinge + dWidth1 End If If Not IsNothing(m_JambT) Then m_JambT.SetWidth(DoubleToString(dWidth2 + dActualWidth, 4)) End Select NotifyPropertyChanged("AssemblyWidth") End Sub ' calcola la larghezza dei Jamb laterali Public Sub SetWidthJamb() If Not IsNothing(m_JambR) Then m_JambR.Width = m_Width If Not IsNothing(m_JambL) Then m_JambL.Width = m_Width If Not IsNothing(m_JambB) Then m_JambB.Height = m_Width ' ricalcolo la dimensione dell'anta If Not Dimension Then Return Dim DO_1 As PartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_1") Dim DO_2 As PartDoor = Map.refAssemblyManagerVM.ReserchPartDoor("DO_2") Dim LL As String = LightLock Dim LH As String = LightHinge Dim JW As String = Width Dim TotW As String = m_AssemblyWidth If Not IsNothing(DO_1) Then Dim nDO_1Width As Double = 0 Dim nDO_2Width As Double = 0 StringToDouble(DO_1.Door.Width, nDO_1Width) Dim nJW As Double = 0 StringToDouble(JW, nJW) Dim nLL As Double = 0 StringToDouble(LL, nLL) Dim nLH As Double = 0 StringToDouble(LH, nLH) Dim nTotW As Double = 0 StringToDouble(TotW, nTotW) ' due ante If Not IsNothing(DO_2) Then ' la seconda anta viene ricalcolata mantenedo fissa la dimensione della prima StringToDouble(DO_2.Door.Width, nDO_2Width) nDO_2Width = nTotW - (nLL + nLH * 2 + 2 * nJW + nDO_1Width) If Exterior Then Dim nOLL As Double = 0 StringToDouble(OverlapLock, nOLL) Dim nOLH As Double = 0 StringToDouble(OverlapHinge, nOLH) nDO_2Width = nDO_2Width + 2 * nOLH End If DO_2.Door.SetWidth(DoubleToString(nDO_2Width, 4)) Else ' singol anta nDO_1Width = nTotW - (nLL + nLH + 2 * nJW) If Exterior Then Dim nOLL As Double = 0 StringToDouble(OverlapLock, nOLL) Dim nOLH As Double = 0 StringToDouble(OverlapHinge, nOLH) nDO_1Width = nDO_1Width + nOLH + nOLL End If DO_1.Door.SetWidth(DoubleToString(nDO_1Width, 4)) End If End If 'm_BottomJamb.SetHeight(m_Width) 'm_TopJamb.SetHeight(m_ThicknessHead) 'm_LeftJamb.SetWidth(m_Width) 'm_RightJamb.SetWidth(m_Width) End Sub #End Region ' Width #Region "THICKNESS" ' calcola la dimensione spessore dei Jamb (per tutti lo stesso) Public Sub SetThicKnessJamb() If Not IsNothing(m_JambB) Then m_JambB.Thickness = m_Thickness If Not IsNothing(m_JambT) Then m_JambT.Thickness = m_Thickness If Not IsNothing(m_JambR) Then m_JambR.Thickness = m_Thickness If Not IsNothing(m_JambR) Then m_JambL.Thickness = m_Thickness End Sub #End Region ' Thickness #Region "SWING" ' se sulla porta singola avviene cambio swing (da LeftHand a RightHand) allora devo invertire i Jamb laterali ' se eistono entrambi i Jamb laterali inverto allora li inverto Public Sub UpDateCompolistOnJamb() Dim sSwing1 As SwingItemTypeList = Nothing ' in AssemblyManager ho assegnato ai Jamb la lista completa degli swing For Each Item In OptionModule.m_SwingTypeList If Trim(m_Door1.SwingAlias.AliasName) = Trim(Item) Then OptionModule.SetCurrSwing(sSwing1, Item) Exit For End If Next If IsNothing(sSwing1) Then Return Select Case DoorNumber Case "1" ' passo da un'anta LeftHand ad una RightHand If Not IsNothing(m_JambL) Then If (m_JambL.SwingAlias.Name.Contains("LH") And sSwing1.Name.Contains("RH")) OrElse (m_JambL.SwingAlias.Name.Contains("RH") And sSwing1.Name.Contains("LH")) Then If Not IsNothing(m_JambR) Then 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 If End If End If Case "2" ' passo da un'anta Active ad una Inactive If IsNothing(m_Door2) Then Return ' sicuramente la porta corrente è quella modificata If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_1") Then SwingDoor(m_Door2, m_Door1) Else SwingDoor(m_Door1, m_Door2) End If ' in AssemblyManager ho assegnato ai Jamb la lista completa degli swing For Each Item In OptionModule.m_SwingTypeList If Trim(m_Door1.SwingAlias.AliasName) = Trim(Item) Then OptionModule.SetCurrSwing(sSwing1, Item) Exit For End If Next If Not IsNothing(m_JambL) Then If (m_JambL.SwingAlias.Name.Contains("I") And Not sSwing1.Name.Contains("I")) OrElse (Not m_JambL.SwingAlias.Name.Contains("I") And sSwing1.Name.Contains("I")) Then 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 Not IsNothing(m_JambR) Then 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 End If ' aggiorno le copie presenti nell'assemblato SetPartDoorCurrAssembly() End If If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_1") Then Map.refPartPageVM.CurrPart = m_Door1 Else Map.refPartPageVM.CurrPart = m_Door2 End If End If End Select End Sub ' assegna gli swing ai jamb Public Sub SwingJamb() ' se la prima anta non esiste allora interrompo If IsNothing(m_Door1) Then Return Dim sSwing1 As String = String.Empty ' in AssemblyManager assegno ai Jamb la lista completa degli swing For Each Item In OptionModule.m_SwingTypeList If Trim(m_Door1.SwingAlias.AliasName) = Trim(Item) Then sSwing1 = Item Exit For End If Next Select Case DoorNumber Case "1" If Not IsNothing(m_JambB) Then m_JambB.SetSwing(sSwing1) If Not IsNothing(m_JambT) Then m_JambT.SetSwing(sSwing1) If Not IsNothing(m_JambL) Then m_JambL.SetSwing(sSwing1) If Not IsNothing(m_JambR) Then m_JambR.SetSwing(sSwing1) If Exterior Then ' se di tipo LeftHand If Not IsNothing(m_JambL) AndAlso Not IsNothing(m_JambR) AndAlso m_JambL.SwingAlias.Name.Contains("LH") Then m_JambL.TypePart = ConstGen.PART_FRAME_LEFT & ConstGen.HINGE & ConstGen.EXTERIOR m_JambR.TypePart = ConstGen.PART_FRAME_RIGHT & ConstGen.LOCK & ConstGen.EXTERIOR Else If Not IsNothing(m_JambL) Then m_JambL.TypePart = ConstGen.PART_FRAME_LEFT & ConstGen.LOCK & ConstGen.EXTERIOR If Not IsNothing(m_JambR) Then m_JambR.TypePart = ConstGen.PART_FRAME_RIGHT & ConstGen.HINGE & ConstGen.EXTERIOR End If If Not IsNothing(m_JambB) Then m_JambB.TypePart = ConstGen.PART_FRAME_BOTTOM & ConstGen.BOTTOM & ConstGen.EXTERIOR If Not IsNothing(m_JambT) Then m_JambT.TypePart = ConstGen.PART_FRAME_TOP & ConstGen.TOP & ConstGen.EXTERIOR Else If Not IsNothing(m_JambL) AndAlso Not IsNothing(m_JambR) AndAlso m_JambL.SwingAlias.Name.Contains("LH") Then m_JambL.TypePart = ConstGen.PART_FRAME_LEFT & ConstGen.HINGE m_JambR.TypePart = ConstGen.PART_FRAME_RIGHT & ConstGen.LOCK Else If Not IsNothing(m_JambL) Then m_JambL.TypePart = ConstGen.PART_FRAME_LEFT & ConstGen.LOCK If Not IsNothing(m_JambR) Then m_JambR.TypePart = ConstGen.PART_FRAME_RIGHT & ConstGen.HINGE End If If Not IsNothing(m_JambB) Then m_JambB.TypePart = ConstGen.PART_FRAME_BOTTOM & ConstGen.BOTTOM If Not IsNothing(m_JambT) Then m_JambT.TypePart = ConstGen.PART_FRAME_TOP & ConstGen.TOP End If Case "2" If IsNothing(m_Door2) Then ' se la seconda anta non esiste allora devo ridimensionare il progetto ad una sola anta For Each sNumber In m_DoorListNumber If Trim(sNumber) = "1" Then m_DoorNumber = sNumber Return End If Next Return End If ' sicuramente la porta corrente è quella modificata If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_1") Then SwingDoor(m_Door2, m_Door1) Else SwingDoor(m_Door1, m_Door2) End If ' ricerco nell'elenco degli swing Dim sSwing2 As String = String.Empty ' in AssemblyManager assegno ai Jamb la lista completa degli swing For Each Item In OptionModule.m_SwingTypeList If Trim(m_Door2.SwingAlias.Name) = Trim(Item) Then sSwing2 = Item Exit For End If Next ' assegno gli swing If Not IsNothing(m_JambB) Then m_JambB.SetSwing(sSwing2) If Not IsNothing(m_JambT) Then m_JambT.SetSwing(sSwing1) If Not IsNothing(m_JambL) Then m_JambL.SetSwing(sSwing1) If Not IsNothing(m_JambR) Then m_JambR.SetSwing(sSwing2) ' assegno il nome del tipo completo If Exterior Then If Not IsNothing(m_JambL) Then m_JambL.TypePart = ConstGen.PART_FRAME_LEFT & ConstGen.HINGE & ConstGen.EXTERIOR If Not IsNothing(m_JambR) Then m_JambR.TypePart = ConstGen.PART_FRAME_RIGHT & ConstGen.HINGE & ConstGen.EXTERIOR If Not IsNothing(m_JambB) Then m_JambB.TypePart = ConstGen.PART_FRAME_BOTTOM & ConstGen.BOTTOM & ConstGen.EXTERIOR If Not IsNothing(m_JambT) Then m_JambT.TypePart = ConstGen.PART_FRAME_TOP & ConstGen.TOP & ConstGen.EXTERIOR Else If Not IsNothing(m_JambL) Then m_JambL.TypePart = ConstGen.PART_FRAME_LEFT & ConstGen.HINGE If Not IsNothing(m_JambR) Then m_JambR.TypePart = ConstGen.PART_FRAME_RIGHT & ConstGen.HINGE If Not IsNothing(m_JambB) Then m_JambB.TypePart = ConstGen.PART_FRAME_BOTTOM & ConstGen.BOTTOM If Not IsNothing(m_JambT) Then m_JambT.TypePart = ConstGen.PART_FRAME_TOP & ConstGen.TOP End If End Select End Sub ' 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 ' inverte la prima anta con la seconda anta 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. ' riceve l'anta da modificare (ModifySwingDoor) e l'anta che comanda la modifica (ModifiedSwingDoor) Public Sub SwingDoor(ModifySwingDoor As Part, ModifiedSwingDoor As Part) If Not IsNothing(ModifiedSwingDoor) AndAlso Not IsNothing(ModifiedSwingDoor) Then For IndexSwing As Integer = 0 To ModifiedSwingDoor.SwingTypeList.Count - 1 If ModifiedSwingDoor.Swing = ModifiedSwingDoor.SwingTypeList(IndexSwing) Then ModifySwingDoor.SetSwing(ModifySwingDoor.SwingTypeList(IndexSwing)) Exit For End If Next End If End Sub #End Region ' Swing Public Sub RefreshJambCheck() For Each Item In ListPartDoor If Item.Door.TypePart.Contains("FL_") Then JambLIsChecked = Item.Door.IsActive ElseIf Item.Door.TypePart.Contains("FT_") Then JambTIsChecked = Item.Door.IsActive ElseIf Item.Door.TypePart.Contains("FB_") Then JambBIsChecked = Item.Door.IsActive ElseIf Item.Door.TypePart.Contains("FT_") Then JambTIsChecked = Item.Door.IsActive End If Next End Sub ' definisc le costanti dell'assemblato Public Sub SetVarAssembly() Dim dHeight As Double Dim dWidth As Double Dim dThickness As Double If Not IsNothing(m_Door1) Then If Not IsNothing(m_Door1.Height) AndAlso StringToDouble(m_Door1.Height, dHeight) Then EgtLuaSetGlobNumVar("H", dHeight) EgtLuaSetGlobNumVar("H1", dHeight) End If If Not IsNothing(m_Door1.Width) AndAlso StringToDouble(m_Door1.Width, dWidth) Then EgtLuaSetGlobNumVar("W", dWidth) EgtLuaSetGlobNumVar("W1", dWidth) End If If Not IsNothing(m_Door1.Thickness) AndAlso StringToDouble(m_Door1.Thickness, dThickness) Then EgtLuaSetGlobNumVar("T", dThickness) EgtLuaSetGlobNumVar("T1", dThickness) End If End If If Not IsNothing(m_Door2) Then If Not IsNothing(m_Door2.Height) AndAlso StringToDouble(m_Door2.Height, dHeight) Then EgtLuaSetGlobNumVar("H2", dHeight) End If If Not IsNothing(m_Door2.Width) AndAlso StringToDouble(m_Door2.Width, dWidth) Then EgtLuaSetGlobNumVar("W2", dWidth) End If If Not IsNothing(m_Door2.Thickness) AndAlso StringToDouble(m_Door2.Thickness, dThickness) Then EgtLuaSetGlobNumVar("T2", dThickness) End If End If End Sub #Region "RABBET" ' clacola il rabbet sul profilo top dei Jamb (quindi solo su quelli laterali) Public Sub TopRabbetJamb() Dim sThicknessHead As String = Map.refAssemblyPageVM.CurrAssembly.ThicknessHead Dim sOverlapHinge As String = Map.refAssemblyPageVM.CurrAssembly.OverlapHinge Dim sOverLapLock As String = Map.refAssemblyPageVM.CurrAssembly.OverlapLock Dim sLightUp As String = Map.refAssemblyPageVM.CurrAssembly.LightUp Select Case DoorNumber Case "1" If Not m_JambL.SwingAlias.Name.Contains("L") Then If Not IsNothing(m_JambL) Then SetTopRabbetJamb(m_JambL, sThicknessHead, sOverLapLock, sLightUp) If Not IsNothing(m_JambR) Then SetTopRabbetJamb(m_JambR, sThicknessHead, sOverlapHinge, sLightUp) Else If Not IsNothing(m_JambL) Then SetTopRabbetJamb(m_JambL, sThicknessHead, sOverlapHinge, sLightUp) If Not IsNothing(m_JambR) Then SetTopRabbetJamb(m_JambR, sThicknessHead, sOverLapLock, sLightUp) End If Case "2" SetTopRabbetJamb(m_JambL, sThicknessHead, sOverlapHinge, sLightUp) SetTopRabbetJamb(m_JambR, sThicknessHead, sOverlapHinge, sLightUp) End Select End Sub ' ricerca la componente Rabbet, se non esiete la aggiunge e poi la modifica, altrimenti la modifica Private Sub SetTopRabbetJamb(ByRef Jamb As Part, sThicknessHead As String, sOverlap As String, sLightUp As String) If IsNothing(Jamb) Then Return Dim CurrCompo As Compo = Nothing Dim IndexCompoPanel As Integer = -1 ' ricerco la posizione del rabbet nella lista dei componenti For Index As Integer = 0 To Map.refCompoPanelVM.CompoTypeList.Count - 1 If Trim(Map.refCompoPanelVM.CompoTypeList(Index).DDFName) = "rabbet" Then IndexCompoPanel = Index Exit For End If Next ' se la ricerca ha dato un esito positivo allora procedo If IndexCompoPanel = -1 Then Return Dim bRabbet As Boolean = False Dim IndexCompo As Integer ' se esistenon delle componenti allora cerco la componente rabbet If Jamb.CompoList.Count > 0 Then ' inizio la ricerca della componente di tipo rabbet For IndexCompo = 0 To Jamb.CompoList.Count - 1 If Jamb.CompoList(IndexCompo).CompoType.DDFName = OptionModule.m_CompoPaneOrder(IndexCompoPanel) Then ' controllo che il primo elemento selezionato nella ComboBox sia uguale al primo elemento della lista (questa cosa non mi convince) If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(0) Then CurrCompo = Jamb.CompoList(IndexCompo) bRabbet = True Exit For End If End If Next End If ' se non eiste il rabbet lo aggiungo If Not bRabbet Then Map.refPartPageVM.CurrPart = Jamb CurrCompo = Jamb.AddNewCompo(Map.refCompoPanelVM.CompoTypeList(IndexCompoPanel), True) Else CurrCompo = Jamb.CompoList(IndexCompo) End If ' mofico la componete rabbet If Not IsNothing(CurrCompo) Then SetTopRabbetParam(sThicknessHead, sOverlap, CurrCompo, sLightUp) End Sub ' setta i parametri della componente Rabbet sul top Private Sub SetTopRabbetParam(sThicknessHead As String, sOverlapTop As String, CurrCompo As Compo, sLightUp As String) Dim CurrCompoParam As CompoParam = CurrCompo.CompoParamList(1) If TypeOf CurrCompoParam Is TextBoxParam Then Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam) TextParam.m_Value = sThicknessHead TextParam.NotifyPropertyChanged("Value") End If CurrCompoParam = CurrCompo.CompoParamList(2) If TypeOf CurrCompoParam Is TextBoxParam Then Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam) Dim sRabbetDepth As String = sOverlapTop TextParam.m_Value = sRabbetDepth TextParam.NotifyPropertyChanged("Value") End If CurrCompoParam = CurrCompo.CompoParamList(3) If TypeOf CurrCompoParam Is TextBoxOnOffParam Then Dim TextParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam) TextParam.SetIsActive(False) TextParam.NotifyPropertyChanged("Value") End If End Sub ' calcola il rabbet sul lato Bottom solo se è stata selezionata la proprietà exterior Public Sub BottomRabbetJamb() Dim sThicknessDoor As String If IsNothing(m_Door1) Then sThicknessDoor = m_Door1.Thickness Else sThicknessDoor = "0" End If Dim sOverLapHinge As String = Map.refAssemblyPageVM.CurrAssembly.OverlapHinge Dim sOverLapLock As String = Map.refAssemblyPageVM.CurrAssembly.OverlapLock Dim sOverLapTop As String = Map.refAssemblyPageVM.CurrAssembly.OverlapTop Dim sWidthJamb As String = Map.refAssemblyPageVM.CurrAssembly.Width Dim IndexBottom As Integer = 1 Select Case DoorNumber Case "1" If Not m_JambL.SwingAlias.Name.Contains(ConstGen.LOCK) Then RabbetExterior(m_JambL, sThicknessDoor, sWidthJamb, sOverLapLock, IndexBottom) RabbetExterior(m_JambR, sThicknessDoor, sWidthJamb, sOverLapHinge, IndexBottom) Else RabbetExterior(m_JambL, sThicknessDoor, sWidthJamb, sOverLapHinge, IndexBottom) RabbetExterior(m_JambR, sThicknessDoor, sWidthJamb, sOverLapLock, IndexBottom) End If Case "2" RabbetExterior(m_JambL, sThicknessDoor, sWidthJamb, sOverLapHinge, IndexBottom) RabbetExterior(m_JambR, sThicknessDoor, sWidthJamb, sOverLapHinge, IndexBottom) End Select End Sub ' calcola il rabbet sul lato Hinge solo se è stata selezionata la proprietà exterior Public Sub HingeRabbetJamb() Dim sThicknessDoor As String If Not IsNothing(m_Door1) Then sThicknessDoor = m_Door1.Thickness Else sThicknessDoor = "0" End If Dim sDeltaT As String = Map.refAssemblyPageVM.CurrAssembly.DeltaThickness Dim sOverLapHinge As String = Map.refAssemblyPageVM.CurrAssembly.OverlapHinge Dim sOverLapLock As String = Map.refAssemblyPageVM.CurrAssembly.OverlapLock Dim sOverLapTop As String = Map.refAssemblyPageVM.CurrAssembly.OverlapTop ' questo flag, che è poi passato alla funzione RabbetExterior, ha lo scopo di identificare chi sta esegunedo la chiamata Dim IndexHinge As Integer = 2 Select Case DoorNumber Case "1" If Not m_JambL.SwingAlias.Name.Contains(ConstGen.LOCK) Then RabbetExterior(m_JambL, sThicknessDoor, sDeltaT, sOverLapLock, IndexHinge) RabbetExterior(m_JambR, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge) RabbetExterior(m_JambT, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge) Else RabbetExterior(m_JambL, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge) RabbetExterior(m_JambR, sThicknessDoor, sDeltaT, sOverLapLock, IndexHinge) RabbetExterior(m_JambT, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge) End If Case "2" RabbetExterior(m_JambL, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge) RabbetExterior(m_JambR, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge) RabbetExterior(m_JambT, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge) End Select End Sub ' cerca la compo Rabbet sul lato indicato (Top o Bottom) Public Sub RabbetExterior(ByRef Jamb As Part, sThicknessDoor As String, sDeltaT As String, sOverLap As String, nIndexSide As Integer) If IsNothing(Jamb) Then Return 'Dim IndexHinge As Integer = 2 'Dim IndexBottom As Integer = 1 Dim CompoListIndex As Integer = Map.refCompoPanelVM.CompoTypeList.Count - 1 Dim Local_Compo As Compo Dim bRabbet As Boolean = False Dim IndexCompo As Integer ' cerco la componente If Jamb.CompoList.Count > 0 Then For IndexCompo = 0 To Jamb.CompoList.Count - 1 If Jamb.CompoList(IndexCompo).CompoType.DDFName = Map.refCompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(nIndexSide) Then bRabbet = True Exit For End If End If Next End If If m_Exterior Then ' se il rabbet non esiste If Not bRabbet Then ' lo aggiungo Local_Compo = Jamb.AddNewCompo(Map.refCompoPanelVM.CompoTypeList(CompoListIndex), True) DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).SetSelItem(DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).ItemList(nIndexSide)) Else Local_Compo = Jamb.CompoList(IndexCompo) End If If Not IsNothing(Local_Compo) Then SetHingeRabbetParam(sThicknessDoor, sDeltaT, sOverLap, Local_Compo, nIndexSide) Else ' rimuovo dalla lista If bRabbet Then Jamb.CompoList.RemoveAt(IndexCompo) End If End Sub ' assegna i valori ai parametri del rabbet Private Sub SetHingeRabbetParam(sThicknessDoor As String, sDeltaT As String, sOverlap As String, CurrCompo As Compo, IndexSide As Integer) Dim dThicknessDoor As Double Dim dDeltaT As Double StringToDouble(sThicknessDoor, dThicknessDoor) StringToDouble(sDeltaT, dDeltaT) Select Case IndexSide ' se è stata passata sul lato cerniera/serrattura Case 2 Dim CurrCompoParam As CompoParam = CurrCompo.CompoParamList(0) Dim Index As Integer = 0 ' width CurrCompoParam = CurrCompo.CompoParamList(1) If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxParam Then Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam) ' definisce l'affondamento della porta nel telaio TextParam.m_Value = DoubleToString(dDeltaT + dThicknessDoor, 4) TextParam.NotifyPropertyChanged("Value") End If ' depth CurrCompoParam = CurrCompo.CompoParamList(2) If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxParam Then Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam) Dim sRabbetDepth As String = sOverlap ' la profondità deve essere la stessa che è stata definita sul rabbet top TextParam.m_Value = sRabbetDepth TextParam.NotifyPropertyChanged("Value") End If ' angle CurrCompoParam = CurrCompo.CompoParamList(3) If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxOnOffParam Then Dim TextOnOffParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam) ' disaativo il paramtro Angle TextOnOffParam.SetIsActive(False) TextOnOffParam.NotifyPropertyChanged("Value") End If Case 1 ' inseriamo i parametri per la creazione del rabbet sul fondo Dim CurrCompoParam As CompoParam = CurrCompo.CompoParamList(0) Dim Index As Integer = 0 CurrCompoParam = CurrCompo.CompoParamList(1) ' width If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxParam Then Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam) TextParam.m_Value = DoubleToString(dDeltaT, 4) TextParam.NotifyPropertyChanged("Value") End If ' Depth CurrCompoParam = CurrCompo.CompoParamList(2) If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxParam Then Dim TextParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam) Dim sRabbetDepth As String = sOverlap TextParam.m_Value = sRabbetDepth TextParam.NotifyPropertyChanged("Value") End If CurrCompoParam = CurrCompo.CompoParamList(3) If TypeOf DirectCast(CurrCompoParam, CompoParam) Is TextBoxOnOffParam Then Dim TextOnOffParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam) Dim sAngle As String = "2" TextOnOffParam.m_Value = sAngle TextOnOffParam.SetIsActive(True) TextOnOffParam.NotifyPropertyChanged("Value") End If End Select End Sub #End Region ' Rabbet #End Region ' Rules Assembly Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged Public Sub NotifyPropertyChanged(propName As String) RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) End Sub End Class