Files
EgtDOORCreator/Assembly/Assembly.vb
T
Nicola Pievani 80b3917296 EgtDOORCreator :
- disattivato il parametro angle nelle lavorazioni Rabbet sui lati Top e Hinge
2017-12-11 19:17:47 +00:00

1929 lines
89 KiB
VB.net

Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.IO
Imports EgtUILib
Imports System.Text.RegularExpressions
Public Class Assembly
Implements INotifyPropertyChanged
Friend Shared BuiltReffCompo As Boolean = True
Private m_OneDoorProperty As Boolean
Public Property OneDoorProperty As Boolean
Get
Return m_OneDoorProperty
End Get
Set(value As Boolean)
m_OneDoorProperty = value
End Set
End Property
#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
HeightJamb(GetArrayPartDoor(0).Door.Height)
UpDateAllCompo()
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
End Set
End Property
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
' modifico le dimensioni dei Jambs
HeightJamb(GetArrayPartDoor(0).Door.Height)
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
'SetWidthJamb()
TopBottomWidth()
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
TopBottomWidth()
'SetWidthJamb()
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
Private m_ThicknessHead As String
Public Property ThicknessHead As String
Get
Return m_ThicknessHead
End Get
Set(value As String)
m_ThicknessHead = value
' modifico le dimensioni dei Jambs
m_TopJamb.SetHeight(m_ThicknessHead)
HeightJamb(GetArrayPartDoor(0).Door.Height)
TopRabbetJamb()
UpDateAllCompo()
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
End Set
End Property
Public Sub SetThicknessHead(sThicknessHead As String)
m_ThicknessHead = sThicknessHead
NotifyPropertyChanged("ThicknessHead")
End Sub
#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()
TopBottomWidth()
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
'SetWidthJamb()
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(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Height)
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
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")
If m_Exterior Then
If Not m_LeftJamb.TypePart.Contains("E") Then m_LeftJamb.TypePart &= "E"
If Not m_RightJamb.TypePart.Contains("E") Then m_RightJamb.TypePart &= "E"
If Not m_TopJamb.TypePart.Contains("E") Then m_TopJamb.TypePart &= "E"
If Not m_BottomJamb.TypePart.Contains("E") Then m_BottomJamb.TypePart &= "E"
TopBottomWidth()
SetWidthJamb()
TopRabbetJamb()
HeightJamb(GetArrayPartDoor(0).Door.Height)
UpdateSwing(GetArrayPartDoor(0).Door.Swing)
ReplaceHardware()
Else
If m_LeftJamb.TypePart.Contains("E") Then m_LeftJamb.TypePart = m_LeftJamb.TypePart.Remove(m_LeftJamb.TypePart.Count - 1)
If m_RightJamb.TypePart.Contains("E") Then m_RightJamb.TypePart = m_RightJamb.TypePart.Remove(m_RightJamb.TypePart.Count - 1)
If m_TopJamb.TypePart.Contains("E") Then m_TopJamb.TypePart = m_TopJamb.TypePart.Remove(m_TopJamb.TypePart.Count - 1)
If m_BottomJamb.TypePart.Contains("E") Then m_BottomJamb.TypePart = m_BottomJamb.TypePart.Remove(m_BottomJamb.TypePart.Count - 1)
HeightJamb(GetArrayPartDoor(0).Door.Height)
TopBottomWidth()
TopRabbetJamb()
ReplaceHardware()
End If
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
#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(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Height)
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"
Public ReadOnly Property EdgeTypeList As ObservableCollection(Of EdgeType)
Get
Return Part.m_EdgeTypeList
End Get
End Property
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)
m_LockEdgeType = value
NotifyPropertyChanged("LockEdgeType")
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
m_LeftJamb.LockEdgeType = value
m_RightJamb.LockEdgeType = value
m_TopJamb.LockEdgeType = value
m_BottomJamb.LockEdgeType = 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)
m_HingeEdgeType = value
NotifyPropertyChanged("HingeEdgeType")
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
m_LeftJamb.HingeEdgeType = value
m_RightJamb.HingeEdgeType = value
m_TopJamb.HingeEdgeType = value
m_BottomJamb.HingeEdgeType = 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)
m_TopType = value
NotifyPropertyChanged("TopType")
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
m_LeftJamb.TopType = value
m_RightJamb.TopType = value
m_TopJamb.TopType = value
m_BottomJamb.TopType = 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)
m_BottomType = value
NotifyPropertyChanged("BottomType")
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
m_LeftJamb.BottomType = value
m_RightJamb.BottomType = value
m_TopJamb.BottomType = value
m_BottomJamb.BottomType = 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)
m_TopMachining = value
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)
m_LockEdgeMachining = value
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)
m_HingeEdgeMachining = value
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)
m_BottomMachining = value
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 "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
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
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
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
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
#Region "Lista Porte"
' 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
' l'array che contiene le porte che devono essere inserite (5)
Private m_ArrayPartDoor As New ObservableCollection(Of PartDoor)
' Carica la PrtDoor passata per valore nel vettore ArrayPartDoor nella posizione indicata dall'indice
Public Function SetArrayPartDoor(ArrayPartDoor As PartDoor, Index As Integer) As Boolean
m_ArrayPartDoor(Index) = ArrayPartDoor
Return True
End Function
' restituisce (soltatnto) la part door associata all'inidice selezionato
Public Function GetArrayPartDoor(IndexDoor As Integer) As PartDoor
Return m_ArrayPartDoor(IndexDoor)
End Function
' questa è la proprietà pubblica per il binding
Public ReadOnly Property ArrayPartDoor As ObservableCollection(Of PartDoor)
Get
Return m_ArrayPartDoor
End Get
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
' agiornando il numero di porte aggiorno anche la dimensione dei Jamb
DoorVisibilityNew()
SetTopWidth()
If GetArrayPartDoor(0).Door.Swing.Contains("A") Then
HeightJamb(GetArrayPartDoor(0).Door.Height)
Else
HeightJamb(GetArrayPartDoor(1).Door.Height)
End If
ReplaceHardware()
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
End Set
End Property
Public Sub SetDoorNumber(sDoorNumber As String)
m_DoorNumber = sDoorNumber
NotifyPropertyChanged("DoorNumber")
End Sub
#End Region ' Lista Porte
#Region "Gli oggetti Jamb"
Private m_LeftJamb As Part
Public Property LeftJamb As Part
Get
Return m_LeftJamb
End Get
Set(value As Part)
m_LeftJamb = value
End Set
End Property
Private m_TopJamb As Part
Public Property TopJamb As Part
Get
Return m_TopJamb
End Get
Set(value As Part)
m_TopJamb = value
End Set
End Property
Private m_RightJamb As Part
Public Property RightJamb As Part
Get
Return m_RightJamb
End Get
Set(value As Part)
m_RightJamb = value
End Set
End Property
Private m_BottomJamb As Part
Public Property BottomJamb As Part
Get
Return m_BottomJamb
End Get
Set(value As Part)
m_BottomJamb = value
End Set
End Property
#End Region ' Gli oggetti Jamb
#Region "Lettura Assemblato"
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 InvalidValue As String = String.Empty
InvalidValue += "In General Assembly:" + vbCrLf
' controllo se esite 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
Dim bSecure As Boolean = False
'---------------------------------------------------------------------------------------------------------------------------------
' leggo riga per riga
Dim LineIndexDots As Integer = 0
Dim IndexLine As Integer = LineIndexDots
ReadAssembly.GetGeneralAssembly(ReadAssembly, IndexLine, InvalidValue)
'---------------------------------------------------------------------------------------------------------------------------------
If Not IsNothing(ReadAssembly) Then
If IndexLine = -1 Then
InvalidValue += String.Format(EgtMsg(50102), "Error in reading General Assembly in DDF" + vbCrLf)
ReadAssembly = Nothing
Else
If ReadAssembly.GetDDFDoor(IndexLine) = -1 Then
InvalidValue += String.Format(EgtMsg(50102), "Door has not been founded in Assembly DDF" + vbCrLf)
ReadAssembly = Nothing
End If
End If
End If
If Not InvalidValue = "In General Assembly:" + vbCrLf Then
MessageBox.Show(InvalidValue, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End If
End Sub
Public Function GetGeneralAssembly(ReadAssembly As Assembly, ByRef IndexLine As Integer, InvalidValue As String) As Boolean
IndexLine = ReadAssembly.SkipWhiteSpace(IndexLine)
' Size
If IndexLine < ReadAssembly.FileContent.Count - 1 Then
If SearchKey(ReadAssembly.FileContent(IndexLine), "Size") Then
IndexLine = ReadAssembly.GetSize(IndexLine + 1)
If IndexLine = -1 Then
InvalidValue += String.Format(EgtMsg(50102), "Size" + vbCrLf)
ReadAssembly = Nothing
'Exit For
End If
End If
End If
If IndexLine = 0 Then Return False
IndexLine = ReadAssembly.SkipWhiteSpace(IndexLine)
' Light
If IndexLine < ReadAssembly.FileContent.Count - 1 Then
If SearchKey(ReadAssembly.FileContent(IndexLine), "Light") Then
IndexLine = ReadAssembly.GetLight(IndexLine + 1)
If IndexLine = -1 Then
InvalidValue += String.Format(EgtMsg(50102), "Light" + vbCrLf)
ReadAssembly = Nothing
''Exit For
End If
End If
End If
If IndexLine = 0 Then Return False
IndexLine = ReadAssembly.SkipWhiteSpace(IndexLine)
' Overlap
If IndexLine < ReadAssembly.FileContent.Count - 1 Then
If SearchKey(ReadAssembly.FileContent(IndexLine), "Overlap") Then
IndexLine = ReadAssembly.GetOverlap(IndexLine + 1)
If IndexLine = -1 Then
InvalidValue += String.Format(EgtMsg(50102), "Overlap" + vbCrLf)
ReadAssembly = Nothing
'Exit For
End If
End If
End If
IndexLine = ReadAssembly.SkipWhiteSpace(IndexLine)
' Exterior
If IndexLine < ReadAssembly.FileContent.Count - 1 Then
If SearchKey(ReadAssembly.FileContent(IndexLine), "Exterior") Then
IndexLine = ReadAssembly.GetExterior(IndexLine + 1)
If IndexLine = -1 Then
InvalidValue += String.Format(EgtMsg(50102), "Exterior" + vbCrLf)
ReadAssembly = Nothing
'Exit For
End If
End If
End If
IndexLine = ReadAssembly.SkipWhiteSpace(IndexLine)
' Profiles
If IndexLine < ReadAssembly.FileContent.Count - 1 Then
If SearchKey(ReadAssembly.FileContent(IndexLine), "profiles") Then
IndexLine = ReadAssembly.GetProfiles(IndexLine + 1)
If IndexLine = -1 Then
InvalidValue += String.Format(EgtMsg(50102), "profiles" + vbCrLf)
ReadAssembly = Nothing
'Exit For
End If
End If
End If
IndexLine = ReadAssembly.SkipWhiteSpace(IndexLine)
' Doors
If IndexLine < ReadAssembly.FileContent.Count Then
If SearchKey(ReadAssembly.FileContent(IndexLine), "doors") Then
' in questo modo non passo dalla proprietà ( in breve quello che accadrebbe usando il metodo Set)
IndexLine = ReadAssembly.GetValue(IndexLine, "doors", ReadAssembly.m_DoorNumber)
If IndexLine = -1 Then
InvalidValue += String.Format(EgtMsg(50102), "doors" + vbCrLf)
ReadAssembly = Nothing
'Exit For
End If
' se sono arrivato fino a qui significa che ormai è terminata la pagina
If IsNothing(ReadAssembly.m_Exterior) Or Not ReadAssembly.m_Exterior Then
ReadAssembly.m_Exterior = False
ReadAssembly.m_OverlapTop = OptionModule.m_OverlapTop
End If
End If
End If
Return True
End Function
' salta le righe che non contengono un metadata
Public Function SkipWhiteSpace(Index As Integer) As Integer
Dim ExitLoop As Boolean = False
While Not ExitLoop And Index < FileContent.Count - 1
If FileContent(Index).Contains("##") Then
Dim x = Regex.Match(FileContent(Index), "\s*##\s*(.*?\b)\s*:\s*$").Groups(1).Value
Dim y = Regex.Match(FileContent(Index), "\s*##\s*(.*?\b)\s*:\s*(.*?\b)$").Groups(1).Value
If Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*##\s*(.*?\b)\s*:\s*$").Groups(1).Value) Then
ExitLoop = True
ElseIf Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*##\s*(.*?\b)\s*:\s*(.*?\b)$").Groups(1).Value) Then
ExitLoop = True
ElseIf Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*(measures)\s*:\s*(.*?\b)$").Groups(1).Value) Then
ExitLoop = True
Else
Index += 1
End If
ElseIf Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*(measures)\s*:\s*(.*?\b)$").Groups(1).Value) Or
Not String.IsNullOrWhiteSpace(Regex.Match(FileContent(Index), "\s*(prodce)\s*:\s*(.*?\b)$").Groups(1).Value) 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 Index
Else
Dim Local_Var As String = SearchKeyValue(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
Index += 1
Return Index
Else
Var = Local_Var
Index += 1
Return Index
End If
End If
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, ByVal 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 = SearchKeyValue(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 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 = SearchKeyValue(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 = SearchKeyValue(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
Dim CautionBevel As String = String.Format(EgtMsg(50151), Edge)
MessageBox.Show(CautionBevel, EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk)
Part.FirstReadingEdge = True
End If
End Sub
' Size
Friend 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
Friend Function GetLight(Index As Integer) As Integer
If Index = -1 Then Return -1
Index = GetValue(Index, "up", m_LightUp)
If Index = -1 Then Return -1
Index = GetValue(Index, "lock", m_LightLock)
If Index = -1 Then Return -1
Index = GetValue(Index, "hinge", m_LightHinge)
If Index = -1 Then Return -1
Index = GetValue(Index, "bottom", m_LightBottom)
Return Index
End Function
' Overlap
Friend 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, "hinge", m_OverlapHinge)
If Index = -1 Then Return -1
Index = GetValue(Index, "lock", m_OverlapLock)
If Index = -1 Then Return -1
Index = GetValue(Index, "deltaT", m_DeltaThickness)
Return Index
End Function
' Profiles
Friend 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
Friend Function GetExterior(Index As Integer) As Integer
m_Exterior = True
If Index = -1 Then Return -1
Index = GetValue(Index, "top", m_OverlapTop)
'If Index = -1 Then Return -1
'Index = GetValue(Index, "deltaT", m_DeltaThickness)
Return Index
End Function
Public Function GetDDFDoor(IndexLine As Integer) As Integer
Dim Line As Integer = IndexLine
While Line < FileContent.Count - 1 AndAlso Not Search3Dots(FileContent(Line))
Dim Local_Door As New Part
Dim Local_PartDoor As New PartDoor
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 = "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("F") Then
sDoorPiece = sDoorPiece.Remove(3)
End If
Map.refCompoPanelVM.GoBackVisibility = Visibility.Visible
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage
Else
' significa che stiamo per leggere una porta singola
Local_Door.IsActive = True
Local_PartDoor.Door = Local_Door
Local_PartDoor.Door.SwingTypeList = OptionModule.m_SwingTypeList
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
SetArrayPartDoor(Local_PartDoor, 0)
Map.refPartPageVM.CurrPart = Local_Door
Map.refCompoPanelVM.GoBackVisibility = Visibility.Collapsed
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage
Exit While
End If
Select Case sDoorPiece
Case "DO_1"
Local_PartDoor.Door = Local_Door
Local_PartDoor.Door.SwingTypeList = m_SwingTypeListSinlgeDoor
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
SetArrayPartDoor(Local_PartDoor, 0)
Case "DO_2"
Local_PartDoor.Door = Local_Door
Local_PartDoor.Door.SwingTypeList = m_SwingTypeListRightDoor
GetArrayPartDoor(0).Door.SwingTypeList = m_SwingTypeListLeftDoor
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
SetArrayPartDoor(Local_PartDoor, 1)
Case "DO_3"
Local_PartDoor.Door = Local_Door
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
SetArrayPartDoor(Local_PartDoor, 2)
Case "DO_4"
Local_PartDoor.Door = Local_Door
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
SetArrayPartDoor(Local_PartDoor, 3)
Case "DO_5"
Local_PartDoor.Door = Local_Door
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
SetArrayPartDoor(Local_PartDoor, 4)
Case "DO_6"
Local_PartDoor.Door = Local_Door
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
SetArrayPartDoor(Local_PartDoor, 5)
Case "FL_"
Local_Door.SwingTypeList = m_SwingTypeList
m_LeftJamb = Local_Door
Case "FR_"
Local_Door.SwingTypeList = m_SwingTypeList
m_RightJamb = Local_Door
Case "FT_"
Local_Door.SwingTypeList = m_SwingTypeList
m_TopJamb = Local_Door
Case "FB_"
Local_Door.SwingTypeList = m_SwingTypeList
m_BottomJamb = Local_Door
If Not m_Exterior Then m_BottomJamb.IsActive = False
End Select
End While
DoorVisibility()
MatchCompo()
BuiltReffCompo = True
Return 1
End Function
#Region "Associazione delle compo lette da ddf"
Public Sub MatchCompo()
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)) 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.Swing.Contains("I") Then
For IndexCompo As Integer = 0 To DoorActive.CompoList.Count - 1
If Not String.IsNullOrEmpty(DoorActive.CompoList(IndexCompo).IdCode) Then
For IndexCompoLeftJamb As Integer = 0 To DoorInactive.CompoList.Count - 1
If DoorInactive.CompoList(IndexCompoLeftJamb).IdCode = DoorActive.CompoList(IndexCompo).IdCode Then
DoorActive.CompoList(IndexCompo).refJambCompo = DoorInactive.CompoList(IndexCompoLeftJamb)
DoorActive.CompoList(IndexCompo).refJambCompo.IsReadOnly = True
DoorActive.CompoList(IndexCompo).IsReadOnly = True
If Not LoadCompoParam(DoorActive.CompoList(IndexCompo)) 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
' Agiorna IsVisible delle porte contenute nell'ArrayPartDoor
Public Sub DoorVisibility()
' aggiorno la visibilità delle porte senza però modificare la dimensione dei Jamb caricati
For Index As Integer = 0 To CInt(m_DoorNumber) - 1
If Not IsNothing(m_ArrayPartDoor(Index)) Then
m_ArrayPartDoor(Index).IsVisible = Visibility.Visible
m_ArrayPartDoor(Index).NotifyPropertyChanged("IsVisible")
End If
Next
For Index As Integer = CInt(m_DoorNumber) To K_DOORNUMBER
If Not IsNothing(m_ArrayPartDoor(Index)) Then
m_ArrayPartDoor(Index).IsVisible = Visibility.Collapsed
m_ArrayPartDoor(Index).NotifyPropertyChanged("IsVisible")
End If
Next
If Not IsNothing(GetArrayPartDoor(0).Door) Then
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then m_DoorNumber = "1"
End If
If m_DoorNumber = "1" Then
OneDoorProperty = True
Else
OneDoorProperty = False
End If
NotifyPropertyChanged("CurrAssembly")
End Sub
#End Region ' Lettura Assemblato
'---------------------------------------------------------------------------------------------------------------------------------------------
#Region "RULES ASSEMBLY"
Public Sub SetVarAssembly()
Dim dHeight As Double
Dim dWidth As Double
Dim dThickness As Double
If Not IsNothing(Map.refPartPageVM.CurrPart) Then
If Map.refPartPageVM.CurrPart.TypePart.Contains("DO_1") Then
If Not IsNothing(Map.refPartPageVM.CurrPart.Height) And Not IsNothing(Map.refPartPageVM.CurrPart.Width) And Not IsNothing(Map.refPartPageVM.CurrPart.Thickness) Then
If StringToDouble(Map.refPartPageVM.CurrPart.Height, dHeight) Then
EgtLuaSetGlobNumVar("H", dHeight)
End If
If StringToDouble(Map.refPartPageVM.CurrPart.Width, dWidth) Then
EgtLuaSetGlobNumVar("W", dWidth)
End If
If StringToDouble(Map.refPartPageVM.CurrPart.Thickness, dThickness) Then
EgtLuaSetGlobNumVar("T", dThickness)
End If
End If
ElseIf Map.refPartPageVM.CurrPart.TypePart.Contains("DO_2") Then
If Not IsNothing(Map.refPartPageVM.CurrPart.Height) And Not IsNothing(Map.refPartPageVM.CurrPart.Width) And Not IsNothing(Map.refPartPageVM.CurrPart.Thickness) Then
If StringToDouble(Map.refPartPageVM.CurrPart.Height, dHeight) Then
EgtLuaSetGlobNumVar("H2", dHeight)
End If
If StringToDouble(Map.refPartPageVM.CurrPart.Width, dWidth) Then
EgtLuaSetGlobNumVar("W2", dWidth)
End If
If StringToDouble(Map.refPartPageVM.CurrPart.Thickness, dThickness) Then
EgtLuaSetGlobNumVar("T2", dThickness)
End If
End If
End If
End If
End Sub
' è chiamata ogni volta che viene modificato un parametro del general dell'assemblato
Public Sub UpDateAllCompo()
Dim IdexDoorNumber As Integer = 0
If CInt(m_DoorNumber) > ArrayPartDoor.Count Then
IdexDoorNumber = ArrayPartDoor.Count
ElseIf CInt(m_DoorNumber) < ArrayPartDoor.Count Or CInt(m_DoorNumber) = ArrayPartDoor.Count Then
IdexDoorNumber = CInt(m_DoorNumber)
End If
For IndexDoor As Integer = 0 To IdexDoorNumber - 1
For IndexCompo As Integer = 0 To GetArrayPartDoor(IndexDoor).Door.CompoList.Count - 1
Dim CurrCompo As Compo = GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo)
If Not IsNothing(CurrCompo.refJambCompo) Then
If LoadCompoParam(CurrCompo) Then
UpDateCurrCompoJamb(CurrCompo)
ResetCompoParam()
Else
MessageBox.Show("Script Lua (" & CurrCompo.CompoType.Path & "\" & "Matching.lua" & ")has not been found", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
End If
End If
Next
Next
End Sub
Public Sub UpDateCurrCompoJamb(ByRef CurrCompo As Compo)
CurrCompo.refJambCompo.IsReadOnly = False
' devo distinguere il caso della componente sulla porta o sul jamb
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
Dim TBoxPar As TextBoxParam = DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxParam)
Dim TBoxRefPar As TextBoxParam = DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxParam)
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly)
ElseIf TypeOf CurrCompo.refJambCompo.CompoParamList(IndexParam) Is ComboBoxParam AndAlso CurrCompo.CompoParamList(IndexParam).DDFName = CurrCompo.refJambCompo.CompoParamList(IndexParam).DDFName Then
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
Dim TBoxPar As TextBoxOnOffParam = DirectCast(CurrCompo.CompoParamList(IndexParam), TextBoxOnOffParam)
Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(CurrCompo.refJambCompo.CompoParamList(IndexParam), TextBoxOnOffParam)
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly)
End If
Next
End Sub
' calcola la giusta lista di swing per ogni porta e ricalcolo la dimensione dei Jamb Top e Bottom (width)
Public Sub DoorVisibilityNew()
' definisco gli swing riferiti ai Jamb e quindi anche i nomi da associare alle porte durante la creazione di una nuova porta
Dim bInvertDoor As Boolean = False
Dim AppPartDoor As New PartDoor
Select Case DoorNumber
Case "1" ' passaggio da due porte ad una porta
OneDoorProperty = True
NotifyPropertyChanged("OneDoorProperty")
' inverto la posizioned delle porte
If GetArrayPartDoor(0).Door.Swing.Contains("I") Then
AppPartDoor = GetArrayPartDoor(1)
SetArrayPartDoor(GetArrayPartDoor(0), 1)
SetArrayPartDoor(AppPartDoor, 0)
GetArrayPartDoor(0).Door.TypePart = "DO_1"
GetArrayPartDoor(0).NotifyPropertyChanged("Type")
GetArrayPartDoor(1).Door.TypePart = "DO_2"
GetArrayPartDoor(1).NotifyPropertyChanged("Type")
End If
' leggo lo swing posseduto dalla prima porta (delle due quella attiva) e assegno il nuovo swing
GetArrayPartDoor(0).Door.SwingTypeList = OptionModule.m_SwingTypeListSinlgeDoor
If GetArrayPartDoor(0).Door.Swing.Contains("L") Then
If GetArrayPartDoor(0).Door.Swing.Contains("HR") Then
GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(2))
Else
GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(0))
End If
Else
If GetArrayPartDoor(0).Door.Swing.Contains("HR") Then
GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(3))
Else
GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(1))
End If
End If
'--------------------------------------------------------------------------------------------------------------------------------------------------------------
' Elimino tutti le componenti sul Jamb (che ora diventa di Tipo L) eliminando dalla porta due
Map.refPartPageVM.CurrPart = GetArrayPartDoor(1).Door
For IndexDeleteCompo As Integer = GetArrayPartDoor(1).Door.CompoList.Count - 1 To 0 Step -1
Map.refPartPageVM.CurrPart.CompoList(IndexDeleteCompo).Delete()
Next
' ricarico tutti i riferimenti della porta vecchia sul jamb
Map.refPartPageVM.CurrPart = GetArrayPartDoor(0).Door
SetTopWidth()
ReplaceHardware()
'--------------------------------------------------------------------------------------------------------------------------------------------------------------
' riassegno gli swing ai Jamb
LeftJamb.SetSwing(GetArrayPartDoor(0).Door.Swing)
TopJamb.SetSwing(GetArrayPartDoor(0).Door.Swing)
RightJamb.SetSwing(GetArrayPartDoor(0).Door.Swing)
BottomJamb.SetSwing(GetArrayPartDoor(0).Door.Swing)
If Not Exterior Then
If LeftJamb.Swing.Contains("L") Then
LeftJamb.TypePart = "FL_H"
RightJamb.TypePart = "FR_L"
Else
LeftJamb.TypePart = "FL_L"
RightJamb.TypePart = "FR_H"
End If
BottomJamb.TypePart = "FB_B"
TopJamb.TypePart = "FT_T"
Else
If LeftJamb.Swing.Contains("L") Then
LeftJamb.TypePart = "FL_HE"
RightJamb.TypePart = "FR_LE"
Else
LeftJamb.TypePart = "FL_LE"
RightJamb.TypePart = "FR_HE"
End If
BottomJamb.TypePart = "FB_BE"
TopJamb.TypePart = "FT_TE"
End If
TopRabbetJamb()
BottomRabbetJamb()
HingeRabbetJamb()
NotifyPropertyChanged("CurrAssembly")
Case "2" ' passaggio da una porta a due porte
OneDoorProperty = False
If GetArrayPartDoor(0).Door.Swing.Contains("RH") Or GetArrayPartDoor(0).Door.Swing.Contains("RHR") Then bInvertDoor = True
HeightDoor(GetArrayPartDoor(0).Door.Height)
If bInvertDoor Then
AppPartDoor = GetArrayPartDoor(0)
SetArrayPartDoor(GetArrayPartDoor(1), 0)
SetArrayPartDoor(AppPartDoor, 1)
GetArrayPartDoor(0).Door.TypePart = "DO_1"
GetArrayPartDoor(0).Door.Code = "Door1"
GetArrayPartDoor(0).NotifyPropertyChanged("Type")
GetArrayPartDoor(1).Door.TypePart = "DO_2"
GetArrayPartDoor(1).Door.Code = "Door2"
GetArrayPartDoor(1).NotifyPropertyChanged("Type")
End If
GetArrayPartDoor(0).Door.SwingTypeList = OptionModule.m_SwingTypeListLeftDoor
GetArrayPartDoor(1).Door.SwingTypeList = OptionModule.m_SwingTypeListRightDoor
Dim IndexDoor As Integer = 0
If bInvertDoor Then IndexDoor = 1
If GetArrayPartDoor(IndexDoor).Door.Swing.Contains("L") Then
If GetArrayPartDoor(IndexDoor).Door.Swing.Contains("HR") Then
'assegno LHRA
GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(1))
GetArrayPartDoor(1).Door.SetSwing(GetArrayPartDoor(1).Door.SwingTypeList(1))
' elimino le compo dal Jamb destro
For IndexCompo As Integer = 0 To GetArrayPartDoor(0).Door.CompoList.Count - 1
If GetArrayPartDoor(0).Door.CompoList(IndexCompo).CompoType.DDFName = "locks" Then
If Not IsNothing(GetArrayPartDoor(0).Door.CompoList(IndexCompo).refJambCompo) Then
Map.refPartPageVM.CurrPart = GetArrayPartDoor(0).Door
GetArrayPartDoor(0).Door.CompoList(IndexCompo).Delete()
End If
End If
Next
Else
'assegno LHA
GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(2))
GetArrayPartDoor(1).Door.SetSwing(GetArrayPartDoor(1).Door.SwingTypeList(2))
For IndexCompo As Integer = 0 To GetArrayPartDoor(0).Door.CompoList.Count - 1
If GetArrayPartDoor(0).Door.CompoList(IndexCompo).CompoType.DDFName = "locks" Then
If Not IsNothing(GetArrayPartDoor(0).Door.CompoList(IndexCompo).refJambCompo) Then
Map.refPartPageVM.CurrPart = GetArrayPartDoor(0).Door
GetArrayPartDoor(0).Door.CompoList(IndexCompo).Delete()
End If
End If
Next
End If
Else
If GetArrayPartDoor(IndexDoor).Door.Swing.Contains("HR") Then
'assegno RHRA
GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(3))
GetArrayPartDoor(1).Door.SetSwing(GetArrayPartDoor(1).Door.SwingTypeList(3))
For IndexCompo As Integer = 0 To GetArrayPartDoor(1).Door.CompoList.Count - 1
If GetArrayPartDoor(1).Door.CompoList(IndexCompo).CompoType.DDFName = "locks" Then
If Not IsNothing(GetArrayPartDoor(1).Door.CompoList(IndexCompo).refJambCompo) Then
Map.refPartPageVM.CurrPart = GetArrayPartDoor(0).Door
GetArrayPartDoor(1).Door.CompoList(IndexCompo).Delete()
End If
End If
Next
Else
'assegno RHA
GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(0))
GetArrayPartDoor(1).Door.SetSwing(GetArrayPartDoor(1).Door.SwingTypeList(0))
For IndexCompo As Integer = 0 To GetArrayPartDoor(0).Door.CompoList.Count - 1
If GetArrayPartDoor(1).Door.CompoList(IndexCompo).CompoType.DDFName = "locks" Then
If Not IsNothing(GetArrayPartDoor(1).Door.CompoList(IndexCompo).refJambCompo) Then
Map.refPartPageVM.CurrPart = GetArrayPartDoor(0).Door
GetArrayPartDoor(1).Door.CompoList(IndexCompo).Delete()
End If
End If
Next
End If
End If
LeftJamb.SetSwing(GetArrayPartDoor(0).Door.Swing)
TopJamb.SetSwing(GetArrayPartDoor(0).Door.Swing)
RightJamb.SetSwing(GetArrayPartDoor(1).Door.Swing)
BottomJamb.SetSwing(GetArrayPartDoor(1).Door.Swing)
LeftJamb.TypePart = "FL_H"
RightJamb.TypePart = "FR_H"
BottomJamb.TypePart = "FB_B"
TopJamb.TypePart = "FT_T"
ReplaceHardware()
NotifyPropertyChanged("CurrAssembly")
End Select
For Index As Integer = 0 To CInt(m_DoorNumber) - 1
If Not IsNothing(m_ArrayPartDoor(Index)) Then
m_ArrayPartDoor(Index).IsVisible = Visibility.Visible
WidthJamb(GetArrayPartDoor(Index).Door.Width)
m_ArrayPartDoor(Index).NotifyPropertyChanged("IsVisible")
m_ArrayPartDoor(Index).NotifyPropertyChanged("TypePart")
End If
Next
For Index As Integer = CInt(m_DoorNumber) To K_DOORNUMBER
If Not IsNothing(m_ArrayPartDoor(Index)) Then
m_ArrayPartDoor(Index).IsVisible = Visibility.Collapsed
m_ArrayPartDoor(Index).NotifyPropertyChanged("IsVisible")
m_ArrayPartDoor(Index).NotifyPropertyChanged("TypePart")
End If
Next
SetTopWidth()
End Sub
' calcola l'altezza dei jamb Left e right data l'altezza della porta
Public Sub HeightJamb(HeighDoor As String)
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(Map.refAssemblyPageVM.CurrAssembly.LightUp, dLightUp)
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightBottom, dLightBottom)
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.ThicknessHead, dThicknessHead)
StringToDouble(HeighDoor, dHeight)
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.OverlapTop, dOverlapTop)
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.Width, dThichknessJamb)
' se è exterior
If Map.refAssemblyPageVM.CurrAssembly.Exterior Then
Map.refAssemblyPageVM.CurrAssembly.LeftJamb.SetHeight(DoubleToString(dLightBottom + dThicknessHead + dHeight - dOverlapTop + dLightUp + dThichknessJamb, 4))
Map.refAssemblyPageVM.CurrAssembly.RightJamb.SetHeight(DoubleToString(dLightBottom + dThicknessHead + dHeight - dOverlapTop + dLightUp + dThichknessJamb, 4))
Else
Map.refAssemblyPageVM.CurrAssembly.LeftJamb.SetHeight(DoubleToString(dLightUp + dLightBottom + dThicknessHead + dHeight, 4))
Map.refAssemblyPageVM.CurrAssembly.RightJamb.SetHeight(DoubleToString(dLightUp + dLightBottom + dThicknessHead + dHeight, 4))
End If
End Sub
' Ricalcola la dimensione di tutte le porte ricevendo come valore esterno la dimensione della porta modificata
Public Sub HeightDoor(HeighDoor As String)
For Index As Integer = 0 To m_ArrayPartDoor.Count - 1
GetArrayPartDoor(Index).Door.SetHeight(HeighDoor)
Next
End Sub
' questa funzione è chiamata durante la creazione di un nuovo assemblato, ogni volat che viene chiamta ricalcola la dimensione del TopJamb
Public Sub SetTopWidth()
' azzero le dimensioni
m_BottomJamb.SetWidth("0")
m_TopJamb.SetWidth("0")
Dim IdexDoor As Integer = 0
' controllo che il numero di porte da aprire sia maggiore del numero di porte create
If CInt(m_DoorNumber) > ArrayPartDoor.Count Then
IdexDoor = ArrayPartDoor.Count
ElseIf CInt(m_DoorNumber) < ArrayPartDoor.Count Or CInt(m_DoorNumber) = ArrayPartDoor.Count Then
IdexDoor = CInt(m_DoorNumber)
End If
' chiamo la funzione sotto per il calcolo del TopJamb
For Index As Integer = 0 To IdexDoor - 1
WidthJamb(GetArrayPartDoor(Index).Door.Width)
Next
End Sub
' passato come riferimento la larghezza della porta viene calcolata la dimensione dei Jamb Top e Bottom (per ricalcolare la dimensione opJamb.Width = "0")
Private Sub WidthJamb(WidthDoor As String)
Dim dLightHinge As Double
Dim dLightLock As Double
Dim dOverlapLock As Double
Dim dOverlapHinge As Double
Dim dWidth As Double
Dim dMinWidth As Double
' la misura del TopJamb viene modificata nel ciclo for quindi passo la misura corrente
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(WidthDoor, dWidth)
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.TopJamb.Width, dActualWidth)
If Exterior Then
dMinWidth = dLightHinge + dLightLock
Else
dMinWidth = dLightHinge + dLightLock + dOverlapLock + dOverlapHinge
End If
' se la finzione è chiama per la prima volta (cioè è nel primo ciclo) allora le misure sono nulle (=0)
If dActualWidth = 0 Then
Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dMinWidth + dWidth, 4))
Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dMinWidth + dWidth, 4))
Else
' se una porta è già stata chiamata allora modifico i parametri
If Exterior Then
Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dWidth + dLightHinge + dActualWidth, 4))
Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dWidth + dLightHinge + dActualWidth, 4))
Else
Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dWidth + dActualWidth + dLightHinge - dOverlapLock + dOverlapHinge, 4))
Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dWidth + dActualWidth + dLightHinge - dOverlapLock + dOverlapHinge, 4))
End If
End If
End Sub
' calcola la dimensione spessore dei Jamb (per tutti lo stesso)
Public Sub SetThicKnessJamb()
m_BottomJamb.SetThickness(m_Thickness)
m_TopJamb.SetThickness(m_Thickness)
m_LeftJamb.SetThickness(m_Thickness)
m_RightJamb.SetThickness(m_Thickness)
End Sub
' questa funzione può essere richiamata solo dopo che sono state create tutte le porte!
Private Sub TopBottomWidth()
Dim dLightHinge As Double
Dim dLightLock As Double
Dim dOverlapLock As Double
Dim dOverlapHinge As Double
Dim dWidth0 As Double
Dim dWidth1 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)
Select Case DoorNumber
Case "1"
If Exterior Then
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Width, dWidth0)
dActualWidth = dLightHinge + dLightLock
Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dWidth0 + dActualWidth, 4))
Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dWidth0 + dActualWidth, 4))
Else
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Width, dWidth0)
dActualWidth = dLightHinge + dLightLock + dOverlapLock + dOverlapHinge
Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dWidth0 + dActualWidth, 4))
Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dWidth0 + dActualWidth, 4))
End If
Case "2"
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Width, dWidth0)
StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(1).Door.Width, dWidth1)
If Exterior Then
dActualWidth = dLightHinge + dLightHinge + dLightLock + dWidth0
Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dWidth1 + dActualWidth, 4))
Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dWidth1 + dActualWidth, 4))
Else
dActualWidth = dLightHinge + dLightHinge + dLightLock + dOverlapHinge + dOverlapHinge + dWidth0
Map.refAssemblyPageVM.CurrAssembly.TopJamb.SetWidth(DoubleToString(dWidth1 + dActualWidth, 4))
Map.refAssemblyPageVM.CurrAssembly.BottomJamb.SetWidth(DoubleToString(dWidth1 + dActualWidth, 4))
End If
End Select
End Sub
' dimensione gli spessori dei Jamb (l'unico diverso dagli altri è quello top)
Public Sub SetWidthJamb()
m_BottomJamb.SetHeight(m_Width)
m_TopJamb.SetHeight(m_ThicknessHead)
m_LeftJamb.SetWidth(m_Width)
m_RightJamb.SetWidth(m_Width)
End Sub
' ricalcola il valore degli swing dalla modifica dello swing della porta
Public Sub UpdateSwing(sSwing As String)
Dim bInvertDoor As Boolean = False
Select Case DoorNumber
Case "1"
' aggiorno l'elenco dello swing della porta
If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
GetArrayPartDoor(0).Door.SwingTypeList = OptionModule.m_SwingTypeListSinlgeDoor
GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(GetArrayPartDoor(0).Door.SwingTypeList.IndexOf(sSwing)))
' aggiorno gli swing sui Jamb (tutti hanno lo stesso swing)
If m_LeftJamb.Swing.Contains("L") AndAlso Not sSwing.Contains("L") Then
Dim JambAppo As Part
JambAppo = m_LeftJamb
m_LeftJamb = m_RightJamb
m_RightJamb = JambAppo
ElseIf Not m_LeftJamb.Swing.Contains("L") AndAlso sSwing.Contains("L") Then
Dim JambAppo As Part
JambAppo = m_LeftJamb
m_LeftJamb = m_RightJamb
m_RightJamb = JambAppo
End If
LeftJamb.SetSwing(GetArrayPartDoor(0).Door.Swing)
TopJamb.SetSwing(GetArrayPartDoor(0).Door.Swing)
RightJamb.SetSwing(GetArrayPartDoor(0).Door.Swing)
BottomJamb.SetSwing(GetArrayPartDoor(0).Door.Swing)
If Map.refAssemblyPageVM.CurrAssembly.Exterior Then
If LeftJamb.Swing.Contains("L") Then
LeftJamb.TypePart = "FL_HE"
RightJamb.TypePart = "FR_LE"
Else
LeftJamb.TypePart = "FL_LE"
RightJamb.TypePart = "FR_HE"
End If
BottomJamb.TypePart = "FB_BE"
TopJamb.TypePart = "FT_TE"
Else
If LeftJamb.Swing.Contains("L") Then
LeftJamb.TypePart = "FL_H"
RightJamb.TypePart = "FR_L"
Else
LeftJamb.TypePart = "FL_L"
RightJamb.TypePart = "FR_H"
End If
BottomJamb.TypePart = "FB_B"
TopJamb.TypePart = "FT_T"
End If
End If
NotifyPropertyChanged("CurrAssembly")
Case "2"
GetArrayPartDoor(0).Door.SwingTypeList = OptionModule.m_SwingTypeListLeftDoor
GetArrayPartDoor(1).Door.SwingTypeList = OptionModule.m_SwingTypeListRightDoor
' ricerco all'interno dell'elenco l'indice associaro allo swing cercato ->GetArrayPartDoor(0).Door.SwingTypeList.IndexOf(sSwing)
Dim IndexSwing As Integer
If sSwing.Contains("L") Then
IndexSwing = GetArrayPartDoor(0).Door.SwingTypeList.IndexOf(sSwing)
Else
IndexSwing = GetArrayPartDoor(1).Door.SwingTypeList.IndexOf(sSwing)
End If
GetArrayPartDoor(0).Door.SetSwing(GetArrayPartDoor(0).Door.SwingTypeList(IndexSwing))
GetArrayPartDoor(1).Door.SetSwing(GetArrayPartDoor(1).Door.SwingTypeList(IndexSwing))
LeftJamb.SetSwing(GetArrayPartDoor(0).Door.Swing)
TopJamb.SetSwing(GetArrayPartDoor(0).Door.Swing)
RightJamb.SetSwing(GetArrayPartDoor(1).Door.Swing)
BottomJamb.SetSwing(GetArrayPartDoor(1).Door.Swing)
If Map.refAssemblyPageVM.CurrAssembly.Exterior Then
LeftJamb.TypePart = "FL_HE"
RightJamb.TypePart = "FR_HE"
BottomJamb.TypePart = "FB_BE"
TopJamb.TypePart = "FT_TE"
Else
LeftJamb.TypePart = "FL_H"
RightJamb.TypePart = "FR_H"
BottomJamb.TypePart = "FB_B"
TopJamb.TypePart = "FT_T"
End If
NotifyPropertyChanged("CurrAssembly")
End Select
End Sub
' 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_LeftJamb.Swing.Contains("L") Then
SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessHead, sOverLapLock, sLightUp)
SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessHead, sOverlapHinge, sLightUp)
Else
SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessHead, sOverlapHinge, sLightUp)
SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessHead, sOverLapLock, sLightUp)
End If
Case "2"
SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessHead, sOverlapHinge, sLightUp)
SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessHead, sOverlapHinge, sLightUp)
End Select
End Sub
Private Sub SetRabbetJamb(ByRef Jamb As Part, sThicknessHead As String, sOverlap As String, sLightUp As String)
Dim CompoListIndex As Integer = CompoPanelVM.CompoTypeList.Count - 1
Dim bRabbet As Boolean = False
Dim IndexCompo As Integer
If Jamb.CompoList.Count > 0 Then
For IndexCompo = 0 To Jamb.CompoList.Count - 1
If Jamb.CompoList(IndexCompo).CompoType.DDFName = CompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then
If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(0) Then
bRabbet = True
Exit For
End If
End If
Next
' se eiste il rabbet Lo modifico
If bRabbet Then
SetTopRabbetParam(sThicknessHead, sOverlap, Jamb, IndexCompo, sLightUp)
Else
' lo aggiungo e lo modifico
Jamb.AddNewCompo(CompoPanelVM.CompoTypeList(CompoListIndex))
SetTopRabbetParam(sThicknessHead, sOverlap, Jamb, Jamb.CompoList.Count - 1, sLightUp)
End If
Else
' lo aggiungo e lo modifico
Jamb.AddNewCompo(CompoPanelVM.CompoTypeList(CompoListIndex))
SetTopRabbetParam(sThicknessHead, sOverlap, Jamb, 0, sLightUp)
End If
End Sub
Private Sub SetTopRabbetParam(sThicknessHead As String, sOverlapTop As String, ByRef Jamb As Part, IndexCompo As Integer, sLightUp As String)
Dim CurrCompoParam As CompoParam = Jamb.CompoList(IndexCompo).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 = Jamb.CompoList(IndexCompo).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 = Jamb.CompoList(IndexCompo).CompoParamList(3)
If TypeOf CurrCompoParam Is TextBoxOnOffParam Then
Dim TextParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam)
TextParam.IsActive = False
TextParam.NotifyPropertyChanged("Value")
End If
End Sub
' calcola il rabbet sul lato Hinge solo se è stata selezionata la proprietà exterior
' calcola il rabbet sul lato Bottom solo se è stata selezionata la proprietà exterior
Public Sub BottomRabbetJamb()
Dim sThicknessDoor As String = GetArrayPartDoor(0).Door.Thickness
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_LeftJamb.Swing.Contains("L") Then
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessDoor, sWidthJamb, sOverLapLock, IndexBottom)
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessDoor, sWidthJamb, sOverLapHinge, IndexBottom)
Else
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessDoor, sWidthJamb, sOverLapHinge, IndexBottom)
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessDoor, sWidthJamb, sOverLapLock, IndexBottom)
End If
Case "2"
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessDoor, sWidthJamb, sOverLapHinge, IndexBottom)
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessDoor, sWidthJamb, sOverLapHinge, IndexBottom)
End Select
End Sub
' il lato hinge è anche sul TopJamb con la profondità uguale a tutti gli altri
Public Sub HingeRabbetJamb()
Dim sThicknessDoor As String = GetArrayPartDoor(0).Door.Thickness
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
Dim IndexHinge As Integer = 2
Select Case DoorNumber
Case "1"
If Not m_LeftJamb.Swing.Contains("L") Then
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessDoor, sDeltaT, sOverLapLock, IndexHinge)
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge)
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.TopJamb, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge)
Else
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge)
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessDoor, sDeltaT, sOverLapLock, IndexHinge)
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.TopJamb, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge)
End If
Case "2"
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.LeftJamb, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge)
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessDoor, sDeltaT, sOverLapHinge, IndexHinge)
RabbetExterior(Map.refAssemblyPageVM.CurrAssembly.TopJamb, sThicknessDoor, sDeltaT, sOverLapTop, IndexHinge)
End Select
End Sub
Private Sub SetHingeRabbetParam(sThicknessDoor As String, sDeltaT As String, sOverlap As String, ByRef Jamb As Part, CurrCompo As Compo, IndexSide As Integer)
Dim dThicknessDoor As Double
Dim dDeltaT As Double
StringToDouble(sThicknessDoor, dThicknessDoor)
StringToDouble(sDeltaT, dDeltaT)
Select Case IndexSide
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)
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
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)
TextOnOffParam.IsActive = 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.IsActive = True
TextOnOffParam.NotifyPropertyChanged("Value")
End If
End Select
End Sub
Public Sub RabbetExterior(ByRef Jamb As Part, sThicknessDoor As String, sDeltaT As String, sOverLap As String, nIndexSide As Integer)
'Dim IndexHinge As Integer = 2
'Dim IndexBottom As Integer = 1
Dim CompoListIndex As Integer = CompoPanelVM.CompoTypeList.Count - 1
Dim bRabbet As Boolean = False
Dim IndexCompo As Integer
If m_Exterior Then
If Jamb.CompoList.Count > 0 Then
For IndexCompo = 0 To Jamb.CompoList.Count - 1
If Jamb.CompoList(IndexCompo).CompoType.DDFName = CompoPanelVM.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
If bRabbet Then
SetHingeRabbetParam(sThicknessDoor, sDeltaT, sOverLap, Jamb, Jamb.CompoList(IndexCompo), nIndexSide)
Else
' lo aggiungo e lo modifico
Dim Local_Compo As Compo = Jamb.AddNewCompo(CompoPanelVM.CompoTypeList(CompoListIndex))
DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).ItemList(nIndexSide)
SetHingeRabbetParam(sThicknessDoor, sDeltaT, sOverLap, Jamb, Local_Compo, nIndexSide)
End If
Else
' lo aggiungo e lo modifico
Dim Local_Compo As Compo = Jamb.AddNewCompo(CompoPanelVM.CompoTypeList(CompoListIndex))
DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).ItemList(nIndexSide)
SetHingeRabbetParam(sThicknessDoor, sDeltaT, sOverLap, Jamb, Local_Compo, nIndexSide)
End If
'
Else
For IndexCompo = 0 To Jamb.CompoList.Count - 1
If Jamb.CompoList(IndexCompo).CompoType.DDFName = CompoPanelVM.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
If bRabbet Then Jamb.CompoList.RemoveAt(IndexCompo)
End If
End Sub
' ricalcola la posizione di tutti gli hardware se esiste un riferimento
Public Sub ReplaceHardware()
For IndexDoor As Integer = 0 To CInt(DoorNumber) - 1
For IndexCompo As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList.Count - 1
If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo) Then
Dim x As String = Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo.TemplateSelItem
For IndexParam As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList.Count - 1
If TypeOf Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam) Is TextBoxParam Then
DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value = DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value
End If
Next
End If
Next
Next
End Sub
'Public Sub AddHardware()
' For IndexDoor As Integer = 0 To CInt(DoorNumber) - 1
' For IndexCompo As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList.Count - 1
' If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo) Then
' 'If Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo.Si Then
' Dim x As String = Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).refJambCompo.TemplateSelItem
' For IndexParam As Integer = 0 To Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList.Count - 1
' If TypeOf Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam) Is TextBoxParam Then
' DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value = DirectCast(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(IndexDoor).Door.CompoList(IndexCompo).CompoParamList(IndexParam), TextBoxParam).Value
' End If
' Next
' End If
' Next
' Next
'End Sub
#End Region ' Rules Assembly
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
End Class