3573 lines
156 KiB
VB.net
3573 lines
156 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
Imports System.Text.RegularExpressions
|
|
|
|
Public Class Part
|
|
Implements INotifyPropertyChanged
|
|
|
|
' queste variabili servono per getsire le ripezioni dei messaggi durante il caricamento degli assemblati
|
|
|
|
' in fase di lettura diventa vero dopo aver caricato il primo dei part del ddf
|
|
Friend Shared bFirstConfigRead As Boolean = False
|
|
' questa variabile è stata definita condovisa per permettere di essere inizializzata alla prima lettura del DDF
|
|
Public Shared FirstReadingEdge As Boolean = False
|
|
' per disabilitare la richiesta di confermare la configurazione
|
|
Public Shared LastPartName As String = String.Empty
|
|
|
|
' costruisco il riferimento con l'oggetto PartDoor che ospita il Part
|
|
Private m_refPartDoor As PartDoor
|
|
' blocco il processo di avanzamente di lettura delle righe
|
|
Private m_StopNextIndexLine As Boolean = False
|
|
|
|
Public Property refPartDoor As PartDoor
|
|
Get
|
|
Return m_refPartDoor
|
|
End Get
|
|
Set(value As PartDoor)
|
|
m_refPartDoor = value
|
|
End Set
|
|
End Property
|
|
|
|
#Region "GENERAL"
|
|
|
|
#Region "Nuove proprietà delle parti"
|
|
|
|
' serve ad attribuire il nome all'oggetto che stiamo per creare (Il vecchio frame ora indicato nel DDF come piece)
|
|
Private m_TypePart As String
|
|
Public Property TypePart As String
|
|
Get
|
|
Return m_TypePart
|
|
End Get
|
|
Set(value As String)
|
|
m_TypePart = value
|
|
NotifyPropertyChanged("TypePart")
|
|
End Set
|
|
End Property
|
|
|
|
' per sapere quale tipo versione è il file
|
|
Private m_Version As String = "1"
|
|
Public Property Version As String
|
|
Get
|
|
Return m_Version
|
|
End Get
|
|
Set(value As String)
|
|
m_Version = value
|
|
RegexFunction.sCurrVersionDoor = m_Version
|
|
End Set
|
|
End Property
|
|
|
|
' per sapere se il check è attivo (nella modalità assembalto)
|
|
Private m_IsActive As Boolean
|
|
Public Property IsActive As Boolean
|
|
Get
|
|
Return m_IsActive
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_IsActive = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public Sub SetIsActive(bIsActive As Boolean)
|
|
m_IsActive = bIsActive
|
|
NotifyPropertyChanged("IsActive")
|
|
End Sub
|
|
|
|
' lista delle disposizioni da mostrare a video (bevel)
|
|
Friend Shared m_DispositionList As New ObservableCollection(Of EdgeType)
|
|
Public ReadOnly Property DispositionList As ObservableCollection(Of EdgeType)
|
|
Get
|
|
Return m_DispositionList
|
|
End Get
|
|
End Property
|
|
|
|
' elemento selezionato dalla lista delle disposizinioni (bevel)
|
|
Private m_DispositionItem As EdgeType
|
|
Public Property DispositionItem As EdgeType
|
|
Get
|
|
Return m_DispositionItem
|
|
End Get
|
|
Set(value As EdgeType)
|
|
m_DispositionItem = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
OptionModule.m_Disposition = m_DispositionItem
|
|
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
|
|
|
|
#End Region ' Nuove proprietà delle parti
|
|
|
|
#Region "Info Generali del ddf"
|
|
|
|
Private m_Measure As String
|
|
Public Property Measure As String
|
|
Get
|
|
Return m_Measure
|
|
End Get
|
|
Set(value As String)
|
|
m_Measure = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Code As String
|
|
Public Property Code As String
|
|
Get
|
|
Return m_Code
|
|
End Get
|
|
Set(value As String)
|
|
m_Code = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Customer As String
|
|
Public Property Customer As String
|
|
Get
|
|
Return m_Customer
|
|
End Get
|
|
Set(value As String)
|
|
m_Customer = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Elevation As String
|
|
Public Property Elevation As String
|
|
Get
|
|
Return m_Elevation
|
|
End Get
|
|
Set(value As String)
|
|
m_Elevation = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Project As String
|
|
Public Property Project As String
|
|
Get
|
|
Return m_Project
|
|
End Get
|
|
Set(value As String)
|
|
m_Project = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_PO As String
|
|
Public Property PO As String
|
|
Get
|
|
Return m_PO
|
|
End Get
|
|
Set(value As String)
|
|
m_PO = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Line As String
|
|
Public Property Line As String
|
|
Get
|
|
Return m_Line
|
|
End Get
|
|
Set(value As String)
|
|
m_Line = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Date As String
|
|
Public Property DatePar As String
|
|
Get
|
|
Return m_Date
|
|
End Get
|
|
Set(value As String)
|
|
m_Date = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Secure As String
|
|
Public Property Secure As String
|
|
Get
|
|
Return m_Secure
|
|
End Get
|
|
Set(value As String)
|
|
m_Secure = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Info generali del ddf
|
|
|
|
#Region "PROPERTIES and MATERIAL"
|
|
' la lista dei materiali è caricta nell'init dell'OptionPage
|
|
Friend Shared m_MaterilaList As ObservableCollection(Of MaterialType)
|
|
Public Property MaterialsList As ObservableCollection(Of MaterialType)
|
|
Get
|
|
Return m_MaterilaList
|
|
End Get
|
|
Set(value As ObservableCollection(Of MaterialType))
|
|
m_MaterilaList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelectedMaterial As MaterialType
|
|
Public Property SelectedMaterial As MaterialType
|
|
Get
|
|
Return m_SelectedMaterial
|
|
End Get
|
|
Set(value As MaterialType)
|
|
m_SelectedMaterial = value
|
|
If Not IsNothing(value) Then
|
|
' ogni volta che cambio la selezione del materiale azzero tutte le selezioni delle proprietà
|
|
If Not IsNothing(m_SelectedMaterial.PropertiesList) Then
|
|
For Each ItemProperty In m_SelectedMaterial.PropertiesList
|
|
ItemProperty.IsChecked = False
|
|
Next
|
|
PropertiesList = m_SelectedMaterial.PropertiesList
|
|
'm_SelectedProperty = m_PropertiesList(0)
|
|
PropertiesIsVisible = Visibility.Visible
|
|
Else
|
|
PropertiesIsVisible = Visibility.Collapsed
|
|
End If
|
|
NotifyPropertyChanged("SelectedMaterial")
|
|
OptionModule.m_CurrMaterial = m_SelectedMaterial
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub SetMaterial(ItemMaterial As MaterialType)
|
|
For Each Item In m_MaterilaList
|
|
If ItemMaterial.NameDDF = Item.NameDDF Then
|
|
m_SelectedMaterial = Item
|
|
OptionModule.m_CurrMaterial = m_SelectedMaterial
|
|
' ogni volta che cambio la selezione del materiale azzero tutte le selezioni delle proprietà
|
|
If Not IsNothing(m_SelectedMaterial.PropertiesList) Then
|
|
If m_SelectedMaterial.PropertiesList.Count > 0 Then
|
|
For Each ItemProperty In m_SelectedMaterial.PropertiesList
|
|
'ItemProperty.IsChecked = False
|
|
Next
|
|
m_PropertiesList = m_SelectedMaterial.PropertiesList
|
|
m_SelectedProperty = m_PropertiesList(0)
|
|
PropertiesIsVisible = Visibility.Visible
|
|
Else
|
|
PropertiesIsVisible = Visibility.Collapsed
|
|
End If
|
|
Else
|
|
PropertiesIsVisible = Visibility.Collapsed
|
|
End If
|
|
Exit For
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Public ReadOnly Property MaterialIsVisible As Visibility
|
|
Get
|
|
Return OptionModule.m_MaterialIsVisible
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ShowPropeperty As Visibility
|
|
Get
|
|
If OptionModule.m_MaterialIsVisible <> Visibility.Visible And m_PropertiesIsVisible = Visibility.Visible Then
|
|
Return Visibility.Visible
|
|
Else
|
|
Return Visibility.Collapsed
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_PropertiesList As New ObservableCollection(Of PropertyItem)
|
|
Public Property PropertiesList As ObservableCollection(Of PropertyItem)
|
|
Get
|
|
Return m_PropertiesList
|
|
End Get
|
|
Set(value As ObservableCollection(Of PropertyItem))
|
|
m_PropertiesList = value
|
|
If Not IsNothing(m_PropertiesList) AndAlso m_PropertiesList.Count > 0 Then
|
|
Try
|
|
m_SelectedProperty = m_PropertiesList.First(Function(x) x.Name = NONE_DDF)
|
|
Catch ex As Exception
|
|
m_SelectedProperty = m_PropertiesList(0)
|
|
End Try
|
|
NotifyPropertyChanged("SelectedProperty")
|
|
End If
|
|
NotifyPropertyChanged("PropertiesList")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Set
|
|
End Property
|
|
|
|
' seleziona la lista delle proprietà senza aggiornare il disegno della porta
|
|
Public Sub SetPropertiesList(ByVal List As ObservableCollection(Of PropertyItem))
|
|
If Not IsNothing(m_PropertiesList) AndAlso m_PropertiesList.Count > 0 Then
|
|
Try
|
|
m_SelectedProperty = m_PropertiesList.First(Function(x) x.Name = NONE_DDF)
|
|
Catch ex As Exception
|
|
m_SelectedProperty = m_PropertiesList(0)
|
|
End Try
|
|
NotifyPropertyChanged("SelectedProperty")
|
|
End If
|
|
NotifyPropertyChanged("PropertiesList")
|
|
End Sub
|
|
|
|
Private m_SelectedProperty As PropertyItem
|
|
Public Property SelectedProperty As PropertyItem
|
|
Get
|
|
Return m_SelectedProperty
|
|
End Get
|
|
Set(value As PropertyItem)
|
|
m_SelectedProperty = value
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
NotifyPropertyChanged("SelectedProperty")
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub SetProperty(ByVal SelProperty As PropertyItem)
|
|
m_SelectedProperty = SelProperty
|
|
NotifyPropertyChanged("SelectedProperty")
|
|
End Sub
|
|
|
|
Private m_PropertiesIsVisible As Visibility = OptionModule.m_DisableProperties
|
|
Public Property PropertiesIsVisible As Visibility
|
|
Get
|
|
Return m_PropertiesIsVisible
|
|
End Get
|
|
Set(value As Visibility)
|
|
If m_PropertiesIsVisible <> Visibility.Visible Then Return
|
|
m_PropertiesIsVisible = value
|
|
NotifyPropertyChanged("PropertiesIsVisible")
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Properties and Material
|
|
|
|
#Region "SIZE"
|
|
|
|
Private m_Height As String
|
|
Public Property Height As String
|
|
Get
|
|
Return m_Height
|
|
End Get
|
|
Set(value As String)
|
|
m_Height = value
|
|
Dim dHeight As Double
|
|
If StringToDouble(value, dHeight) Then
|
|
EgtLuaSetGlobNumVar("H", dHeight)
|
|
End If
|
|
NotifyPropertyChanged("ToolTipEvaluatedThickness")
|
|
NotifyPropertyChanged("ToolTipEvaluatedWidth")
|
|
NotifyPropertyChanged("ToolTipEvaluatedHeight")
|
|
'SetVarSize()
|
|
UpdateToolTip()
|
|
NotifyPropertyChanged("Height")
|
|
If Not Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
|
|
Map.refAssemblyPageVM.CurrAssembly.SetDimension("Height")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End If
|
|
End Set
|
|
End Property
|
|
Public Sub SetHeight(sHeight As String)
|
|
m_Height = sHeight
|
|
Dim dHeight As Double
|
|
If StringToDouble(sHeight, dHeight) Then
|
|
EgtLuaSetGlobNumVar("H", dHeight)
|
|
End If
|
|
NotifyPropertyChanged("Height")
|
|
NotifyPropertyChanged("ToolTipEvaluatedHeight")
|
|
If Not Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End If
|
|
End Sub
|
|
Public ReadOnly Property ToolTipEvaluatedHeight As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_Height, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_Width As String = String.Empty
|
|
Public Property Width As String
|
|
Get
|
|
Return m_Width
|
|
End Get
|
|
Set(value As String)
|
|
m_Width = value
|
|
Dim dWidth As Double
|
|
If StringToDouble(value, dWidth) Then
|
|
EgtLuaSetGlobNumVar("W", dWidth)
|
|
End If
|
|
NotifyPropertyChanged("ToolTipEvaluatedThickness")
|
|
NotifyPropertyChanged("ToolTipEvaluatedWidth")
|
|
NotifyPropertyChanged("ToolTipEvaluatedHeight")
|
|
'SetVarSize()
|
|
UpdateToolTip()
|
|
Map.refAssemblyPageVM.CurrAssembly.SetDimension("Width")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public Sub SetWidth(sWidth As String)
|
|
m_Width = sWidth
|
|
Dim dWidth As Double
|
|
If StringToDouble(sWidth, dWidth) Then
|
|
EgtLuaSetGlobNumVar("W", dWidth)
|
|
End If
|
|
NotifyPropertyChanged("Width")
|
|
NotifyPropertyChanged("ToolTipEvaluatedWidth")
|
|
If Not Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End If
|
|
End Sub
|
|
Public ReadOnly Property ToolTipEvaluatedWidth As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_Width, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_Thickness As String
|
|
Public Property Thickness As String
|
|
Get
|
|
Return m_Thickness
|
|
End Get
|
|
Set(value As String)
|
|
m_Thickness = value
|
|
Dim dThickness As Double
|
|
If StringToDouble(value, dThickness) Then
|
|
EgtLuaSetGlobNumVar("T", dThickness)
|
|
End If
|
|
NotifyPropertyChanged("ToolTipEvaluatedThickness")
|
|
NotifyPropertyChanged("ToolTipEvaluatedWidth")
|
|
NotifyPropertyChanged("ToolTipEvaluatedHeight")
|
|
'SetVarSize()
|
|
UpdateToolTip()
|
|
Map.refAssemblyPageVM.CurrAssembly.SetDimension("Thickness")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public Sub SetThickness(sThickness As String)
|
|
m_Thickness = sThickness
|
|
Dim dThickness As Double
|
|
If StringToDouble(sThickness, dThickness) Then
|
|
EgtLuaSetGlobNumVar("T", dThickness)
|
|
End If
|
|
NotifyPropertyChanged("Thickness")
|
|
NotifyPropertyChanged("ToolTipEvaluatedThickness")
|
|
If Not Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End If
|
|
End Sub
|
|
Public ReadOnly Property ToolTipEvaluatedThickness As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_Thickness, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Size
|
|
|
|
#Region "WEIGHT"
|
|
|
|
Private m_Weight As String
|
|
Public Property Weight As String
|
|
Get
|
|
If String.IsNullOrEmpty(m_Weight) Then
|
|
m_Weight = OptionModule.m_Weight
|
|
End If
|
|
Return m_Weight
|
|
End Get
|
|
Set(value As String)
|
|
m_Weight = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
NotifyPropertyChanged("ToolTipEvaluatedWeight")
|
|
End Set
|
|
End Property
|
|
Public ReadOnly Property ToolTipEvaluatedWeight As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_Weight, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private Shared m_IsCheckedWeight As Visibility
|
|
Public Shared Property IsCheckedWeight As Visibility
|
|
Get
|
|
Return m_IsCheckedWeight
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_IsCheckedWeight = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property VisibilityWeight As Visibility
|
|
Get
|
|
Return m_IsCheckedWeight
|
|
End Get
|
|
Set(value As Visibility)
|
|
If m_IsCheckedWeight <> value Then
|
|
m_IsCheckedWeight = value
|
|
End If
|
|
NotifyPropertyChanged("VisibilityWeight")
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Weight
|
|
|
|
#Region "SWING"
|
|
|
|
Public ReadOnly Property VisibilityInvertBevel As Visibility
|
|
Get
|
|
Return OptionModule.m_DisableInvertBevel
|
|
End Get
|
|
End Property
|
|
|
|
' lista degli Swing
|
|
Private m_SwingTypeList As New List(Of String)
|
|
Public Property SwingTypeList As List(Of String)
|
|
Get
|
|
Return m_SwingTypeList
|
|
End Get
|
|
Set(value As List(Of String))
|
|
m_SwingTypeList = value
|
|
'NotifyPropertyChanged("SwingTypeList")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SwingAlias As SwingItemTypeList = Nothing
|
|
Public Property SwingAlias As SwingItemTypeList
|
|
Get
|
|
Return m_SwingAlias
|
|
End Get
|
|
Set(value As SwingItemTypeList)
|
|
m_SwingAlias = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Swing As String = Nothing
|
|
Public Property Swing As String
|
|
Get
|
|
' abilita il pulsante per invertire il bevel sulla lock
|
|
If m_Swing.Contains("I") Then
|
|
Map.refPartPageVM.IsInactive = True
|
|
Else
|
|
Map.refPartPageVM.IsInactive = False
|
|
End If
|
|
Return m_Swing
|
|
End Get
|
|
Set(value As String)
|
|
m_Swing = value
|
|
OptionModule.SetCurrSwing(m_SwingAlias, value)
|
|
m_Swing = m_SwingAlias.AliasName
|
|
NotifyPropertyChanged("Swing")
|
|
Map.refAssemblyPageVM.CurrAssembly.SetDimension("Swing")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
' aggiorno la grafica
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Set
|
|
End Property
|
|
|
|
Public Sub SetSwing(sSwing As String)
|
|
OptionModule.SetCurrSwing(m_SwingAlias, sSwing)
|
|
m_Swing = m_SwingAlias.AliasName
|
|
NotifyPropertyChanged("Swing")
|
|
End Sub
|
|
|
|
#End Region ' Swing
|
|
|
|
#Region "EDGE"
|
|
|
|
Friend Shared m_LockEdgeTypeList As New ObservableCollection(Of EdgeType)
|
|
Friend Shared m_HingeEdgeTypeList As New ObservableCollection(Of EdgeType)
|
|
Friend Shared m_BottomEdgeTypeList As New ObservableCollection(Of EdgeType)
|
|
Friend Shared m_TopEdgeTypeList As New ObservableCollection(Of EdgeType)
|
|
|
|
Public ReadOnly Property LockEdgeTypeList As ObservableCollection(Of EdgeType)
|
|
Get
|
|
' restituisco il valore della lista che è stato creato all'avvio
|
|
If m_TypePart.Contains(ConstGen.PART_DO_) Then
|
|
Return m_LockEdgeTypeList
|
|
Else ' se stiamo leggendo un frame carico la lista dei bevel dei frame
|
|
Return Assembly.m_FrameEdgeTypeList
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property HingeEdgeTypeList As ObservableCollection(Of EdgeType)
|
|
Get
|
|
' restituisco il valore della lista che è stato creato all'avvio
|
|
If m_TypePart.Contains(ConstGen.PART_DO_) Then
|
|
Return m_HingeEdgeTypeList
|
|
Else ' se stiamo leggendo un frame carico la lista dei bevel dei frame
|
|
Return Assembly.m_FrameEdgeTypeList
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property BottomEdgeTypeList As ObservableCollection(Of EdgeType)
|
|
Get
|
|
' restituisco il valore della lista che è stato creato all'avvio
|
|
If m_TypePart.Contains(ConstGen.PART_DO_) Then
|
|
Return m_BottomEdgeTypeList
|
|
Else ' se stiamo leggendo un frame carico la lista dei bevel dei frame
|
|
Return Assembly.m_FrameEdgeTypeList
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property TopEdgeTypeList As ObservableCollection(Of EdgeType)
|
|
Get
|
|
' restituisco il valore della lista che è stato creato all'avvio
|
|
If m_TypePart.Contains(ConstGen.PART_DO_) Then
|
|
Return m_TopEdgeTypeList
|
|
Else ' se stiamo leggendo un frame carico la lista dei bevel dei frame
|
|
Return Assembly.m_FrameEdgeTypeList
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_LockEdgeType As New EdgeType("", Visibility.Visible)
|
|
Public Property LockEdgeType As EdgeType
|
|
Get
|
|
Return m_LockEdgeType
|
|
End Get
|
|
Set(value As EdgeType)
|
|
m_LockEdgeType = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Set
|
|
End Property
|
|
Public Sub SetLockEdgeType(LockEdgeType As EdgeType)
|
|
m_LockEdgeType = LockEdgeType
|
|
NotifyPropertyChanged("LockEdgeType")
|
|
End Sub
|
|
|
|
Private m_HingeEdgeType As New EdgeType("", Visibility.Visible)
|
|
Public Property HingeEdgeType As EdgeType
|
|
Get
|
|
NotifyPropertyChanged("EdgeTypeList")
|
|
Return m_HingeEdgeType
|
|
End Get
|
|
Set(value As EdgeType)
|
|
m_HingeEdgeType = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Set
|
|
End Property
|
|
Public Sub SetHingeEdgeType(HingeEdgeType As EdgeType)
|
|
m_HingeEdgeType = HingeEdgeType
|
|
NotifyPropertyChanged("HingeEdgeType")
|
|
End Sub
|
|
|
|
Private m_TopType As New EdgeType("", Visibility.Visible)
|
|
Public Property TopType As EdgeType
|
|
Get
|
|
Return m_TopType
|
|
End Get
|
|
Set(value As EdgeType)
|
|
m_TopType = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Set
|
|
End Property
|
|
Public Sub SetTopType(TopType As EdgeType)
|
|
m_TopType = TopType
|
|
NotifyPropertyChanged("TopType")
|
|
End Sub
|
|
|
|
Private m_BottomType As New EdgeType("", Visibility.Visible)
|
|
Public Property BottomType As EdgeType
|
|
Get
|
|
Return m_BottomType
|
|
End Get
|
|
Set(value As EdgeType)
|
|
m_BottomType = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Set
|
|
End Property
|
|
Public Sub SetBottomType(BottomType As EdgeType)
|
|
m_BottomType = BottomType
|
|
NotifyPropertyChanged("BottomType")
|
|
End Sub
|
|
|
|
Private m_InvertBevel As Boolean = False
|
|
Public Property InvertBevel As Boolean
|
|
Get
|
|
Return m_InvertBevel
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_InvertBevel = value
|
|
NotifyPropertyChanged("InvertBevel")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Set
|
|
End Property
|
|
Public Sub SetInvertBevel(bInvertBevel As Boolean)
|
|
m_InvertBevel = bInvertBevel
|
|
NotifyPropertyChanged("InvertBevel")
|
|
End Sub
|
|
|
|
#End Region ' Edge
|
|
|
|
#Region "RESIZE"
|
|
|
|
Private m_ResizeLockHinge As Boolean
|
|
Public Property ResizeLockHinge As Boolean
|
|
Get
|
|
Return m_ResizeLockHinge
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_ResizeLockHinge = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
|
|
Private m_ResizeTopBottom As Boolean
|
|
Public Property ResizeTopBottom As Boolean
|
|
Get
|
|
Return m_ResizeTopBottom
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_ResizeTopBottom = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Resize
|
|
|
|
#Region "MACHINING"
|
|
|
|
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
|
|
End Set
|
|
End Property
|
|
|
|
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
|
|
End Set
|
|
End Property
|
|
|
|
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
|
|
End Set
|
|
End Property
|
|
|
|
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
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Machining
|
|
|
|
#Region "OVERMATERIAL"
|
|
|
|
Public ReadOnly Property ToolTipEvaluatedLockOverMaterial As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_LockEdgeOverMaterial, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ToolTipEvaluatedHingeOverMaterial As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_HingeEdgeOverMaterial, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ToolTipEvaluatedTopOverMaterial As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_TopOverMaterial, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ToolTipEvaluatedBottomOverMaterial As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_BottomOverMaterial, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_LockEdgeOverMaterial As String = String.Empty
|
|
Public Property LockEdgeOverMaterial As String
|
|
Get
|
|
Return m_LockEdgeOverMaterial
|
|
End Get
|
|
Set(value As String)
|
|
m_LockEdgeOverMaterial = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
NotifyPropertyChanged("ToolTipEvaluatedLockOverMaterial")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_HingeEdgeOverMaterial As String = String.Empty
|
|
Public Property HingeEdgeOverMaterial As String
|
|
Get
|
|
Return m_HingeEdgeOverMaterial
|
|
End Get
|
|
Set(value As String)
|
|
m_HingeEdgeOverMaterial = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
NotifyPropertyChanged("ToolTipEvaluatedHingeOverMaterial")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_TopOverMaterial As String = String.Empty
|
|
Public Property TopOverMaterial As String
|
|
Get
|
|
Return m_TopOverMaterial
|
|
End Get
|
|
Set(value As String)
|
|
m_TopOverMaterial = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
NotifyPropertyChanged("ToolTipEvaluatedTopOverMaterial")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_BottomOverMaterial As String = String.Empty
|
|
Public Property BottomOverMaterial As String
|
|
Get
|
|
Return m_BottomOverMaterial
|
|
End Get
|
|
Set(value As String)
|
|
m_BottomOverMaterial = value
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
NotifyPropertyChanged("ToolTipEvaluatedBottomOverMaterial")
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' OverMaterial
|
|
|
|
#Region "CUT"
|
|
|
|
Private m_CutIsChecked As Boolean = False
|
|
Public Property CutIsChecked As Boolean
|
|
Get
|
|
Return m_CutIsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_CutIsChecked = value
|
|
' Gestione dell'aggiunta della componente
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Set
|
|
End Property
|
|
|
|
Private m_PosCut As String = "0"
|
|
Public Property PosCut As String
|
|
Get
|
|
Return m_PosCut
|
|
End Get
|
|
Set(value As String)
|
|
m_PosCut = value
|
|
NotifyPropertyChanged("PosCut")
|
|
NotifyPropertyChanged("ToolTipEvaluatedPosCut")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public ReadOnly Property ToolTipEvaluatedPosCut As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_PosCut, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_CutDirectionList As New List(Of String) From {"Horizontal", "Vertical"}
|
|
Public ReadOnly Property CutDirectionList As List(Of String)
|
|
Get
|
|
Return m_CutDirectionList
|
|
End Get
|
|
End Property
|
|
Private m_SelectedDirection As String = m_CutDirectionList(0)
|
|
Public Property SelectedDirection As String
|
|
Get
|
|
Return m_SelectedDirection
|
|
End Get
|
|
Set(value As String)
|
|
m_SelectedDirection = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Cut
|
|
|
|
#Region "Position"
|
|
|
|
Private m_Position As New List(Of String) From {"0", "0", "0"}
|
|
Public Property Position As List(Of String)
|
|
Get
|
|
Return m_Position
|
|
End Get
|
|
Set(value As List(Of String))
|
|
m_Position = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Position
|
|
|
|
Private m_TopShapeIsChecked As Boolean = False
|
|
Public Property TopShapeIsChecked As Boolean
|
|
Get
|
|
Return m_TopShapeIsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_TopShapeIsChecked = value
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Set
|
|
End Property
|
|
|
|
Private Property m_TopShapeList As New List(Of TopShape) From {New TopShape(EgtMsg(50707)), New TopShape(EgtMsg(50708))}
|
|
Public ReadOnly Property TopShapeList As List(Of TopShape)
|
|
Get
|
|
Return m_TopShapeList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_SelectedShape As TopShape = m_TopShapeList(0)
|
|
Public Property SelectedShape As TopShape
|
|
Get
|
|
Return m_SelectedShape
|
|
End Get
|
|
Set(value As TopShape)
|
|
m_SelectedShape = value
|
|
If value.Name.Trim() = m_TopShapeList(0).Name.Trim Then
|
|
TopArcIsChecked = True
|
|
TopAngleIsChecked = False
|
|
ElseIf value.Name.Trim() = m_TopShapeList(1).Name.Trim Then
|
|
TopAngleIsChecked = True
|
|
TopArcIsChecked = False
|
|
End If
|
|
NotifyPropertyChanged("VisibilityTopArch")
|
|
NotifyPropertyChanged("VisibilityTopAngle")
|
|
End Set
|
|
End Property
|
|
|
|
#Region "TOP ARC"
|
|
|
|
Private m_Radius As String = "W"
|
|
Public Property Radius As String
|
|
Get
|
|
Return m_Radius
|
|
End Get
|
|
Set(value As String)
|
|
m_Radius = value
|
|
NotifyPropertyChanged("Radius")
|
|
NotifyPropertyChanged("ToolTipEvaluatedRadius")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public ReadOnly Property ToolTipEvaluatedRadius As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_Radius, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_Posx As String = "0"
|
|
Public Property Posx As String
|
|
Get
|
|
Return m_Posx
|
|
End Get
|
|
Set(value As String)
|
|
m_Posx = value
|
|
NotifyPropertyChanged("Posx")
|
|
NotifyPropertyChanged("ToolTipEvaluatedPosx")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public ReadOnly Property ToolTipEvaluatedPosx As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_Posx, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_TopArcIsChecked As Boolean = True
|
|
Public Property TopArcIsChecked As Boolean
|
|
Get
|
|
Return m_TopArcIsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_TopArcIsChecked = value
|
|
If m_TopAngleIsChecked And m_TopArcIsChecked Then
|
|
m_TopAngleIsChecked = Not value
|
|
NotifyPropertyChanged("TopAngleIsChecked")
|
|
End If
|
|
NotifyPropertyChanged("TopArcIsChecked")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Set
|
|
End Property
|
|
|
|
Private m_VisibilityTopArch As Visibility = Visibility.Visible
|
|
Public ReadOnly Property VisibilityTopArch As Visibility
|
|
Get
|
|
If m_TopArcIsChecked Then
|
|
m_VisibilityTopArch = Visibility.Visible
|
|
Else
|
|
m_VisibilityTopArch = Visibility.Hidden
|
|
End If
|
|
Return m_VisibilityTopArch
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Top Arc
|
|
|
|
#Region "TOP ANGLE"
|
|
|
|
Private m_Angle As String = "0"
|
|
Public Property Angle As String
|
|
Get
|
|
Return m_Angle
|
|
End Get
|
|
Set(value As String)
|
|
m_Angle = value
|
|
NotifyPropertyChanged("Angle")
|
|
NotifyPropertyChanged("ToolTipEvaluatedAngle")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public ReadOnly Property ToolTipEvaluatedAngle As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_Angle, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_PosxAngle As String = "W/2"
|
|
Public Property PosxAngle As String
|
|
Get
|
|
Return m_PosxAngle
|
|
End Get
|
|
Set(value As String)
|
|
m_PosxAngle = value
|
|
NotifyPropertyChanged("PosxAngle")
|
|
NotifyPropertyChanged("ToolTipEvaluatedPosxAngle")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
End Set
|
|
End Property
|
|
Public ReadOnly Property ToolTipEvaluatedPosxAngle As String
|
|
Get
|
|
Dim dVal As Double
|
|
If StringToDouble(m_PosxAngle, dVal) Then
|
|
Return DoubleToString(dVal, 4)
|
|
Else
|
|
Return EgtMsg(50143)
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_TopAngleIsChecked As Boolean
|
|
Public Property TopAngleIsChecked As Boolean
|
|
Get
|
|
Return m_TopAngleIsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_TopAngleIsChecked = value
|
|
If m_TopArcIsChecked And m_TopAngleIsChecked Then
|
|
m_TopArcIsChecked = Not value
|
|
NotifyPropertyChanged("TopArcIsChecked")
|
|
End If
|
|
NotifyPropertyChanged("TopAngleIsChecked")
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
End Set
|
|
End Property
|
|
|
|
Private m_VisibilityTopAngle As Visibility = Visibility.Hidden
|
|
Public ReadOnly Property VisibilityTopAngle As Visibility
|
|
Get
|
|
If m_TopAngleIsChecked Then
|
|
m_VisibilityTopAngle = Visibility.Visible
|
|
Else
|
|
m_VisibilityTopAngle = Visibility.Hidden
|
|
End If
|
|
Return m_VisibilityTopAngle
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Top Angle
|
|
|
|
#Region "OPTIONS"
|
|
|
|
Private m_sOptions As String = String.Empty
|
|
|
|
Public Property sOptions As String
|
|
Get
|
|
Return m_sOptions
|
|
End Get
|
|
Set(value As String)
|
|
m_sOptions = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Options
|
|
|
|
#End Region ' General
|
|
|
|
' lista delle componenti
|
|
Friend m_CompoList As New ObservableCollection(Of Compo)
|
|
Public Property CompoList As ObservableCollection(Of Compo)
|
|
Get
|
|
Return m_CompoList
|
|
End Get
|
|
Set(value As ObservableCollection(Of Compo))
|
|
m_CompoList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelCompo As Compo
|
|
Public Property SelCompo As Compo
|
|
Get
|
|
Return m_SelCompo
|
|
End Get
|
|
Set(value As Compo)
|
|
m_SelCompo = value
|
|
MarkCompoInScena()
|
|
End Set
|
|
End Property
|
|
|
|
#Region "AddCompo"
|
|
|
|
' utilizzata nell'Hardware
|
|
Friend Function AddNewHardware(HardwareGeneral As CompoType, TempHardwFile As String) As Boolean
|
|
' disabilito la costruzione del riferimento
|
|
Assembly.BuiltReffCompo = False
|
|
' creo la stringa che contiene la lista degli errori
|
|
Dim ErrorList As String = String.Empty
|
|
' creo il nuovo compo
|
|
Dim NewCompo As New Compo(HardwareGeneral, True)
|
|
' Leggo il file ini del componente per vedere se c'è il template: se c'è
|
|
If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME) <> 0 Then
|
|
' leggo nomi
|
|
Dim Name As String = String.Empty
|
|
Dim DDFName As String = String.Empty
|
|
IniFile.GetPrivateProfileCompoName(S_TEMPLATE, K_NAME, DDFName, Name, HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME)
|
|
' aggiungo il template come parametro
|
|
NewCompo.TemplateDDFName = DDFName
|
|
NewCompo.TemplateName = Name
|
|
NewCompo.LoadDefaultFromLua = True
|
|
NewCompo.SetTemplateSelItem(TempHardwFile)
|
|
' se non c'è il template
|
|
Else
|
|
' nascondo il template
|
|
NewCompo.TemplateVisibility = Visibility.Collapsed
|
|
' leggo il nome del compo dal file config.ini
|
|
Dim sTemplateName As String = String.Empty
|
|
EgtUILib.GetPrivateProfileString(S_TEMPLATE, K_COMPO, "", sTemplateName, HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME)
|
|
If String.IsNullOrWhiteSpace(sTemplateName) Then
|
|
ErrorList &= String.Format(EgtMsg(50122), K_COMPO, NewCompo.TemplateName)
|
|
NewCompo = Nothing
|
|
ElseIf Not File.Exists(HardwareGeneral.Path & "\" & sTemplateName & LUA_EXTENSION) Then
|
|
ErrorList &= String.Format(EgtMsg(50122), K_COMPO, NewCompo.TemplateName)
|
|
NewCompo = Nothing
|
|
Else
|
|
NewCompo.LoadDefaultFromLua = True
|
|
NewCompo.TemplateSelItem = sTemplateName
|
|
End If
|
|
End If
|
|
If Not IsNothing(NewCompo) Then
|
|
CompoList.Add(NewCompo)
|
|
Return True
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
'Gestione ComboBox e TextBox di ogni compo della pulsantiera letta da Compo.ini (Door)
|
|
Friend Function AddNewCompo(CurrCompoType As CompoType, Optional IsFrame As Boolean = False, Optional IndecRefCompo As Integer = -1) As Compo
|
|
Dim FileNameComplete As String = String.Empty
|
|
' riconosco il part su cui sto aggiungendo la componente
|
|
Dim CurrPartDoor As PartDoor = Map.refAssemblyManagerVM.ReserchPartDoor(Me.TypePart)
|
|
If Not IsNothing(CurrPartDoor) Then
|
|
For Each Compo In CurrPartDoor.Door.CompoList
|
|
Compo.BorderColor = DirectCast(New BrushConverter().ConvertFrom("#DCDCDC"), SolidColorBrush)
|
|
Compo.BackGroundColor = DirectCast(New BrushConverter().ConvertFrom("#FFFFFF"), SolidColorBrush)
|
|
Compo.Foreground = DirectCast(New BrushConverter().ConvertFrom("#000000"), SolidColorBrush)
|
|
Compo.BorderThickness = 1
|
|
Compo.FontBold = FontWeights.Normal
|
|
Next
|
|
End If
|
|
|
|
' creo la stringa che contiene la lista degli errori
|
|
Dim ErrorList As String = String.Empty
|
|
' creo il nuovo oggetto compo
|
|
Dim NewCompo As New Compo(CurrCompoType, True)
|
|
' Leggo il file ini del componente per vedere se c'è il template: se c'è
|
|
If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME) <> 0 Then
|
|
' leggo nomi della componente scritti nel file di configurazione
|
|
Dim Name As String = String.Empty
|
|
Dim DDFName As String = String.Empty
|
|
IniFile.GetPrivateProfileCompoName(S_TEMPLATE, K_NAME, DDFName, Name, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME)
|
|
NewCompo.TemplateDDFName = DDFName
|
|
NewCompo.TemplateName = Name
|
|
LoadBrandFileList(NewCompo, IsFrame)
|
|
' se il caricamneto fallisse allora NewCompo = Nothing
|
|
Else
|
|
' nascondo il template
|
|
NewCompo.TemplateVisibility = Visibility.Collapsed
|
|
' leggo il nome del compo dal file config.ini ( il nome del file lua che deve essere caricato)
|
|
Dim sTemplateName As String = String.Empty
|
|
EgtUILib.GetPrivateProfileString(S_TEMPLATE, K_COMPO, "", sTemplateName, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME)
|
|
' se il nome non esiste oppure non è associato alcun file elimina l'oggetto
|
|
If String.IsNullOrWhiteSpace(sTemplateName) Then
|
|
' Errore nella lettura {0} nel parametro {1} della componente.
|
|
ErrorList &= String.Format(EgtMsg(50122), K_COMPO, NewCompo.TemplateName)
|
|
NewCompo = Nothing
|
|
ElseIf Not File.Exists(CurrCompoType.Path & "\" & sTemplateName & LUA_EXTENSION) Then
|
|
' Errore nella lettura {0} nel parametro {1} della componente.
|
|
ErrorList &= String.Format(EgtMsg(50122), K_COMPO, NewCompo.TemplateName)
|
|
NewCompo = Nothing
|
|
Else
|
|
' alrimenti seleziono il nome
|
|
NewCompo.TemplateSelItem = sTemplateName
|
|
End If
|
|
End If
|
|
|
|
' se è stata generata la componente
|
|
If Not IsNothing(NewCompo) Then
|
|
' raggruppo tutte le componenti che hanno lo stesso nome vicine
|
|
' se trova già una componente allora l'inserimento avviene nel ciclo for
|
|
Dim bInsert = False
|
|
Dim CompoIndex = 0
|
|
For CompoIndex = 0 To m_CompoList.Count - 1
|
|
' inserisco la nuova componente
|
|
If NewCompo.CompoType.DDFName = m_CompoList(CompoIndex).CompoType.DDFName Then
|
|
' cerco l'ultima componente con lo stesso nome
|
|
Dim Lastindex As Integer = 0
|
|
Dim PrecCompo As Compo = Nothing
|
|
While CompoIndex + Lastindex < m_CompoList.Count AndAlso NewCompo.CompoType.DDFName = m_CompoList(CompoIndex + Lastindex).CompoType.DDFName
|
|
If Not m_CompoList(CompoIndex + Lastindex).LoadByDefault Then
|
|
PrecCompo = m_CompoList(CompoIndex + Lastindex)
|
|
End If
|
|
Lastindex += 1
|
|
End While
|
|
If IndecRefCompo > -1 Then
|
|
CompoList.Insert(IndecRefCompo, NewCompo)
|
|
Else
|
|
CompoList.Insert(CompoIndex + Lastindex, NewCompo)
|
|
End If
|
|
bInsert = True
|
|
If Not IsNothing(PrecCompo) AndAlso Not (IsFrame And NewCompo.CompoType.DDFName = "rabbet") Then
|
|
Map.refAssemblyPageVM.CurrAssembly.CopyParam(PrecCompo, NewCompo)
|
|
Else
|
|
AdviceHinge(NewCompo)
|
|
End If
|
|
Exit For
|
|
End If
|
|
Next
|
|
If Not bInsert Then
|
|
' se la componenteaggiunta è un a Hinge allora il nome del template da visualizzare è di una Mortise
|
|
AdviceHinge(NewCompo)
|
|
If IndecRefCompo > -1 Then
|
|
CompoList.Insert(IndecRefCompo, NewCompo)
|
|
Else
|
|
CompoList.Add(NewCompo)
|
|
End If
|
|
NewCompo.LoadDefaultFromLua = True
|
|
FileNameComplete = CurrCompoType.Path & "\" & NewCompo.TemplateSelItem & LUA_EXTENSION
|
|
If Not File.Exists(FileNameComplete) Then
|
|
FileNameComplete = FileNameComplete & LUA_EXTENSION
|
|
End If
|
|
NewCompo.ReadDefaultParamLua(FileNameComplete, NewCompo)
|
|
|
|
' se frame ed esite il parametro Side allora assegno la posizione coerente
|
|
If IsFrame Then
|
|
Dim sSideFrame As String = ""
|
|
If CurrPartDoor.Door.TypePart.Contains(ConstGen.PART_FRAME_TOP) Then
|
|
sSideFrame = ConstCompo.SIDE_TOP
|
|
ElseIf CurrPartDoor.Door.TypePart.Contains(ConstGen.PART_FRAME_BOTTOM) Then
|
|
sSideFrame = ConstCompo.SIDE_BOTTOM
|
|
ElseIf CurrPartDoor.Door.TypePart.Contains(ConstGen.HINGE) Then
|
|
sSideFrame = ConstCompo.SIDE_HINGE
|
|
ElseIf CurrPartDoor.Door.TypePart.Contains(ConstGen.LOCK) Then
|
|
sSideFrame = ConstCompo.SIDE_LOCK
|
|
End If
|
|
' ricerco nell'elenco la posizione da assegnare
|
|
For Each ItemParam In NewCompo.CompoParamList
|
|
If TypeOf ItemParam Is ComboBoxParam AndAlso Trim(ItemParam.DDFName.ToLower) = K_SIDE.ToLower Then
|
|
Dim ComboBox As ComboBoxParam = DirectCast(ItemParam, ComboBoxParam)
|
|
For IndexItem = 0 To ComboBox.ItemListDDF.Count - 1
|
|
If Trim(ComboBox.ItemListDDF(IndexItem).ToLower) = sSideFrame Then
|
|
ComboBox.SetSelItem(ComboBox.ItemList(IndexItem))
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
Next
|
|
|
|
End If
|
|
End If
|
|
' evidenzio il nome della componente appena aggiunto
|
|
'#FF4D84C4 EgaltechBlu1
|
|
'#FF7096CE EgaltechBlu2
|
|
'#FF90ABD9 EgaltechBlu3
|
|
'#FFB2C3E4 EgaltechBlu4
|
|
NewCompo.BorderColor = DirectCast(New BrushConverter().ConvertFrom("#FF4D84C4"), SolidColorBrush)
|
|
NewCompo.BackGroundColor = DirectCast(New BrushConverter().ConvertFrom("#FFFFFFFF"), SolidColorBrush)
|
|
NewCompo.Foreground = DirectCast(New BrushConverter().ConvertFrom("#FF4D84C4"), SolidColorBrush)
|
|
NewCompo.BorderThickness = 2
|
|
NewCompo.FontBold = FontWeights.Bold
|
|
m_SelCompo = NewCompo
|
|
NotifyPropertyChanged("SelCompo")
|
|
End If
|
|
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
|
|
Return NewCompo
|
|
End Function
|
|
|
|
' carica la lista di Hardware da mostrare nella grafica ( distinguendo i l'elenco destinato ai Frame)
|
|
Public Function LoadBrandFileList(ByRef NewCompo As Compo, Optional IsFrame As Boolean = False) As Boolean
|
|
Dim CurrCompoType As CompoType = NewCompo.CompoType
|
|
Dim CurrFolderList As ObservableCollection(Of CompoBrandDir)
|
|
' carico l'elenco dei direttori
|
|
If IsFrame Then
|
|
CurrFolderList = CurrCompoType.FrameFolderList
|
|
Else
|
|
CurrFolderList = CurrCompoType.FolderList
|
|
End If
|
|
NewCompo.BrandListPart = New ObservableCollection(Of String)
|
|
NewCompo.FileList = New ObservableCollection(Of String)
|
|
If CurrFolderList.Count > 0 Then
|
|
' carico nella componente l'elenco dei nome da mostrare a video
|
|
For IndexModel As Integer = 0 To CurrFolderList.Count - 1
|
|
NewCompo.BrandListPart.Add(CurrFolderList(IndexModel).ModelDirGraphic)
|
|
Next
|
|
' partendo dal fondo della lista delle componenti cerco se esiste la stessa componente, in quel caso
|
|
For CompoIndex = m_CompoList.Count - 1 To 0 Step -1
|
|
If m_CompoList(CompoIndex).CompoType.Name = CurrCompoType.Name AndAlso Not m_CompoList(CompoIndex).LoadByDefault Then
|
|
NewCompo.SetSelBrand(m_CompoList(CompoIndex).SelBrandPart)
|
|
NewCompo.SetSelFile(m_CompoList(CompoIndex).SelFile)
|
|
' esco
|
|
Return True
|
|
End If
|
|
Next
|
|
' Prendo il primo direttorio
|
|
For IndexFile As Integer = 0 To CurrFolderList(0).ModelFileList.Count - 1
|
|
NewCompo.FileList.Add(CurrFolderList(0).ModelFileList(IndexFile))
|
|
Next
|
|
NewCompo.SetSelBrand(NewCompo.BrandListPart(0))
|
|
' Carico il primo modello della lista
|
|
Dim SelItemIndex As Integer = 0
|
|
While SelItemIndex < NewCompo.FileList.Count - 1 AndAlso Path.HasExtension(NewCompo.FileList(SelItemIndex)) AndAlso Path.GetExtension(NewCompo.FileList(SelItemIndex)) = NGE_EXTENSION
|
|
SelItemIndex += 1
|
|
End While
|
|
If SelItemIndex < NewCompo.FileList.Count Then
|
|
NewCompo.SetSelFile(NewCompo.FileList(SelItemIndex))
|
|
Else
|
|
NewCompo.SetSelFile(String.Empty)
|
|
End If
|
|
Else
|
|
NewCompo = Nothing
|
|
Return False
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
' ricerca seleziona la prima hinge di tipo Mortise ( solo se l'elenco dei brand non è di tipo Frame)
|
|
Public Sub AdviceHinge(NewCompo As Compo)
|
|
' se l'elenco dei brand è di tipo Frame allora esci
|
|
If NewCompo.SelBrandPart.ToLower.Contains(FRAME_FOLDER) Then Return
|
|
|
|
Dim SelBrand As String = String.Empty
|
|
Dim SelFile As String = String.Empty
|
|
DefaultGetPrivateProfileString("AdviceHinge", BRAND_INI, "", SelBrand)
|
|
DefaultGetPrivateProfileString("AdviceHinge", BRAND_FILE_INI, "", SelFile)
|
|
|
|
If Not String.IsNullOrEmpty(SelBrand) And Not String.IsNullOrEmpty(SelFile) Then
|
|
For IndexFolder As Integer = 0 To NewCompo.CompoType.FolderList.Count - 1
|
|
If Trim(SelBrand) = NewCompo.CompoType.FolderList(IndexFolder).ModelDirGraphic Then
|
|
For IndexFile As Integer = 0 To NewCompo.CompoType.FolderList(IndexFolder).ModelFileList.Count - 1
|
|
If Trim(SelFile) = NewCompo.CompoType.FolderList(IndexFolder).ModelFileList(IndexFile) Then
|
|
NewCompo.SetSelBrand(NewCompo.CompoType.FolderList(IndexFolder).ModelDirGraphic)
|
|
NewCompo.SetSelFile(NewCompo.CompoType.FolderList(IndexFolder).ModelFileList(IndexFile))
|
|
Return
|
|
End If
|
|
Next
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
Dim ChangeHardware As Boolean = False
|
|
If NewCompo.CompoType.DDFName = "hinges" Then
|
|
' entro nel primo brand (direttorio)
|
|
For IndexFolder As Integer = 0 To NewCompo.CompoType.FolderList.Count - 1
|
|
' carico il primo file
|
|
For IndexFile As Integer = 0 To NewCompo.CompoType.FolderList(IndexFolder).ModelFileList.Count - 1
|
|
' ogni volta che inizio la lettura di un nuovo file resetto la variabile
|
|
ChangeHardware = False
|
|
Dim LocalFile As String = NewCompo.CompoType.FolderList(IndexFolder).ModelDir & "\" & NewCompo.CompoType.FolderList(IndexFolder).ModelFileList(IndexFile) & LUA_EXTENSION
|
|
If Not File.Exists(LocalFile) Then Return
|
|
Dim FileContent() As String = File.ReadAllLines(LocalFile)
|
|
For IndexLine As Integer = 0 To FileContent.Count - 1
|
|
' se il file lua contiene il numero di parametro 2
|
|
If FileContent(IndexLine).Contains("--") And FileContent(IndexLine).Contains("[Graphic parameters]") Then
|
|
For SubIndex As Integer = IndexLine + 1 To FileContent.Count - 1
|
|
If FileContent(SubIndex).Contains("--") And FileContent(SubIndex).Contains("Default") Then
|
|
Dim Items() As String = FileContent(SubIndex).Split("="c)
|
|
If Not IsNothing(Items(1)) And Trim(Items(1)) = "2" Then
|
|
ChangeHardware = True
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
End If
|
|
' termino la lettura del file corrente
|
|
Next
|
|
' prima di passare al file successivo
|
|
' se ho trovato il parametro Deafult= 2
|
|
If ChangeHardware Then
|
|
' termino la lettura del file
|
|
Exit For
|
|
Else
|
|
NewCompo.SetSelBrand(NewCompo.CompoType.FolderList(IndexFolder).ModelDirGraphic)
|
|
NewCompo.SetSelFile(NewCompo.CompoType.FolderList(IndexFolder).ModelFileList(IndexFile))
|
|
DefaultWritePrivateProfileString("AdviceHinge", BRAND_INI, NewCompo.SelBrandPart)
|
|
DefaultWritePrivateProfileString("AdviceHinge", BRAND_FILE_INI, NewCompo.SelFile)
|
|
Return
|
|
End If
|
|
' passo al Direttorio succesivo
|
|
Next
|
|
Next
|
|
End If
|
|
|
|
End Sub
|
|
|
|
#End Region 'AddCompo
|
|
|
|
#Region "Selection compo"
|
|
|
|
Public Sub ResetAllMark()
|
|
Dim nIdFirstPart As Integer = EgtGetFirstPart()
|
|
Dim nIdLay As Integer = EgtGetFirstLayer(nIdFirstPart)
|
|
While nIdLay <> GDB_ID.NULL
|
|
EgtResetMark(nIdLay)
|
|
nIdLay = EgtGetNextLayer(nIdLay)
|
|
End While
|
|
EgtDraw()
|
|
For Each ItemCompo As Compo In CompoList
|
|
ItemCompo.ResetMark()
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub MarkCompoInScena()
|
|
If IsNothing(m_SelCompo) Then Return
|
|
If GetMainPrivateProfileInt(S_GENERAL, "MarkCompo", 0) = 0 Then Return
|
|
ResetAllMark()
|
|
' recupero la lista dei compo dello stesso tipo
|
|
Dim TempList As ObservableCollection(Of Compo) = DdfFile.GetCurrentListSameCompoType(m_CompoList, m_SelCompo.CompoType.DDFName)
|
|
' recupero la lista dei compo con lo stesso nome
|
|
TempList = DdfFile.GetCurrentListSameCompoDDFName(TempList, m_SelCompo.SelFile, m_SelCompo.SelBrandPart)
|
|
' riordino la lista appena trovata secondo le regole di stampa DDF
|
|
DdfFile.GetOrderedListSameCompo(TempList)
|
|
' ontengo la posizione prevista nella grafica
|
|
Dim IndexInList As Integer = DdfFile.GetIndexInList(TempList, m_SelCompo)
|
|
' recupero la lista ordinata
|
|
Dim sCompoName As String = m_SelCompo.TemplateSelItem
|
|
' recupero il primo part disponibile
|
|
Dim nIdFirstPart As Integer = EgtGetFirstPart()
|
|
Dim nIdLay As Integer = EgtGetFirstLayer(nIdFirstPart)
|
|
Dim IndexLay As Integer = 0
|
|
While nIdLay <> GDB_ID.NULL
|
|
Dim sInfoPath As String = String.Empty
|
|
If EgtGetInfo(nIdLay, "Path", sInfoPath) Then
|
|
Dim sNamePath As String = sInfoPath
|
|
If sNamePath.Contains(sCompoName) And IndexLay = IndexInList Then
|
|
EgtSetMark(nIdLay)
|
|
m_SelCompo.SetMark()
|
|
Exit While
|
|
ElseIf sNamePath.Contains(sCompoName) And IndexLay < IndexInList Then
|
|
IndexLay = IndexLay + 1
|
|
End If
|
|
End If
|
|
nIdLay = EgtGetNextLayer(nIdLay)
|
|
End While
|
|
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "RemoveCompo"
|
|
|
|
Friend Sub RemoveCompo(CompoToRemove As Compo, Optional OnlyOnJamb As Boolean = False)
|
|
If IsNothing(CompoToRemove) Then Return
|
|
If Not IsNothing(CompoToRemove.refJambCompo) Then
|
|
' elimino prima il riferimento
|
|
For IndexAssociation As Integer = 0 To m_refPartDoor.ListAssociation.Count - 1
|
|
If m_refPartDoor.ListAssociation(IndexAssociation).refPartDoor.Door.CompoList.IndexOf(CompoToRemove.refJambCompo) > -1 Then
|
|
m_refPartDoor.ListAssociation(IndexAssociation).refPartDoor.Door.RemoveCompo(CompoToRemove.refJambCompo)
|
|
If Not IsNothing(CompoToRemove.refJambCompo) Then
|
|
CompoToRemove.refJambCompo.refCompoDoor = Nothing
|
|
End If
|
|
CompoToRemove.refJambCompo = Nothing
|
|
If OnlyOnJamb Then Return
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
' elimino la componente
|
|
If Not IsNothing(CompoToRemove.refCompoDoor) Then
|
|
' elimino prima il riferimento che riporta alla porta
|
|
For IndexAssociation As Integer = 0 To m_refPartDoor.ListAssociation.Count - 1
|
|
If m_refPartDoor.ListAssociation(IndexAssociation).refPartDoor.Door.CompoList.IndexOf(CompoToRemove.refCompoDoor) > -1 Then
|
|
If Not IsNothing(CompoToRemove.refCompoDoor) Then
|
|
CompoToRemove.refCompoDoor.refJambCompo = Nothing
|
|
End If
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
CompoList.Remove(CompoToRemove)
|
|
End Sub
|
|
|
|
#End Region ' RemoveCompo
|
|
|
|
' aggiorna il ToolTip delle TextBox di Height, Width, Thickness
|
|
Private Sub UpdateToolTip()
|
|
For CompoIndex = 0 To m_CompoList.Count - 1
|
|
For ParamIndex = 0 To m_CompoList(CompoIndex).CompoParamList.Count - 1
|
|
If TypeOf m_CompoList(CompoIndex).CompoParamList(ParamIndex) Is TextBoxParam Then
|
|
Dim TextBoxParam As TextBoxParam = DirectCast(m_CompoList(CompoIndex).CompoParamList(ParamIndex), TextBoxParam)
|
|
TextBoxParam.NotifyPropertyChanged("ToolTipValue")
|
|
End If
|
|
Next
|
|
Next
|
|
End Sub
|
|
|
|
#Region "LETTURA DDF"
|
|
Private bModifyProperties As Boolean = False
|
|
Private sNameDDFMaterial As String = ""
|
|
Private sNameDDFProperty As String = ""
|
|
Private bModifyBevel As Boolean = False
|
|
Private bDeleteTopShape As Boolean = False
|
|
Private FileContent As String()
|
|
|
|
' Genero una nuova porta da usare nella lettura di un DDF
|
|
Shared Sub ReadDDFPartDoor(ArrayFile() As String, ByRef LineIndex As Integer, ByRef ReadDoor As Part)
|
|
' Inizializzazioni
|
|
Dim bPressure As Boolean = False
|
|
Dim bProperties As Boolean = False
|
|
' tutti i parametri fino a profiles devono essere caricati
|
|
Dim ReadDoorCompleted As Boolean = False
|
|
'Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
|
|
ReadDoor.FileContent = ArrayFile
|
|
ReadDoor.m_TypePart = ConstGen.PART_DO_ & "1"
|
|
' Imposto di default la porta in lettura è versione 1
|
|
ReadDoor.Version = "1"
|
|
' Se il file DDF è vuoto
|
|
If ReadDoor.FileContent.Count = 0 Then
|
|
' 50107 = Empty file.
|
|
MessageBox.Show(EgtMsg(50107), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
' Leggo riga per riga
|
|
Dim sErrorInfo As String = String.Empty
|
|
While LineIndex < ReadDoor.FileContent.Count
|
|
Dim sLine As String = RemoveComment(ReadDoor.FileContent(LineIndex))
|
|
' Se linea vuota o solo commento, vado oltre
|
|
If String.IsNullOrWhiteSpace(sLine) Then
|
|
LineIndex += 1
|
|
Continue While
|
|
End If
|
|
' Controllo fine pezzo "---" o fine file "..."
|
|
If (Search3Hyphens(sLine) OrElse Search3Dots(sLine)) Then Exit While
|
|
' Modifica su vecchi file con "pressure:" indentato, per continuare a leggerli
|
|
If sLine.IndexOf(S_WEIGHT & ":") > 0 Then sLine = sLine.TrimStart()
|
|
' Processo la sezione
|
|
Dim sSection As String = GetName(sLine)
|
|
Select Case sSection
|
|
Case S_VERSION
|
|
LineIndex = ReadDoor.GetVersion(LineIndex)
|
|
Case S_PRODUCE
|
|
LineIndex = ReadDoor.GetProduce(LineIndex)
|
|
Case S_MEASURES
|
|
LineIndex = ReadDoor.GetMeasure(LineIndex)
|
|
Case S_CODE
|
|
LineIndex = ReadDoor.GetCode(LineIndex)
|
|
' Se manca il codice, errore
|
|
If LineIndex = -1 Then
|
|
' 50102=Failed reading DDF file. Missing needed parameter {0}.
|
|
sErrorInfo &= String.Format(EgtMsg(50102), S_CODE) & vbCrLf
|
|
' assegno una porta vuota ed esco dal ciclo
|
|
ReadDoor = Nothing
|
|
' interrompo la lettura del file
|
|
Exit While
|
|
End If
|
|
Case S_ORDER
|
|
LineIndex = ReadDoor.GetOrder(ReadDoor.NextIndex(LineIndex))
|
|
' Se mancano i dati dell'ordine, errore
|
|
If LineIndex = -1 Then
|
|
' 50102=Failed reading DDF file. Missing needed parameter {0}.
|
|
sErrorInfo &= String.Format(EgtMsg(50102), S_ORDER) & vbCrLf
|
|
' assegno una porta vuota ed esco dal ciclo
|
|
ReadDoor = Nothing
|
|
' interrompo la lettura del file
|
|
Exit While
|
|
End If
|
|
Case S_DATE
|
|
LineIndex = ReadDoor.GetDate(LineIndex)
|
|
Case S_PIECE
|
|
LineIndex = ReadDoor.GetPiece(LineIndex)
|
|
Case S_POSITION
|
|
LineIndex = ReadDoor.GetPosition(ReadDoor.NextIndex(LineIndex))
|
|
' Se mancano i dati di posizione, errore
|
|
If LineIndex = -1 Then
|
|
' 50102=Failed reading DDF file. Missing needed parameter {0}.
|
|
sErrorInfo &= String.Format(EgtMsg(50102), S_POSITION) & vbCrLf
|
|
' assegno una porta vuota ed esco dal ciclo
|
|
ReadDoor = Nothing
|
|
' interrompo la lettura del file
|
|
Exit While
|
|
End If
|
|
Case S_SIZE
|
|
LineIndex = ReadDoor.GetSize(ReadDoor.NextIndex(LineIndex))
|
|
' Se mancano i dati di size, errore
|
|
If LineIndex = -1 Then
|
|
' 50102=Failed reading DDF file. Missing needed parameter {0}.
|
|
sErrorInfo &= String.Format(EgtMsg(50102), S_SIZE) & vbCrLf
|
|
' assegno una porta vuota ed esco dal ciclo
|
|
ReadDoor = Nothing
|
|
' interrompo la lettura del file
|
|
Exit While
|
|
End If
|
|
Case S_ORIGHEIGHTDOOR
|
|
LineIndex = LineIndex + 1
|
|
'Case S_OVERLAP_DDF
|
|
' LineIndex = LineIndex + 1
|
|
Case S_WEIGHT
|
|
LineIndex = ReadDoor.GetWeight(LineIndex)
|
|
bPressure = True
|
|
Case S_SWING
|
|
LineIndex = ReadDoor.GetSwing(LineIndex)
|
|
If LineIndex = -1 Then
|
|
' 50102=Failed reading DDF file. Missing needed parameter {0}.
|
|
sErrorInfo &= String.Format(EgtMsg(50102), S_SWING) & vbCrLf
|
|
' assegno una porta vuota ed esco dal ciclo
|
|
ReadDoor = Nothing
|
|
Exit While
|
|
End If
|
|
Case S_SECURE ' creo l'oggetto OptionPage nella Mappa
|
|
LineIndex = ReadDoor.GetSecure(LineIndex)
|
|
Case S_MATERIAL
|
|
LineIndex = ReadDoor.GetMaterial(LineIndex)
|
|
If LineIndex = -1 Then
|
|
'50532=Missing list of material at file "../Compo/Default.ini".
|
|
sErrorInfo &= EgtMsg(50532) & vbCrLf
|
|
ReadDoor = Nothing
|
|
Exit While
|
|
ElseIf LineIndex = -2 Then
|
|
'50531=The current material {0} does not exist in list of material. Look at file "../Compo/Default.ini".
|
|
sErrorInfo &= String.Format(EgtMsg(50531), ReadDoor.sNameDDFMaterial) & vbCrLf
|
|
ReadDoor = Nothing
|
|
Exit While
|
|
End If
|
|
Case ConstCompo.S_PROPERTIES
|
|
bProperties = True
|
|
LineIndex = ReadDoor.GetProperties(LineIndex)
|
|
If LineIndex = -1 Then
|
|
'50533=Impossible to load more than one property at time.
|
|
sErrorInfo &= EgtMsg(50533) & vbCrLf
|
|
ReadDoor = Nothing
|
|
Exit While
|
|
ElseIf LineIndex = -2 Then
|
|
If Not IsNothing(ReadDoor.m_SelectedMaterial) Then
|
|
' 50530=Property {0} does not exist in list of {1}. Look at file "../Compo/Default.ini"
|
|
sErrorInfo &= String.Format(EgtMsg(50530), ReadDoor.sNameDDFProperty, ReadDoor.m_SelectedMaterial.Name) & vbCrLf
|
|
Else
|
|
' 50534=Property {0} does not exist in the list. Look at file "../Compo/Default.ini".
|
|
sErrorInfo &= String.Format(EgtMsg(50534), ReadDoor.sNameDDFProperty) & vbCrLf
|
|
End If
|
|
|
|
ReadDoor = Nothing
|
|
Exit While
|
|
End If
|
|
Case ConstCompo.S_PROFILES
|
|
Dim LocalMsg As String = String.Empty
|
|
LineIndex = ReadDoor.GetProfiles(ReadDoor.NextIndex(LineIndex), ReadDoor.TypePart, LocalMsg)
|
|
If LineIndex = -1 Then
|
|
' 50102=Failed reading DDF file. Missing needed parameter {0}.
|
|
sErrorInfo &= String.Format(EgtMsg(50102), ConstCompo.S_PROFILES) & vbCrLf
|
|
If Not String.IsNullOrEmpty(LocalMsg) Then
|
|
sErrorInfo &= LocalMsg
|
|
End If
|
|
' assegno una porta vuota ed esco dal ciclo
|
|
ReadDoor = Nothing
|
|
Exit While
|
|
End If
|
|
If Not String.IsNullOrEmpty(LocalMsg) Then
|
|
sErrorInfo &= LocalMsg
|
|
End If
|
|
ReadDoorCompleted = True
|
|
Case ConstCompo.K_HARDWARE
|
|
LineIndex = LineIndex + 1
|
|
Case ConstCompo.K_OPTIONS
|
|
LineIndex = ReadDoor.GetOptions(ReadDoor.NextIndex(LineIndex))
|
|
Case Else 'COMPONENTS
|
|
' Se sezione senza nome o altro errore
|
|
If String.IsNullOrWhiteSpace(sSection) Then
|
|
' 50130=Error in reading: line {0}.
|
|
sErrorInfo &= String.Format(EgtMsg(50130), LineIndex) & vbCrLf
|
|
' assegno una porta vuota ed esco dal ciclo
|
|
ReadDoor = Nothing
|
|
Exit While
|
|
End If
|
|
' Lettura del componente
|
|
RegexFunction.IsCompo = True
|
|
LineIndex = ReadDoor.GetCompo(ReadDoor.NextIndex(LineIndex), sSection, sErrorInfo)
|
|
RegexFunction.IsCompo = False
|
|
If LineIndex = -1 Then
|
|
' assegno una porta vuota ed esco dal ciclo
|
|
ReadDoor = Nothing
|
|
Exit While
|
|
End If
|
|
End Select
|
|
End While
|
|
|
|
If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage
|
|
Else
|
|
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage
|
|
End If
|
|
|
|
' controllo che i parametri della porta siano stati caricati correttamente
|
|
If Not ReadDoorCompleted Then
|
|
' 50156=Error in reading ddf: door is not completed or ddf has been slpitted by '---' bad.
|
|
If String.IsNullOrEmpty(sErrorInfo) Then sErrorInfo = EgtMsg(50156)
|
|
ReadDoor = Nothing
|
|
End If
|
|
' Aggiorno
|
|
If Not IsNothing(ReadDoor) And ReadDoorCompleted Then
|
|
' se la porta esiste allora mostro i suoi parametri
|
|
Map.refPartPageVM.CurrPart = ReadDoor
|
|
|
|
' se non passo dalla funzione che raccoglie queste informazioni (utilizzato nella versione precedente all'inserimento della ComboBox)
|
|
If Not bProperties AndAlso ReadDoor.PropertiesIsVisible = Visibility.Visible Then
|
|
For Each Item In ReadDoor.PropertiesList
|
|
'Item.IsChecked = False
|
|
Next
|
|
End If
|
|
|
|
' se esiste un solo materiale nell'elenco dei materiali, ma non è inserito nella porta allora lo carico di default
|
|
If IsNothing(ReadDoor.m_SelectedMaterial) And OptionModule.m_MaterialList.Count > 0 Then
|
|
ReadDoor.SelectedMaterial = OptionModule.m_MaterialList(0)
|
|
End If
|
|
|
|
' Messaggio di errore per le proprietà
|
|
If ReadDoor.bModifyProperties And Not FirstReadingEdge Then
|
|
' 50194 = Properties has been deleted
|
|
MessageBox.Show(EgtMsg(50194), EgtMsg(50118), MessageBoxButton.OK, MessageBoxImage.Information)
|
|
FirstReadingEdge = True
|
|
End If
|
|
|
|
' Messaggio di errore per il Top Arch
|
|
If ReadDoor.bDeleteTopShape Then
|
|
' 50197: Impossible to create a Top Arch because of configuration! Curr door will be modify.
|
|
MessageBox.Show(EgtMsg(50197), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Asterisk)
|
|
FirstReadingEdge = True
|
|
End If
|
|
|
|
' Messaggio di errore per incongruenza bevel
|
|
If ReadDoor.bModifyBevel Then
|
|
If Not IsNothing(ReadDoor.LockEdgeType) AndAlso
|
|
(ReadDoor.m_LockEdgeType.BevelDDF = BEVEL_DOWN OrElse ReadDoor.m_LockEdgeType.BevelDDF = BEVEL_UP) AndAlso
|
|
Not IsNothing(ReadDoor.m_Swing) AndAlso ReadDoor.m_Swing.Contains("I") Then
|
|
' 50198 =Bevel on lock edge would be inverted, 50115 =Caution
|
|
MessageBox.Show(EgtMsg(50198), EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No)
|
|
Else
|
|
' 50169 =Door dispositiopn has been modify.
|
|
MessageBox.Show(EgtMsg(50169), EgtMsg(50115), MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.No)
|
|
End If
|
|
End If
|
|
|
|
' Messaggio di errore per il Weight, quando non passa dalla funzione GetWeight (perchè il ddf non ha il peso)
|
|
If Not bPressure Then
|
|
If m_IsCheckedWeight = Visibility.Visible Then
|
|
' ACCESO e NON presenet nel ddf
|
|
' 50149=Caution: Weight is setted in OptionPage. Do you want to remove?
|
|
If MessageBox.Show(EgtMsg(50149), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then
|
|
' decido di spegnere
|
|
OptionsVM.SetIsCheckedWeight(False)
|
|
Else
|
|
' decido di accendere
|
|
OptionsVM.SetIsCheckedWeight(True)
|
|
ReadDoor.m_Weight = OptionModule.m_Weight
|
|
ReadDoor.VisibilityWeight = Visibility.Visible
|
|
Part.FirstReadingEdge = True
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
' Messaggi di errore generici, se la stringa dei messaggi contiene delle informazioni allora visualizzo
|
|
If Not String.IsNullOrWhiteSpace(sErrorInfo) Then
|
|
Dim sTitle As String = EgtMsg(50101)
|
|
' 50541 = {0} in reading {1}.
|
|
If Not IsNothing(ReadDoor) Then String.Format(EgtMsg(50541), sTitle, ReadDoor.TypePart)
|
|
MessageBox.Show(sErrorInfo, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
' Passaggio controllato alla prossima linea del file
|
|
Private Function NextIndex(Index As Integer) As Integer
|
|
If m_StopNextIndexLine Then
|
|
m_StopNextIndexLine = False
|
|
Return Index
|
|
End If
|
|
Return SkipWhiteSpace(FileContent, Index + 1)
|
|
End Function
|
|
|
|
' Leggo versione
|
|
Private Function GetVersion(Index As Integer) As Integer
|
|
Dim sVersion As String = GetValueWithKey(RemoveComment(FileContent(Index)), S_VERSION)
|
|
If String.IsNullOrWhiteSpace(sVersion) Then
|
|
m_Version = "1"
|
|
Else
|
|
' verifico che sia valido (dove leggo l'elenco delle versioni disponibili?)
|
|
If sVersion.Trim <> "2" Then
|
|
m_Version = "1"
|
|
Else
|
|
m_Version = sVersion.Trim
|
|
End If
|
|
End If
|
|
RegexFunction.sCurrVersionDoor = m_Version
|
|
' passo alla riga successiva
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
' Leggo il frame
|
|
Private Function GetProduce(Index As Integer) As Integer
|
|
Dim sProduce As String = GetValueWithKey(RemoveComment(FileContent(Index)), S_PRODUCE)
|
|
If String.IsNullOrWhiteSpace(sProduce) Then
|
|
m_IsActive = True
|
|
Else
|
|
m_IsActive = (sProduce.ToLower() = "true")
|
|
End If
|
|
' passo alla riga successiva
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
' Leggo l'unità di misura
|
|
Private Function GetMeasure(Index As Integer) As Integer
|
|
Dim sMeasure As String = GetValueWithKey(RemoveComment(FileContent(Index)), S_MEASURES)
|
|
If String.IsNullOrWhiteSpace(sMeasure) Then
|
|
' assegna il valore di default caricato nell'OptionModule
|
|
m_Measure = ConvertMmUnitsToString(OptionModule.m_bIsMmUnit)
|
|
Else
|
|
m_Measure = ConvertMmUnitsToString(ConvertStringToMmUnits(sMeasure))
|
|
End If
|
|
' passo alla riga successiva
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
' Leggo il codice
|
|
Private Function GetCode(Index As Integer) As Integer
|
|
Dim Code As String = GetValueWithKey(RemoveComment(FileContent(Index)), S_CODE)
|
|
If String.IsNullOrWhiteSpace(Code) Then
|
|
' Errore
|
|
Return -1
|
|
Else
|
|
m_Code = Code
|
|
End If
|
|
' passo alla riga successiva
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
' Leggo i dati della sezione order
|
|
Private Function GetOrder(ByRef Index As Integer) As Integer
|
|
' Recupero dati customer
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
Dim Customer As String = GetValueWithKey(RemoveComment(FileContent(Index)), K_CUSTOMER)
|
|
If Not String.IsNullOrWhiteSpace(Customer) Then m_Customer = Customer
|
|
Index = NextIndex(Index)
|
|
' Recupero dati elevation
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
Dim Elevation As String = GetValueWithKey(RemoveComment(FileContent(Index)), K_ELEVATION)
|
|
If Not String.IsNullOrWhiteSpace(Elevation) Then m_Elevation = Elevation
|
|
Index = NextIndex(Index)
|
|
' Recupero dati project (opzionale)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
If SearchKey(RemoveComment(FileContent(Index)), K_PROJECT) Then
|
|
Dim Project As String = GetValueWithKey(RemoveComment(FileContent(Index)), K_PROJECT)
|
|
If Not String.IsNullOrWhiteSpace(Project) Then m_Project = Project
|
|
Index = NextIndex(Index)
|
|
End If
|
|
' Recupero dati PO (purchase order)(opzionale)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
If SearchKey(RemoveComment(FileContent(Index)), K_PO) Then
|
|
Dim PO As String = GetValueWithKey(RemoveComment(FileContent(Index)), K_PO)
|
|
If Not String.IsNullOrWhiteSpace(PO) Then m_PO = PO
|
|
Index = NextIndex(Index)
|
|
ElseIf SearchKey(RemoveComment(FileContent(Index)), K_ORDER) Then
|
|
Dim Order As String = GetValueWithKey(RemoveComment(FileContent(Index)), K_ORDER)
|
|
If Not String.IsNullOrWhiteSpace(Order) Then m_PO = Order
|
|
Index = NextIndex(Index)
|
|
End If
|
|
' Recupero dati line
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
Dim Line As String = GetValueWithKey(RemoveComment(FileContent(Index)), K_LINE)
|
|
If Not String.IsNullOrWhiteSpace(Line) Then m_Line = Line
|
|
Index = NextIndex(Index)
|
|
' Passo alla fine della sezione
|
|
While Index < FileContent.Count() AndAlso Not SearchName(RemoveComment(FileContent(Index)), S_DATE)
|
|
Index = NextIndex(Index)
|
|
End While
|
|
Return Index
|
|
End Function
|
|
|
|
' Leggo la data
|
|
Private Function GetDate(Index As Integer) As Integer
|
|
Dim sDate As String = GetValueWithKey(RemoveComment(FileContent(Index)), S_DATE)
|
|
If String.IsNullOrWhiteSpace(sDate) Then
|
|
' assegna il valore di default caricato nell'OptionModule
|
|
m_Date = System.DateTime.Now.ToString("dd/MM/yyyy")
|
|
Else
|
|
m_Date = sDate
|
|
End If
|
|
' passo alla riga successiva
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
' Leggo il piece
|
|
Private Function GetPiece(Index As Integer) As Integer
|
|
Dim sType As String = GetValueWithKey(RemoveComment(FileContent(Index)), S_PIECE)
|
|
If Not String.IsNullOrWhiteSpace(sType) Then
|
|
m_TypePart = sType
|
|
If sType.Contains("DO_") Then
|
|
'OptionModule.CreateNewPropertiesList(m_PropertiesList, m_SelectedMaterial)
|
|
OptionModule.CreateNewPropertiesList(Me)
|
|
Else
|
|
'OptionModule.CreateNewPropertiesListJamb(m_PropertiesList, m_SelectedMaterial)
|
|
OptionModule.CreateNewPropertiesListJamb(Me)
|
|
End If
|
|
End If
|
|
' passo alla riga successiva
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
' Leggo i dati di position
|
|
Private Function GetPosition(Index As Integer) As Integer
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
Dim sX As String = GetValueWithKey(RemoveComment(FileContent(Index)), K_X)
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
Dim sY As String = GetValueWithKey(RemoveComment(FileContent(Index)), K_Y)
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
Dim sZ As String = GetValueWithKey(RemoveComment(FileContent(Index)), K_Z)
|
|
Index = NextIndex(Index)
|
|
m_Position = New List(Of String) From {sX, sY, sZ}
|
|
Return Index
|
|
End Function
|
|
|
|
' Leggo i dati di size
|
|
Private Function GetSize(Index As Integer) As Integer
|
|
' Width
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
Dim sLine As String = RemoveComment(FileContent(Index))
|
|
Dim Width As String = GetValueWithKey(sLine, K_WIDTH)
|
|
If m_refPartDoor.IsTemplate And OptionModule.AdjustDDT Then
|
|
Width = OptionModule.m_Width
|
|
End If
|
|
If String.IsNullOrWhiteSpace(Width) Then
|
|
If Not SearchKey(sLine, K_WIDTH) Then Return -1
|
|
' altrimenti
|
|
m_Width = OptionModule.m_Width
|
|
Part.FirstReadingEdge = True
|
|
'50141=Invalid expression in {0}.
|
|
'50159= Missing parameter in ddf!
|
|
MessageBox.Show(String.Format(EgtMsg(50141), ConstIni.K_WIDTH_INI) & EgtMsg(50159), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Else
|
|
ConvertDDFValueIntoCurrentUnit(m_Measure, Width)
|
|
SetWidth(Width)
|
|
End If
|
|
Index = NextIndex(Index)
|
|
' Height
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
Dim Height As String = GetValueWithKey(sLine, K_HEIGHT)
|
|
If m_refPartDoor.IsTemplate And OptionModule.AdjustDDT Then
|
|
Height = OptionModule.m_Height
|
|
End If
|
|
If String.IsNullOrWhiteSpace(Height) Then
|
|
If Not SearchKey(sLine, K_HEIGHT) Then Return -1
|
|
' altrimenti
|
|
SetHeight(OptionModule.m_Height)
|
|
Part.FirstReadingEdge = True
|
|
' 50141 =Invalid expression in {0}.
|
|
' 50159 = Missing parameter in ddf!
|
|
MessageBox.Show(String.Format(EgtMsg(50141), ConstIni.K_HEIGHT_INI) & EgtMsg(50159), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Else
|
|
ConvertDDFValueIntoCurrentUnit(m_Measure, Height)
|
|
SetHeight(Height)
|
|
End If
|
|
Index = NextIndex(Index)
|
|
' Thickness
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
Dim Thickness As String = GetValueWithKey(sLine, K_THICKNESS)
|
|
If m_refPartDoor.IsTemplate And OptionModule.AdjustDDT Then
|
|
Thickness = OptionModule.m_Thickness
|
|
End If
|
|
If String.IsNullOrWhiteSpace(Thickness) Then
|
|
If Not SearchKey(sLine, K_THICKNESS) Then Return -1
|
|
' altrimenti
|
|
m_Thickness = OptionModule.m_Thickness
|
|
Part.FirstReadingEdge = True
|
|
' 50141 =Invalid expression in {0}.
|
|
' 50159 = Missing parameter in ddf!
|
|
MessageBox.Show(String.Format(EgtMsg(50141), ConstIni.K_THICKNESS_INI) & EgtMsg(50159), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Else
|
|
ConvertDDFValueIntoCurrentUnit(m_Measure, Thickness)
|
|
SetThickness(Thickness)
|
|
End If
|
|
Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly()
|
|
' passo alla riga successiva
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
' Leggo il valore del peso
|
|
Private Function GetWeight(Index As Integer) As Integer
|
|
' se sono arrivato fino a qui significa che è stato scritto nel ddf
|
|
Dim sLine As String = RemoveComment(FileContent(Index))
|
|
Dim Weight As String = GetValueWithKey(sLine, S_WEIGHT)
|
|
Dim bPressureIsInDDF As Boolean = False
|
|
' inizio eseguendo la lettura della stringa del ddf
|
|
' se la stringa contiene il MESSAGGIO Pressure
|
|
If SearchKey(sLine, S_WEIGHT) Then
|
|
bPressureIsInDDF = True
|
|
' allora passo alla lettura del VALORE Pressure
|
|
Weight = GetValueWithKey(sLine, S_WEIGHT)
|
|
If String.IsNullOrWhiteSpace(Weight) Then
|
|
' cairco di default il VALORE
|
|
m_Weight = OptionModule.m_Weight
|
|
' ? inserisco un messaggio o una avvenuta modifica ?
|
|
Else
|
|
' caricol il VALORE
|
|
m_Weight = Weight
|
|
End If
|
|
End If
|
|
|
|
' eseguo il confronto con le impostanzioni della option page
|
|
' nella option page è ACCESSO ma NON è presnte nel ddf
|
|
If Not Assembly.FirstReadingWeight AndAlso m_IsCheckedWeight = Visibility.Visible And Not bPressureIsInDDF Then
|
|
' Weight is setted in OptionPage. Do you want to remove?
|
|
If MessageBox.Show(EgtMsg(50149), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then
|
|
' SPENTO
|
|
OptionsVM.SetIsCheckedWeight(False)
|
|
Else
|
|
OptionsVM.SetIsCheckedWeight(True)
|
|
m_Weight = OptionModule.m_Weight
|
|
VisibilityWeight = Visibility.Visible
|
|
' notifico una avvenuta modifica
|
|
Part.FirstReadingEdge = True
|
|
End If
|
|
' comunico che almeno una volta è stata notificata la modifica
|
|
Assembly.FirstReadingWeight = True
|
|
End If
|
|
|
|
' nella option page è SPENTO ma è presnte nel ddf
|
|
If Not Assembly.FirstReadingWeight AndAlso m_IsCheckedWeight = Visibility.Collapsed And bPressureIsInDDF Then
|
|
If MessageBox.Show(EgtMsg(50150), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then
|
|
' ACCESO
|
|
OptionsVM.SetIsCheckedWeight(True)
|
|
Else
|
|
OptionsVM.SetIsCheckedWeight(False)
|
|
VisibilityWeight = Visibility.Collapsed
|
|
' notifico una avvenuta modifica
|
|
Part.FirstReadingEdge = True
|
|
End If
|
|
' comunico che almeno una volta è stata notificata la modifica
|
|
Assembly.FirstReadingWeight = True
|
|
End If
|
|
|
|
' passo alla riga successiva
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
' Leggo swing
|
|
Private Function GetSwing(Index As Integer) As Integer
|
|
Dim sLine As String = RemoveComment(FileContent(Index))
|
|
Dim Swing As String = GetValueWithKey(sLine, S_SWING)
|
|
If String.IsNullOrWhiteSpace(Swing) Then
|
|
' se non c'è la parola chiave allora esci
|
|
If Not SearchKey(sLine, S_SWING) Then Return -1
|
|
' altrimenti lascia il valore vuoto
|
|
'm_Swing = OptionModule.m_Swing
|
|
Part.FirstReadingEdge = True
|
|
' 50141 =Invalid expression in {0}.
|
|
' 50159 = Missing parameter in ddf!
|
|
MessageBox.Show(String.Format(EgtMsg(50141), ConstIni.K_SWING_INI) & EgtMsg(50159), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Else
|
|
' carico il valore nella porta corrente
|
|
If m_refPartDoor.IsTemplate And OptionModule.AdjustDDT AndAlso Not String.IsNullOrEmpty(OptionModule.ForcesSideSwing) Then
|
|
Swing = Swing.Remove(0, 1)
|
|
Swing = OptionModule.ForcesSideSwing & Swing
|
|
End If
|
|
m_Swing = Swing
|
|
OptionModule.SetCurrSwing(m_SwingAlias, m_Swing)
|
|
If IsNothing(m_SwingAlias) Then Return -1
|
|
m_Swing = m_SwingAlias.AliasName
|
|
End If
|
|
' passo alla riga successiva
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
' Leggo il posizionamento in macchina della porta
|
|
Private Function GetSecure(Index As Integer) As Integer
|
|
Dim MessageBoxBevel As MessageBoxResult = MessageBoxResult.OK
|
|
' Recupero il valore di secure
|
|
Dim sLine As String = RemoveComment(FileContent(Index))
|
|
Dim sSecure As String = GetValueWithKey(sLine, S_SECURE)
|
|
If String.IsNullOrWhiteSpace(sSecure) Then
|
|
' se non c'è la parola chiave allora esci
|
|
If Not SearchKey(sLine, S_SECURE) Then Return -1
|
|
' altrimenti lascia il valore vuoto
|
|
Else
|
|
' carico il valore nella porta corrente
|
|
m_Secure = sSecure
|
|
End If
|
|
' passo alla riga successiva
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
' leggo il materiale
|
|
Private Function GetMaterial(Index As Integer) As Integer
|
|
' se non trovo la lista dei materiali o la lista è vuota allora errore
|
|
If IsNothing(OptionModule.m_MaterialList) OrElse OptionModule.m_MaterialList.Count < 1 Then
|
|
Return -1
|
|
End If
|
|
Dim bMaterialExists = False
|
|
Dim sLine As String = RemoveComment(FileContent(Index))
|
|
Dim sMaterial As String = GetValueWithKey(sLine, S_MATERIAL)
|
|
If Not String.IsNullOrWhiteSpace(sMaterial) Then
|
|
sNameDDFMaterial = sMaterial
|
|
For Each MaterialItem In OptionModule.m_MaterialList
|
|
' se trovo il materiale allora carico la sua lista di proprietà ed esco
|
|
If Trim(MaterialItem.NameDDF) = Trim(sMaterial) Then
|
|
'm_SelectedMaterial = MaterialItem
|
|
SetMaterial(MaterialItem)
|
|
OptionModule.m_CurrMaterial = m_SelectedMaterial
|
|
If Not IsNothing(MaterialItem.PropertiesList) Then
|
|
'PropertiesList = MaterialItem.PropertiesList
|
|
SetPropertiesList(MaterialItem.PropertiesList)
|
|
'SelectedProperty = m_PropertiesList(0)
|
|
SetProperty(m_PropertiesList(0))
|
|
Else
|
|
PropertiesIsVisible = Visibility.Collapsed
|
|
End If
|
|
bMaterialExists = True
|
|
Return NextIndex(Index)
|
|
End If
|
|
Next
|
|
End If
|
|
' se il materiale non è nell'elenco dei materiali
|
|
If Not bMaterialExists Then
|
|
Return -2
|
|
End If
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
' leggo le proprietà
|
|
Private Function GetProperties(Index As Integer) As Integer
|
|
' se esiste l'elenco dei materiali (nuova configurazione) ma il ddf è senza: allora passo come materiale di default il primo della lista (wood)
|
|
If IsNothing(m_SelectedMaterial) AndAlso OptionModule.m_MaterialList.Count > 0 Then
|
|
'SelectedMaterial = OptionModule.m_MaterialList(0)
|
|
SetMaterial(OptionModule.m_MaterialList(0))
|
|
'PropertiesList = OptionModule.m_MaterialList(0).PropertiesList
|
|
SetPropertiesList(OptionModule.m_MaterialList(0).PropertiesList)
|
|
End If
|
|
' devo verificare se esite la lista dei materiali
|
|
Dim bPropertyExists = False
|
|
Dim sLine As String = RemoveComment(FileContent(Index))
|
|
' se esiste la proprietà, ma non è selezionata allora comunico la modifica
|
|
If PropertiesIsVisible = Visibility.Collapsed Then
|
|
bModifyProperties = True
|
|
End If
|
|
Dim sProperties As String = GetValueWithKey(sLine, ConstCompo.S_PROPERTIES)
|
|
If Not String.IsNullOrWhiteSpace(sProperties) Then
|
|
' carico il valore nella porta corrente
|
|
Dim sItem() As String = sProperties.Split(","c)
|
|
' se la lista contiene più di una proprietà
|
|
If sItem.Count > 1 Then
|
|
Return -1
|
|
End If
|
|
For Each Item In m_PropertiesList
|
|
Item.IsChecked = False
|
|
For Each ItemRead In sItem
|
|
If Trim(Item.Name) = Trim(ItemRead) Then
|
|
m_SelectedProperty = Item
|
|
Item.IsChecked = True
|
|
bPropertyExists = True
|
|
End If
|
|
Next
|
|
Next
|
|
' se la proprietà non appartiene alla lista allora esco e non carico la porta
|
|
If Not bPropertyExists Then
|
|
sNameDDFProperty = sProperties
|
|
Return -2
|
|
End If
|
|
Else
|
|
For Each Item In m_PropertiesList
|
|
If Item.Name = NONE_DDF Then
|
|
SelectedProperty = Item
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
Private Function GetOptions(Index As Integer) As Integer
|
|
If Index > FileContent.Count() - 1 Then Return Index
|
|
Dim sLine As String = RemoveComment(FileContent(Index))
|
|
' se stringa vuota passo alla riga successiva
|
|
If String.IsNullOrEmpty(sLine) Then
|
|
Return Index
|
|
End If
|
|
' procedo a leggere le options
|
|
Dim nCount As Integer = 0
|
|
m_sOptions = String.Empty
|
|
' sLine.StartsWith(OptionModule.m_sSpace1Tab)
|
|
While Not (Search3Hyphens(sLine) OrElse Search3Dots(sLine))
|
|
m_sOptions &= If(nCount > 0, vbCrLf, "") & sLine
|
|
Index = NextIndex(Index)
|
|
' se il file è terminatpo esco
|
|
If Index > FileContent.Count() - 1 Then Return Index
|
|
sLine = RemoveComment(FileContent(Index))
|
|
nCount = nCount + 1
|
|
End While
|
|
Return Index
|
|
End Function
|
|
|
|
' calcola la congruenza del posizionamento e del secure
|
|
Private Sub CalcBevelFromSecure()
|
|
' se sono nella configurazione assemblato e sto leggendo un frame
|
|
If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly AndAlso Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) AndAlso Not m_TypePart.Contains(ConstGen.PART_DO_) Then
|
|
' assegno i profili bevel caricati nella pagina AssemblyPage
|
|
Try
|
|
SetLockEdgeType(Map.refAssemblyPageVM.CurrAssembly.EdgeTypeList.First(Function(x) x.Name = Map.refAssemblyPageVM.CurrAssembly.LockEdgeType.Name))
|
|
Catch ex As Exception
|
|
End Try
|
|
Try
|
|
SetHingeEdgeType(Map.refAssemblyPageVM.CurrAssembly.EdgeTypeList.First(Function(x) x.Name = Map.refAssemblyPageVM.CurrAssembly.HingeEdgeType.Name))
|
|
Catch ex As Exception
|
|
End Try
|
|
Try
|
|
SetTopType(Map.refAssemblyPageVM.CurrAssembly.EdgeTypeList.First(Function(x) x.Name = Map.refAssemblyPageVM.CurrAssembly.TopType.Name))
|
|
Catch ex As Exception
|
|
End Try
|
|
Try
|
|
SetBottomType(Map.refAssemblyPageVM.CurrAssembly.EdgeTypeList.First(Function(x) x.Name = Map.refAssemblyPageVM.CurrAssembly.BottomType.Name))
|
|
Catch ex As Exception
|
|
End Try
|
|
' la disposizione è sempre BD, non modificabile, quindi mostro a video BySwing
|
|
Try
|
|
SetDispositionItem(DispositionList.First(Function(x) x.Name = ConstGen.BEVEL_BYSWING))
|
|
Catch ex As Exception
|
|
End Try
|
|
Else ' se è un'anta (in qualsisi tipo di configurazione)
|
|
' controllo se almeno uno dei bevel della porta ha BV
|
|
Dim Bevel As String = String.Empty
|
|
Dim sBevelLock As String = String.Empty
|
|
Dim sBevelHinge As String = String.Empty
|
|
Dim sBevelTop As String = String.Empty
|
|
Dim sBevelBottom As String = String.Empty
|
|
' se almeno un profilo è di tipo bevel
|
|
' If m_LockEdgeType.Name = ConstGen.BEVEL_GRAPHIC Then sBevelLock = m_LockEdgeType.BevelDDF
|
|
If m_LockEdgeType.Name.Contains(ConstGen.BEVEL_GRAPHIC) Then sBevelLock = ClaerBevel(m_LockEdgeType.BevelDDF)
|
|
If m_HingeEdgeType.Name.Contains(ConstGen.BEVEL_GRAPHIC) Then sBevelHinge = ClaerBevel(m_HingeEdgeType.BevelDDF)
|
|
If m_TopType.Name.Contains(ConstGen.BEVEL_GRAPHIC) Then sBevelTop = ClaerBevel(m_TopType.BevelDDF)
|
|
If m_BottomType.Name.Contains(ConstGen.BEVEL_GRAPHIC) Then sBevelBottom = ClaerBevel(m_BottomType.BevelDDF)
|
|
' controllo che i bevel siano tutti uguali nello stesso Part ( tranne che nelle inattive)
|
|
Bevel = ControlBevel(sBevelLock, sBevelHinge, sBevelTop, sBevelBottom)
|
|
' nel caso di nessuna disposizione fissata da Config.ini
|
|
Select Case OptionModule.m_sDisposition
|
|
Case ConstGen.BEVEL_DOWN
|
|
SetDispositionItem(m_DispositionList(1))
|
|
' modifico il bevel da BU a BD
|
|
Modifybevel(Bevel, ConstGen.BEVEL_UP)
|
|
Case ConstGen.BEVEL_UP
|
|
SetDispositionItem(m_DispositionList(0))
|
|
' modifico il bevel da BU a BD
|
|
Modifybevel(Bevel, ConstGen.BEVEL_DOWN)
|
|
Case Else ' BySwing
|
|
If Not String.IsNullOrEmpty(Bevel) Then
|
|
Try
|
|
' seleziono il bevel letto nella lista delle disposizioni possibili (esiste un solo tipo di bevel per tutta la porta)
|
|
SetDispositionItem(m_DispositionList.First(Function(x) x.Name = Bevel))
|
|
If Bevel = ConstGen.BEVEL_UP Then OptionModule.m_bBevelUp = Visibility.Visible
|
|
If Bevel = ConstGen.BEVEL_DOWN Then OptionModule.m_bBevelDown = Visibility.Visible
|
|
' questo caso il secure segue le solite regole di calcolo
|
|
Catch ex As Exception ' se il bevel passato è BV devo calcolare il corretto bevel
|
|
SetDispositionItem(m_DispositionList.First(Function(x) x.Name = ConstGen.BEVEL_BYSWING))
|
|
bModifyBevel = True
|
|
Part.FirstReadingEdge = True
|
|
End Try
|
|
Else ' Bevel SQ
|
|
If m_SwingAlias.Name.Contains(ConstGen.HAND_REVERSE) Then
|
|
If m_Secure = ConstGen.SWING_UP Then
|
|
SetDispositionItem(m_DispositionList(0))
|
|
OptionModule.m_bBevelUp = Visibility.Visible
|
|
ElseIf m_Secure = ConstGen.SWING_DOWN Then
|
|
SetDispositionItem(m_DispositionList(1))
|
|
OptionModule.m_bBevelDown = Visibility.Visible
|
|
Else
|
|
m_Secure = ConstGen.SWING_DOWN
|
|
SetDispositionItem(m_DispositionList(1))
|
|
OptionModule.m_bBevelDown = Visibility.Visible
|
|
End If
|
|
Else
|
|
If m_Secure = ConstGen.SWING_UP Then
|
|
SetDispositionItem(m_DispositionList(1))
|
|
OptionModule.m_bBevelDown = Visibility.Visible
|
|
ElseIf m_Secure = ConstGen.SWING_DOWN Then
|
|
SetDispositionItem(m_DispositionList(0))
|
|
OptionModule.m_bBevelUp = Visibility.Visible
|
|
Else
|
|
m_Secure = ConstGen.SWING_UP
|
|
SetDispositionItem(m_DispositionList(0))
|
|
OptionModule.m_bBevelUp = Visibility.Visible
|
|
End If
|
|
End If
|
|
End If
|
|
End Select
|
|
End If
|
|
End Sub
|
|
|
|
' restituisce il tipo di bevel dal profilo
|
|
Private Function ClaerBevel(sBevel As String) As String
|
|
Dim sEdgeType As String = String.Empty
|
|
Dim IndexOf As Integer = -1
|
|
If sBevel.Contains(ConstGen.BEVEL_GRAPHIC) Then
|
|
IndexOf = sBevel.IndexOf(ConstGen.BEVEL_GRAPHIC)
|
|
ElseIf sBevel.Contains(ConstGen.BEVEL_DOWN) Then
|
|
IndexOf = sBevel.IndexOf(ConstGen.BEVEL_DOWN)
|
|
ElseIf sBevel.Contains(ConstGen.BEVEL_UP) Then
|
|
IndexOf = sBevel.IndexOf(ConstGen.BEVEL_UP)
|
|
End If
|
|
If IndexOf > -1 And sBevel.Count > 2 Then
|
|
sEdgeType = sBevel.Remove(IndexOf, 2)
|
|
Return sBevel.Replace(sEdgeType, "")
|
|
Else
|
|
Return sBevel
|
|
End If
|
|
|
|
End Function
|
|
|
|
' Leggo i dati dei profili
|
|
Private Function GetProfiles(Index As Integer, TypePart As String, Optional ByRef sErrorMsg As String = "") As Integer
|
|
' ricalcolo la lista da mostrare a video
|
|
If IsNothing(Map.refOptionsVM) Then
|
|
Dim OptionsPage As OptionsVM = Map.refMainWindowVM.OptionPage
|
|
refOptionsVM.RefreshEdgeTypeList()
|
|
End If
|
|
Dim bError As Boolean = False
|
|
'-------------------------------------------------------------------------------
|
|
' Lock
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
Dim sLine As String = RemoveComment(FileContent(Index))
|
|
m_LockEdgeType = m_LockEdgeTypeList(0)
|
|
' se vrsione 2 (20/04/2023) il tipo di bevel è inserito nella riga successiva con chaive K_TYPEEDGE
|
|
Dim nError As Integer = Index
|
|
Dim LockEdgeType As String = ManageProfileType(sLine, Index, nError, K_LOCKEDGE)
|
|
If nError = -1 Then Return -1
|
|
If String.IsNullOrWhiteSpace(LockEdgeType) Then
|
|
' se non c'è la parola chiave allora esco con errore
|
|
If ManageProfileError(sLine, K_LOCKEDGE, SIDE_LOCK) = -1 Then Return -1
|
|
Else
|
|
Try
|
|
Dim sMetaData As String = Trim(RegexFunction.Metadata(sLine))
|
|
If Not IsNothing(sMetaData) AndAlso sMetaData = "Inverted" Then
|
|
SetInvertBevel(True)
|
|
LockEdgeType = LockEdgeType.Replace(DDF_METADATA, "")
|
|
LockEdgeType = Trim(LockEdgeType.Replace(sMetaData, ""))
|
|
End If
|
|
' cerco il valore nella lista
|
|
m_LockEdgeType = LockEdgeTypeList.First(Function(x) x.Name = LockEdgeType)
|
|
' segno il bevel che è stato letto nel ddf per il calcolo del secure
|
|
m_LockEdgeType.BevelDDF = LockEdgeType
|
|
Catch ex As Exception ' se il valore cercato non è nella lista
|
|
If Trim(LockEdgeType).Contains(ConstGen.BEVEL_UP) Then
|
|
Try
|
|
m_LockEdgeType = LockEdgeTypeList.First(Function(x) x.Name = LockEdgeType.Replace(ConstGen.BEVEL_UP, ConstGen.BEVEL_GRAPHIC))
|
|
' segno il bevel che è stato letto nel ddf per il calcolo del secure
|
|
m_LockEdgeType.BevelDDF = LockEdgeType
|
|
Catch ex2 As Exception
|
|
End Try
|
|
ElseIf Trim(LockEdgeType).Contains(ConstGen.BEVEL_DOWN) Then
|
|
Try
|
|
m_LockEdgeType = LockEdgeTypeList.First(Function(x) x.Name = LockEdgeType.Replace(ConstGen.BEVEL_DOWN, ConstGen.BEVEL_GRAPHIC))
|
|
' segno il bevel che è stato letto nel ddf per il calcolo del secure
|
|
m_LockEdgeType.BevelDDF = LockEdgeType
|
|
Catch ex2 As Exception
|
|
End Try
|
|
End If
|
|
End Try
|
|
If Not ControlProfileInList(LockEdgeTypeList, LockEdgeType) Then
|
|
' 50522=The profile {0} is not a member of the {1} list.
|
|
sErrorMsg = String.Format(EgtMsg(50522), LockEdgeType, SIDE_LOCK)
|
|
Return -1
|
|
End If
|
|
End If
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
Dim LockEdgeMachining As String = GetValueWithKey(sLine, K_MACHINING)
|
|
If String.IsNullOrWhiteSpace(LockEdgeMachining) Then
|
|
If Not SearchKey(sLine, K_MACHINING) Then Return -1
|
|
Else
|
|
m_LockEdgeMachining = Utility.ConvertOnOffToBoolean(LockEdgeMachining)
|
|
End If
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
Dim LockEdgeOverMaterial As String = GetValueWithKey(sLine, K_OVERMATERIAL)
|
|
If String.IsNullOrWhiteSpace(LockEdgeOverMaterial) Then
|
|
If Not SearchKey(sLine, K_OVERMATERIAL) Then Return -1
|
|
Else
|
|
ConvertDDFValueIntoCurrentUnit(m_Measure, LockEdgeOverMaterial)
|
|
m_LockEdgeOverMaterial = LockEdgeOverMaterial
|
|
End If
|
|
Index = NextIndex(Index)
|
|
'-------------------------------------------------------------------------------
|
|
' Hinge
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
m_HingeEdgeType = m_HingeEdgeTypeList(0)
|
|
' se vrsione 2 (20/04/2023) il tipo di bevel è inserito nella riga successiva con chaive K_TYPEEDGE
|
|
nError = Index
|
|
Dim HingeEdgeType As String = ManageProfileType(sLine, Index, nError, K_HINGEEDGE)
|
|
If nError = -1 Then Return -1
|
|
If String.IsNullOrWhiteSpace(HingeEdgeType) Then
|
|
' se non c'è la parola chiave allora esco con errore
|
|
If ManageProfileError(sLine, K_HINGEEDGE, SIDE_HINGE) = -1 Then Return -1
|
|
Else
|
|
Try
|
|
m_HingeEdgeType = HingeEdgeTypeList.First(Function(x) x.Name = HingeEdgeType)
|
|
' segno il bevel che è stato letto nel ddf per il calcolo del secure
|
|
m_HingeEdgeType.BevelDDF = HingeEdgeType
|
|
Catch ex As Exception ' se il valore cercato non è nella lista
|
|
If Trim(HingeEdgeType).Contains(ConstGen.BEVEL_UP) Then
|
|
Try
|
|
m_HingeEdgeType = HingeEdgeTypeList.First(Function(x) x.Name = HingeEdgeType.Replace(ConstGen.BEVEL_UP, ConstGen.BEVEL_GRAPHIC))
|
|
' segno il bevel che è stato letto nel ddf per il calcolo del secure
|
|
m_HingeEdgeType.BevelDDF = HingeEdgeType
|
|
Catch ex2 As Exception
|
|
End Try
|
|
ElseIf Trim(HingeEdgeType).Contains(ConstGen.BEVEL_DOWN) Then
|
|
Try
|
|
m_HingeEdgeType = HingeEdgeTypeList.First(Function(x) x.Name = HingeEdgeType.Replace(ConstGen.BEVEL_DOWN, ConstGen.BEVEL_GRAPHIC))
|
|
' segno il bevel che è stato letto nel ddf per il calcolo del secure
|
|
m_HingeEdgeType.BevelDDF = HingeEdgeType
|
|
Catch ex2 As Exception
|
|
End Try
|
|
End If
|
|
End Try
|
|
|
|
If Not ControlProfileInList(HingeEdgeTypeList, HingeEdgeType) Then
|
|
' 50522=The profile {0} is not a member of the {1} list.
|
|
sErrorMsg = String.Format(EgtMsg(50522), HingeEdgeType, SIDE_HINGE)
|
|
Return -1
|
|
End If
|
|
End If
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
Dim HingeEdgeMachining As String = GetValueWithKey(sLine, K_MACHINING)
|
|
If String.IsNullOrWhiteSpace(HingeEdgeMachining) Then
|
|
If Not SearchKey(sLine, K_MACHINING) Then Return -1
|
|
Else
|
|
m_HingeEdgeMachining = ConvertOnOffToBoolean(HingeEdgeMachining)
|
|
End If
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
Dim HingeEdgeOverMaterial As String = GetValueWithKey(sLine, K_OVERMATERIAL)
|
|
If String.IsNullOrWhiteSpace(HingeEdgeOverMaterial) Then
|
|
If Not SearchKey(sLine, K_OVERMATERIAL) Then Return -1
|
|
Else
|
|
ConvertDDFValueIntoCurrentUnit(m_Measure, HingeEdgeOverMaterial)
|
|
m_HingeEdgeOverMaterial = HingeEdgeOverMaterial
|
|
End If
|
|
Index = NextIndex(Index)
|
|
'-------------------------------------------------------------------------------
|
|
' Top
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
m_TopType = m_TopEdgeTypeList(0)
|
|
' se vrsione 2 (20/04/2023) il tipo di bevel è inserito nella riga successiva con chaive K_TYPEEDGE
|
|
nError = Index
|
|
Dim TopType As String = ManageProfileType(sLine, Index, nError, K_TOP)
|
|
If nError = -1 Then Return -1
|
|
If String.IsNullOrWhiteSpace(TopType) Then
|
|
If ManageProfileError(sLine, K_TOP, SIDE_TOP) = -1 Then Return -1
|
|
Else
|
|
Try
|
|
m_TopType = TopEdgeTypeList.First(Function(x) x.Name = TopType)
|
|
' segno il bevel che è stato letto nel ddf per il calcolo del secure
|
|
m_TopType.BevelDDF = TopType
|
|
Catch ex As Exception ' se il valore cercato non è nella lista
|
|
If Trim(TopType).Contains(ConstGen.BEVEL_UP) Then
|
|
Try
|
|
m_TopType = TopEdgeTypeList.First(Function(x) x.Name = TopType.Replace(ConstGen.BEVEL_UP, ConstGen.BEVEL_GRAPHIC))
|
|
' segno il bevel che è stato letto nel ddf per il calcolo del secure
|
|
m_TopType.BevelDDF = TopType
|
|
Catch ex2 As Exception
|
|
End Try
|
|
ElseIf Trim(TopType).Contains(ConstGen.BEVEL_DOWN) Then
|
|
Try
|
|
m_TopType = TopEdgeTypeList.First(Function(x) x.Name = TopType.Replace(ConstGen.BEVEL_DOWN, ConstGen.BEVEL_GRAPHIC))
|
|
' segno il bevel che è stato letto nel ddf per il calcolo del secure
|
|
m_TopType.BevelDDF = TopType
|
|
Catch ex2 As Exception
|
|
End Try
|
|
End If
|
|
End Try
|
|
If Not ControlProfileInList(TopEdgeTypeList, TopType) Then
|
|
' 50522=The profile {0} is not a member of the {1} list.
|
|
sErrorMsg = String.Format(EgtMsg(50522), TopType, SIDE_TOP)
|
|
Return -1
|
|
End If
|
|
End If
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
Dim TopMachining As String = GetValueWithKey(sLine, K_MACHINING)
|
|
If String.IsNullOrWhiteSpace(TopMachining) Then
|
|
If Not SearchKey(sLine, K_MACHINING) Then Return -1
|
|
Else
|
|
m_TopMachining = ConvertOnOffToBoolean(TopMachining)
|
|
End If
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
Dim TopOverMaterial As String = GetValueWithKey(sLine, K_OVERMATERIAL)
|
|
If String.IsNullOrWhiteSpace(TopOverMaterial) Then
|
|
If Not SearchKey(sLine, K_OVERMATERIAL) Then Return -1
|
|
Else
|
|
ConvertDDFValueIntoCurrentUnit(m_Measure, TopOverMaterial)
|
|
m_TopOverMaterial = TopOverMaterial
|
|
End If
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
'-------------------------------------------------------------------------------
|
|
' Top Arc
|
|
Dim Radius As String = GetValueWithKey(sLine, ConstCompo.K_RADIUS)
|
|
If Not String.IsNullOrEmpty(Radius) Then
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
Dim Posx As String = GetValueWithKey(sLine, ConstCompo.K_POSX)
|
|
' carico i valori
|
|
If Not String.IsNullOrEmpty(Radius) AndAlso Not String.IsNullOrEmpty(Posx) Then
|
|
If OptionModule.m_DisableArch <> Visibility.Visible Then
|
|
bDeleteTopShape = True
|
|
Index = NextIndex(Index)
|
|
Else
|
|
Index = NextIndex(Index)
|
|
ConvertDDFValueIntoCurrentUnit(m_Measure, Radius)
|
|
m_Radius = Radius
|
|
ConvertDDFValueIntoCurrentUnit(m_Measure, Posx)
|
|
m_Posx = Posx
|
|
TopArcIsChecked = True
|
|
TopShapeIsChecked = True
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
' If Not m_TopArcIsChecked then
|
|
If Not m_TopShapeIsChecked Then
|
|
Dim PosxAngle As String = GetValueWithKey(sLine, ConstCompo.K_POSX)
|
|
If Not String.IsNullOrEmpty(PosxAngle) Then
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
Dim Angle As String = GetValueWithKey(sLine, ConstCompo.K_ANGLE)
|
|
' carico i valori
|
|
If Not String.IsNullOrEmpty(PosxAngle) AndAlso Not String.IsNullOrEmpty(Angle) Then
|
|
If OptionModule.m_DisableArch <> Visibility.Visible Then
|
|
bDeleteTopShape = True
|
|
Index = NextIndex(Index)
|
|
Else
|
|
Index = NextIndex(Index)
|
|
m_Angle = Angle
|
|
ConvertDDFValueIntoCurrentUnit(m_Measure, PosxAngle)
|
|
m_PosxAngle = PosxAngle
|
|
TopAngleIsChecked = True
|
|
SelectedShape = m_TopShapeList(1)
|
|
TopShapeIsChecked = True
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
'-------------------------------------------------------------------------------
|
|
' Bottom
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
m_BottomType = m_BottomEdgeTypeList(0)
|
|
' se vrsione 2 (20/04/2023) il tipo di bevel è inserito nella riga successiva con chaive K_TYPEEDGE
|
|
nError = Index
|
|
Dim BottomType As String = ManageProfileType(sLine, Index, nError, K_BOTTOM)
|
|
If nError = -1 Then Return -1
|
|
If String.IsNullOrWhiteSpace(BottomType) Then
|
|
If ManageProfileError(sLine, K_BOTTOM, SIDE_BOTTOM) = -1 Then Return -1
|
|
Else
|
|
Try
|
|
m_BottomType = BottomEdgeTypeList.First(Function(x) x.Name = BottomType)
|
|
' segno il bevel che è stato letto nel ddf per il calcolo del secure
|
|
m_BottomType.BevelDDF = BottomType
|
|
Catch ex As Exception ' se il valore cercato non è nella lista
|
|
If Trim(BottomType).Contains(ConstGen.BEVEL_UP) Then
|
|
Try
|
|
m_BottomType = BottomEdgeTypeList.First(Function(x) x.Name = BottomType.Replace(ConstGen.BEVEL_UP, ConstGen.BEVEL_GRAPHIC))
|
|
' segno il bevel che è stato letto nel ddf per il calcolo del secure
|
|
m_BottomType.BevelDDF = BottomType
|
|
Catch ex2 As Exception
|
|
End Try
|
|
ElseIf Trim(BottomType).Contains(ConstGen.BEVEL_DOWN) Then
|
|
Try
|
|
m_BottomType = BottomEdgeTypeList.First(Function(x) x.Name = BottomType.Replace(ConstGen.BEVEL_DOWN, ConstGen.BEVEL_GRAPHIC))
|
|
' segno il bevel che è stato letto nel ddf per il calcolo del secure
|
|
m_BottomType.BevelDDF = BottomType
|
|
Catch ex2 As Exception
|
|
End Try
|
|
End If
|
|
End Try
|
|
If Not ControlProfileInList(BottomEdgeTypeList, BottomType) Then
|
|
' 50522=The profile {0} is not a member of the {1} list.
|
|
sErrorMsg = String.Format(EgtMsg(50522), BottomType, SIDE_BOTTOM)
|
|
Return -1
|
|
End If
|
|
End If
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
Dim BottomMachining As String = GetValueWithKey(sLine, K_MACHINING)
|
|
If String.IsNullOrWhiteSpace(BottomMachining) Then
|
|
If Not SearchKey(sLine, K_MACHINING) Then Return -1
|
|
Else
|
|
m_BottomMachining = ConvertOnOffToBoolean(BottomMachining)
|
|
End If
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then Return -1
|
|
sLine = RemoveComment(FileContent(Index))
|
|
Dim BottomOverMaterial As String = GetValueWithKey(sLine, K_OVERMATERIAL)
|
|
If String.IsNullOrWhiteSpace(BottomOverMaterial) Then
|
|
If Not SearchKey(sLine, K_OVERMATERIAL) Then Return -1
|
|
Else
|
|
ConvertDDFValueIntoCurrentUnit(m_Measure, BottomOverMaterial)
|
|
m_BottomOverMaterial = BottomOverMaterial
|
|
End If
|
|
CalcBevelFromSecure()
|
|
Return NextIndex(Index)
|
|
End Function
|
|
|
|
Private Function ManageProfileType(ByRef sLine As String, ByRef Index As Integer, ByRef nError As Integer, sEdgeName As String) As String
|
|
Dim sVal As String = String.Empty
|
|
If m_Version = "2" Then
|
|
If SearchKey(sLine, sEdgeName) Then
|
|
' passo alla riga successiva
|
|
Index = NextIndex(Index)
|
|
If Index > FileContent.Count() - 1 Then
|
|
nError = -1
|
|
Return ""
|
|
End If
|
|
sLine = RemoveComment(FileContent(Index))
|
|
sVal = GetValueWithKey(sLine, K_TYPEEDGE)
|
|
Else
|
|
nError = -1
|
|
Return sVal
|
|
End If
|
|
Else
|
|
sVal = GetValueWithKey(sLine, sEdgeName)
|
|
End If
|
|
Return sVal
|
|
End Function
|
|
|
|
Private Function ManageProfileError(sLine As String, sEdgeName As String, sMsgName As String) As Integer
|
|
Dim nError As Integer = 0
|
|
If m_Version = "2" Then
|
|
If Not SearchKey(sLine, K_TYPEEDGE) Then
|
|
Return -1
|
|
Else
|
|
FirstReadingEdge = True
|
|
sErrorMsg = String.Format(EgtMsg(50523), sMsgName)
|
|
End If
|
|
Else
|
|
If Not SearchKey(sLine, sEdgeName) Then
|
|
Return -1
|
|
Else
|
|
FirstReadingEdge = True
|
|
sErrorMsg = String.Format(EgtMsg(50523), sMsgName)
|
|
End If
|
|
End If
|
|
Return nError
|
|
End Function
|
|
|
|
' Leggo i dati del componente ( da senllire riutilizzando funzioni che già esistono)
|
|
Private Function GetCompo(Index As Integer, CompoNameDDF As String, ByRef sErrorInfo As String) As Integer
|
|
' Controllo esistenza del componente
|
|
Dim CompoListIndex As Integer = -1
|
|
For CmpInd = 0 To Map.refCompoPanelVM.CompoTypeList.Count() - 1
|
|
' eseguo il confronto con il nome dei componenti che è stato caricato dal file Default.ini
|
|
If Map.refCompoPanelVM.CompoTypeList(CmpInd).DDFName = CompoNameDDF Then
|
|
CompoListIndex = CmpInd
|
|
Exit For
|
|
End If
|
|
Next
|
|
' Se non esiste
|
|
If CompoListIndex = -1 Then
|
|
' il componente non esiste
|
|
sErrorInfo &= String.Format(EgtMsg(50136), CompoNameDDF, Index - 1)
|
|
sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50133), CompoNameDDF) & vbCrLf
|
|
Return -1
|
|
End If
|
|
|
|
' Passo alla lettura delle linee con eventuali - shape/- template e con i parametri
|
|
While Index < FileContent.Count
|
|
Dim sLine As String = RemoveComment(FileContent(Index))
|
|
' se stringa vuota o tutto commento, vado oltre
|
|
If String.IsNullOrWhiteSpace(sLine) Then
|
|
Index += 1
|
|
Continue While
|
|
End If
|
|
' se fine pezzo o fine file, esco dal ciclo
|
|
If Search3Hyphens(sLine) OrElse Search3Dots(sLine) Then Exit While
|
|
' se nome, esco dal ciclo
|
|
If Not String.IsNullOrWhiteSpace(GetName(sLine)) Then Exit While
|
|
' cerco una chiave
|
|
Dim sKey As String = GetKey(sLine)
|
|
If String.IsNullOrWhiteSpace(sKey) Then
|
|
sErrorInfo &= String.Format(EgtMsg(50131), CompoNameDDF, Index + 1)
|
|
' 50553= has not been created.
|
|
sErrorInfo &= Environment.NewLine & CompoNameDDF & EgtMsg(50553) & vbCrLf
|
|
Part.FirstReadingEdge = True
|
|
' esco dalla lettura del compo
|
|
Exit While
|
|
End If
|
|
|
|
' Creo il componente con un riferiemento comune
|
|
Dim m_CurrCompo = New Compo(Map.refCompoPanelVM.CompoTypeList(CompoListIndex))
|
|
|
|
' Se previsto template o shape da configurazione
|
|
Dim CurrCompoTypePath As String = Map.refCompoPanelVM.CompoTypeList(CompoListIndex).Path
|
|
Dim nIsActive As Integer = EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME)
|
|
If nIsActive = 1 Or
|
|
(nIsActive = 2 And sKey.StartsWith("- ")) Then
|
|
' leggo se template o shape
|
|
Dim Name As String = String.Empty
|
|
Dim DDFName As String = String.Empty
|
|
IniFile.GetPrivateProfileCompoName(S_TEMPLATE, K_NAME, DDFName, Name, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME)
|
|
'-----------------------------------------------------------------------------------------------------------------------------------
|
|
' inizializzazione della componente
|
|
m_CurrCompo.TemplateDDFName = DDFName
|
|
m_CurrCompo.TemplateName = Name
|
|
If sLine.ToLower.Contains(FRAME_FOLDER) Then
|
|
LoadBrandFileList(m_CurrCompo, True)
|
|
Else
|
|
LoadBrandFileList(m_CurrCompo)
|
|
End If
|
|
If IsNothing(m_CurrCompo) Then
|
|
SkipParams(Index + 1)
|
|
Exit While
|
|
End If
|
|
'-----------------------------------------------------------------------------------------------------------------------------------
|
|
' Se c'è "- " iniziale
|
|
If sKey.StartsWith("- ") Then
|
|
' se la chiave non è template o shape, segno file modificato per farlo salvare
|
|
If sKey.Remove(0, 2) <> DDFName Then
|
|
Part.FirstReadingEdge = True
|
|
m_CurrCompo.LoadByDefault = True
|
|
End If
|
|
' leggo il template effettivamente utilizzato
|
|
Dim sTemplate As String = GetValueWithoutKey(sLine)
|
|
sTemplate = sTemplate.Replace("/", "\")
|
|
Dim BrandDir As String = String.Empty
|
|
Dim sFile As String = String.Empty
|
|
|
|
Dim sItems() As String = sTemplate.Split("\"c)
|
|
Dim bFileExists As Boolean = False
|
|
Dim bBrandExists As Boolean = False
|
|
' ricerca nella radice della componente
|
|
If sItems.Count < 2 Then
|
|
bBrandExists = False
|
|
sFile = Trim(sItems(0))
|
|
If m_CurrCompo.BrandListPart.Last = RAD_DIR Then
|
|
'm_CurrCompo.SelBrandPart = m_CurrCompo.BrandListPart.Last
|
|
m_CurrCompo.SetSelBrand(m_CurrCompo.BrandListPart.Last)
|
|
bBrandExists = True
|
|
For IndexFile As Integer = 0 To m_CurrCompo.FileList.Count - 1
|
|
If sFile.ToLower = m_CurrCompo.FileList(IndexFile).ToLower Then
|
|
'm_CurrCompo.SelFile = m_CurrCompo.FileList(IndexFile)
|
|
m_CurrCompo.SetSelFile(m_CurrCompo.FileList(IndexFile))
|
|
bFileExists = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
End If
|
|
' ricerca nei dierttori della radice
|
|
If sItems.Count >= 2 Then
|
|
BrandDir = Trim(sItems(0))
|
|
sFile = Trim(sItems(1))
|
|
For IndexSplit As Integer = 2 To sItems.Count - 1
|
|
sFile &= "\" & sItems(IndexSplit)
|
|
Next
|
|
For IndexBrand As Integer = 0 To m_CurrCompo.BrandListPart.Count - 1
|
|
If BrandDir.ToLower = m_CurrCompo.BrandListPart(IndexBrand).ToLower Then
|
|
'm_CurrCompo.SelBrandPart = m_CurrCompo.BrandListPart(IndexBrand)
|
|
m_CurrCompo.SetSelBrand(m_CurrCompo.BrandListPart(IndexBrand))
|
|
bBrandExists = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
If bBrandExists Then
|
|
For IndexFile As Integer = 0 To m_CurrCompo.FileList.Count - 1
|
|
If sFile.ToLower = m_CurrCompo.FileList(IndexFile).ToLower Then
|
|
'm_CurrCompo.SelFile = m_CurrCompo.FileList(IndexFile)
|
|
m_CurrCompo.SetSelFile(m_CurrCompo.FileList(IndexFile))
|
|
bFileExists = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
End If
|
|
|
|
' in caso sia fallita la ricera dei direttori o dei file
|
|
If Not bBrandExists Then
|
|
' aggiungo il brand inesistente
|
|
If String.IsNullOrEmpty(BrandDir) Then BrandDir = RAD_DIR
|
|
m_CurrCompo.BrandListPart.Add(BrandDir)
|
|
'm_CurrCompo.SelBrandPart = m_CurrCompo.BrandListPart(m_CurrCompo.BrandListPart.Count - 1)
|
|
m_CurrCompo.SetSelBrand(m_CurrCompo.BrandListPart(m_CurrCompo.BrandListPart.Count - 1))
|
|
m_CurrCompo.LoadByDefault = True
|
|
m_CurrCompo.MissingDirectory = True
|
|
End If
|
|
If Not bFileExists Then
|
|
m_CurrCompo.FileList.Add(sFile)
|
|
'm_CurrCompo.SelFile = m_CurrCompo.FileList(m_CurrCompo.FileList.Count - 1)
|
|
m_CurrCompo.SetSelFile(m_CurrCompo.FileList(m_CurrCompo.FileList.Count - 1))
|
|
' File {0} in directory {1} has not been found.
|
|
sErrorInfo &= String.Format(EgtMsg(50160), sFile, BrandDir) & vbCrLf
|
|
m_CurrCompo.LoadByDefault = True
|
|
m_CurrCompo.MissingFile = True
|
|
End If
|
|
' mi sposto alla riga successiva, anche se la componente è sbagliata carico comunque i suoi dati
|
|
Index = NextIndex(Index)
|
|
' leggo i parametri del componente
|
|
ReadParams(m_CurrCompo, sErrorInfo, Index)
|
|
' altrimenti non c'è il trattino nel file DDF
|
|
Else
|
|
' Error in reading {0}: line {1}. Expected 'template' or 'shape'.
|
|
sErrorInfo &= String.Format(EgtMsg(50132), DDFName, Index + 1)
|
|
' {0} has not been created.
|
|
sErrorInfo &= String.Format("-->" & EgtMsg(50133), CompoNameDDF) & vbCrLf
|
|
' salto tutti i suoi parametri
|
|
Index = NextIndex(Index)
|
|
SkipParams(Index)
|
|
' continuo nel ciclo while
|
|
Continue While
|
|
End If
|
|
' il componente non ha template
|
|
Else
|
|
' Se c'è "- " iniziale, errore
|
|
If sKey.StartsWith("- ") Then
|
|
' 50139 =Errore in lettura: riga {0}. Atteso {1}.
|
|
' 50161=parameter
|
|
sErrorInfo &= String.Format(EgtMsg(50139), Index + 1, EgtMsg(50161)) & vbCrLf
|
|
Return -1
|
|
End If
|
|
' nascondo il template
|
|
m_CurrCompo.TemplateVisibility = Visibility.Collapsed
|
|
' leggo il nome del template della compo dal file config.ini
|
|
Dim sTemplateName As String = String.Empty
|
|
' controllo il tipo di estensione del file (nome letto da Config.ini)
|
|
EgtUILib.GetPrivateProfileString(S_TEMPLATE, K_COMPO, "", sTemplateName, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME)
|
|
If String.IsNullOrWhiteSpace(sTemplateName) Then
|
|
sErrorInfo &= String.Format(EgtMsg(50134), CurrCompoTypePath, CONFIGINI_FILE_NAME)
|
|
sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50133), CompoNameDDF) & vbCrLf
|
|
' salto tutti i suoi parametri
|
|
Index = NextIndex(Index)
|
|
SkipParams(Index)
|
|
ElseIf Not File.Exists(CurrCompoTypePath & "\" & sTemplateName & LUA_EXTENSION) Then
|
|
sErrorInfo &= String.Format(EgtMsg(50135), CurrCompoTypePath, CONFIGINI_FILE_NAME, sTemplateName)
|
|
sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50133), CompoNameDDF) & vbCrLf
|
|
' salto tutti i suoi parametri
|
|
Index = NextIndex(Index)
|
|
SkipParams(Index)
|
|
Else
|
|
' assegno il nome del tipo di componente
|
|
m_CurrCompo.SetTemplateSelItem(sTemplateName)
|
|
ReadParams(m_CurrCompo, sErrorInfo, Index)
|
|
End If
|
|
End If
|
|
' se esiste riferimento ad identificativo, lo leggo
|
|
If Index < FileContent.Count Then
|
|
' tolgo l'indicazione di metacomando "##"
|
|
sLine = RemoveComment(FileContent(Index).Replace(DDF_METADATA, ""))
|
|
If GetKey(sLine) = K_OTHERDOOR Then
|
|
m_CurrCompo.OtherDoor = True
|
|
Index = NextIndex(Index)
|
|
End If
|
|
sLine = RemoveComment(FileContent(Index).Replace(DDF_METADATA, ""))
|
|
If GetKey(sLine) = K_IDCODECOMPONENT Then
|
|
Dim IdCode As String = String.Empty
|
|
IdCode = GetValueWithKey(sLine, K_IDCODECOMPONENT)
|
|
If Not String.IsNullOrEmpty(IdCode) Then
|
|
Dim ItemCode As String() = IdCode.Split(","c)
|
|
m_CurrCompo.IdCode = Trim(ItemCode(0))
|
|
If ItemCode.Count > 1 AndAlso Trim(ItemCode(1).ToLower) = "matched" Then
|
|
m_CurrCompo.MatchedDoor = True
|
|
End If
|
|
End If
|
|
Index = NextIndex(Index)
|
|
End If
|
|
End If
|
|
' Inserisco il componente in lista
|
|
m_CurrCompo.FontBold = FontWeights.Normal
|
|
' forzo la non modificabilità dei parametri della compo
|
|
If OptionModule.ReadOnlyDDF Then m_CurrCompo.IsReadOnly = OptionModule.ReadOnlyDDF
|
|
m_CompoList.Add(m_CurrCompo)
|
|
End While
|
|
Return Index
|
|
End Function
|
|
|
|
' Salto i parametri del componente
|
|
Private Sub SkipParams(ByRef IndexLine As Integer)
|
|
' passo alla lettura delle righe
|
|
While IndexLine < FileContent.Count
|
|
Dim sLine As String = RemoveComment(FileContent(IndexLine))
|
|
' se stringa vuota o tutto commento, vado oltre
|
|
If String.IsNullOrWhiteSpace(sLine) Then
|
|
IndexLine += 1
|
|
Continue While
|
|
End If
|
|
' se fine pezzo o fine file, esco dal ciclo
|
|
If Search3Hyphens(sLine) OrElse Search3Dots(sLine) Then Exit While
|
|
' se nome, esco dal ciclo
|
|
If Not String.IsNullOrWhiteSpace(GetName(sLine)) Then Exit While
|
|
' se chiave con '-' iniziale, esco dal ciclo
|
|
Dim sKey As String = GetKey(sLine)
|
|
If sKey.StartsWith("- ") Then Exit While
|
|
' passo alla linea successiva
|
|
IndexLine += 1
|
|
End While
|
|
End Sub
|
|
|
|
' Leggo i parametri del componente
|
|
Private Sub ReadParams(ByRef CompoTemplateItem As Compo, ByRef sErrorInfo As String, ByRef IndexLine As Integer)
|
|
' questo è l'indice dei parametri del componente
|
|
Dim IndexParam As Integer = 0
|
|
Dim ErrParamList As New List(Of String)
|
|
If CompoTemplateItem.LoadByDefault Then
|
|
While IndexLine < FileContent.Count - 1 AndAlso
|
|
Not (Search3Hyphens(RemoveComment(FileContent(IndexLine))) OrElse Search3Dots(RemoveComment(FileContent(IndexLine)))) AndAlso
|
|
Not Trim(RemoveComment(FileContent(IndexLine))).StartsWith("- ") AndAlso
|
|
(RemoveComment(FileContent(IndexLine)).StartsWith(ConstCompo.DDF_SPACE3) Or RemoveComment(FileContent(IndexLine)).StartsWith(ConstCompo.DDF_SPACE2))
|
|
' salvo i commenti
|
|
If String.IsNullOrWhiteSpace(FileContent(IndexLine)) Then
|
|
IndexLine += 1
|
|
Continue While
|
|
ElseIf GetKey(FileContent(IndexLine)) = K_OTHERDOOR Then
|
|
CompoTemplateItem.OtherDoor = True
|
|
IndexLine += 1
|
|
Continue While
|
|
End If
|
|
ErrParamList.Add(RemoveComment(FileContent(IndexLine)))
|
|
IndexLine += 1
|
|
End While
|
|
|
|
CompoTemplateItem.m_ParameterDDfList = ErrParamList
|
|
Else
|
|
While IndexParam < CompoTemplateItem.CompoParamList.Count
|
|
' il parametro seguente non appartiene a nessuna componente
|
|
If IndexLine < FileContent.Count AndAlso GetKey(FileContent(IndexLine)) = K_OTHERDOOR Then
|
|
CompoTemplateItem.OtherDoor = True
|
|
IndexLine += 1
|
|
Continue While
|
|
End If
|
|
' carico la lista dei parametri della componente parametro per parametro
|
|
Dim CurrCompoParam As CompoParam = CompoTemplateItem.CompoParamList(IndexParam)
|
|
' Controllo che il file non sia terminato e non è il nome di una nuova componente
|
|
If IndexLine < FileContent.Count And Not IsNameCompo(IndexLine) Then
|
|
Dim sLine As String = RemoveComment(FileContent(IndexLine))
|
|
' se stringa vuota o tutto commento, vado oltre
|
|
If String.IsNullOrWhiteSpace(sLine) Then
|
|
IndexLine += 1
|
|
Continue While
|
|
End If
|
|
' se fine pezzo o fine file o nome o metacomando, esco dal ciclo
|
|
If Search3Hyphens(sLine) OrElse Search3Dots(sLine) OrElse
|
|
Not String.IsNullOrWhiteSpace(GetName(sLine)) OrElse
|
|
sLine.Trim().StartsWith(DDF_METADATA) Then
|
|
If Not TypeOf CurrCompoParam Is TextBoxOnOffParam AndAlso Not TypeOf CurrCompoParam Is ComboBoxOnOffParam Then
|
|
' restituisco il messaggio che manca un parametro
|
|
' Error in reading: line {0}. Expected {1}.
|
|
sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
|
|
' All missing params will be initialized by default.
|
|
sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50140)) & vbCrLf
|
|
Part.FirstReadingEdge = True
|
|
CompoTemplateItem.MissingParameter = True
|
|
CurrCompoParam.MissingParameterInReading = True
|
|
Else
|
|
' significa che la TextBoxOnOff è stata disattivata
|
|
If TypeOf CurrCompoParam Is TextBoxOnOffParam Then
|
|
CurrCompoParam.ErrorInReading = False
|
|
CompoTemplateItem.ErrorValue = False
|
|
DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
|
|
IndexParam += 1
|
|
Continue While
|
|
End If
|
|
If TypeOf CurrCompoParam Is ComboBoxOnOffParam Then
|
|
CurrCompoParam.ErrorInReading = False
|
|
CompoTemplateItem.ErrorValue = False
|
|
DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
|
|
IndexParam += 1
|
|
Continue While
|
|
End If
|
|
End If
|
|
End If
|
|
' Se è di tipo obbligatorio (non è OnOff)
|
|
If Not (TypeOf CurrCompoParam Is TextBoxOnOffParam OrElse TypeOf CurrCompoParam Is ComboBoxOnOffParam) Then
|
|
Dim sKey As String = GetKey(sLine)
|
|
' se il nome del parametro è lo stesso di quello presente nel componente
|
|
If String.Equals(Trim(CurrCompoParam.DDFName), sKey) Then
|
|
If TypeOf CurrCompoParam Is ComboBoxParam Then
|
|
' leggo il valore DDF dal file
|
|
Dim sVal As String = GetValueWithoutKey(sLine)
|
|
' carico la lista dei valori (messaggi)
|
|
Dim List As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemList
|
|
' carico la lista dei valori DDF
|
|
Dim ListDDF As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxParam).ItemListDDF
|
|
' riscrivo i valori della lista DDF senza spazi all'inizio e alla fine e in minuscolo
|
|
For IndexListDDF As Integer = 0 To ListDDF.Count - 1
|
|
ListDDF(IndexListDDF) = Trim(ListDDF(IndexListDDF)).ToLower()
|
|
Next
|
|
' carico il valore IndexName come indice del valore selezionato dalla lista DDF
|
|
Dim IndexName As Integer = ListDDF.IndexOf(sVal.ToLower())
|
|
Dim SelItem As String = String.Empty
|
|
' se è stata trovata una corrispondenza tra il valore letto dal file e il valore presente nella lista DDF
|
|
If IndexName >= 0 Then
|
|
' restituisco il valore DDF della lista associato all'indice passato
|
|
SelItem = List(IndexName)
|
|
Else
|
|
' 50137 = Error in reading {0}: line {1}. It is not a member of the list.
|
|
sErrorInfo &= String.Format(EgtMsg(50137), sVal, IndexLine)
|
|
' 50138 = This param will be initialized by default.
|
|
sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
|
|
List.Add(sVal)
|
|
SelItem = List(List.Count - 1)
|
|
CompoTemplateItem.ErrorValue = True
|
|
CurrCompoParam.ErrorInReading = True
|
|
' SelItem = List(0)
|
|
End If
|
|
' assegno al parametro del componente il valore "filtrato"
|
|
DirectCast(CurrCompoParam, ComboBoxParam).SetSelItem(SelItem)
|
|
'DirectCast(CurrCompoParam, ComboBoxParam).SelItem = SelItem
|
|
' assegno il valore letto alla textbox
|
|
ElseIf TypeOf CurrCompoParam Is TextBoxParam Then
|
|
Dim sVal As String = GetValueWithoutKey(sLine)
|
|
' per ora non esegue nessun tipo di controllo sui valori letti dal file DDF
|
|
' DirectCast(CurrCompoParam, TextBoxParam).m_Value = sVal
|
|
Dim Local_TextBoxParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam)
|
|
If Local_TextBoxParam.bIsLen Then
|
|
ConvertDDFValueIntoCurrentUnit(m_Measure, sVal)
|
|
Local_TextBoxParam.Value = sVal
|
|
Else
|
|
Local_TextBoxParam.Value = sVal
|
|
End If
|
|
' avviso che il file è modificato (in caso di chiusura del programma obbligo a passare dal salvataggio)
|
|
Dim dVal As Double
|
|
If String.IsNullOrEmpty(sVal) OrElse Not StringToDouble(sVal, dVal) Then
|
|
' Part.FirstReadingEdge = True
|
|
CompoTemplateItem.MissingParameter = True
|
|
CompoTemplateItem.ErrorValue = True
|
|
CurrCompoParam.ErrorInReading = True
|
|
End If
|
|
End If
|
|
' se il nome esiste ma è sbagliato
|
|
ElseIf Not String.IsNullOrWhiteSpace(sKey) Then
|
|
' se il nome non è preceduto dal trattino
|
|
If Not sKey.StartsWith("- ") Then
|
|
' il nome DDF non è corretto
|
|
' Error in reading: line {0}. Expected {1}.
|
|
sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
|
|
' This param will be initialized by default.
|
|
sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
|
|
Part.FirstReadingEdge = True
|
|
CompoTemplateItem.MissingParameter = True
|
|
CurrCompoParam.MissingParameterInReading = True
|
|
' passo al parametro successivo senza cambiare linea del file DDF
|
|
IndexParam += 1
|
|
' passo alla riga successiva del file DDF
|
|
IndexLine = NextIndex(IndexLine)
|
|
Continue While
|
|
Else
|
|
' istanzio tutti i valori che mancano al compo corrente di default
|
|
' Error in reading: line {0}. Expected {1}.
|
|
sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
|
|
' This param will be initialized by default.
|
|
sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
|
|
' avviso che il file in scrittura è differente da quello in lettura
|
|
Part.FirstReadingEdge = True
|
|
CompoTemplateItem.MissingParameter = True
|
|
CurrCompoParam.MissingParameterInReading = True
|
|
' esco dal ciclo
|
|
Exit While
|
|
End If
|
|
End If
|
|
' Se altrimenti è una TextBoxOnOff
|
|
ElseIf TypeOf CurrCompoParam Is TextBoxOnOffParam Then
|
|
' se il nome del parametro è lo stesso di quello presente nel componente
|
|
If String.Equals(Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName), GetKey(sLine)) Then
|
|
' se la stringa c'è nel DDF vuol dire che è stata selezionata
|
|
Dim sVal As String = GetValueWithKey(sLine, Trim(CurrCompoParam.DDFName))
|
|
Dim Local_TextBoxOnOffParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam)
|
|
If Local_TextBoxOnOffParam.bIsLen Then
|
|
ConvertDDFValueIntoCurrentUnit(m_Measure, sVal)
|
|
Local_TextBoxOnOffParam.m_Value = sVal
|
|
Else
|
|
Local_TextBoxOnOffParam.m_Value = sVal
|
|
End If
|
|
'DirectCast(CurrCompoParam, TextBoxOnOffParam).Value = sVal
|
|
Dim dVal As Double
|
|
If String.IsNullOrEmpty(sVal) OrElse Not StringToDouble(sVal, dVal) Then
|
|
CompoTemplateItem.ErrorValue = False
|
|
CurrCompoParam.ErrorInReading = False
|
|
DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
|
|
Else
|
|
DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(True)
|
|
End If
|
|
' se il nome esiste ma è sbagliato
|
|
ElseIf Not String.IsNullOrWhiteSpace(GetKey(sLine)) Then
|
|
' significa che la TextBoxOnOff è stata disattivata
|
|
DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
|
|
' passo al parametro successivo senza cambiare linea del file DDF
|
|
IndexParam += 1
|
|
Continue While
|
|
End If
|
|
' Altrimenti è una ComboBoxOnOffParam
|
|
Else
|
|
' se il nome del parametro è lo stesso di quello presente nel componente
|
|
If String.Equals(Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName), Trim(GetKey(sLine))) Then
|
|
' leggo il valore DDF dal file
|
|
Dim sVal As String = GetValueWithKey(sLine, Trim(CurrCompoParam.DDFName))
|
|
Dim IndexName As Integer = 0
|
|
' carico la lista dei valori (messaggi)
|
|
Dim List As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxOnOffParam).ItemList
|
|
Dim IndexListDDF As Integer = 0
|
|
' carico la lista dei valori DDF
|
|
Dim ListDDF As ObservableCollection(Of String) = DirectCast(CurrCompoParam, ComboBoxOnOffParam).ItemListDDF
|
|
' riscrivo i valori della lista DDF senza spaziatura
|
|
For IndexListDDF = 0 To ListDDF.Count - 1
|
|
ListDDF(IndexListDDF) = Trim(ListDDF(IndexListDDF))
|
|
Next
|
|
' carico il valore IndexName come indice del valore selezionato dalla lista DDF
|
|
IndexName = ListDDF.IndexOf(sVal)
|
|
Dim SelItem As String = String.Empty
|
|
' se è stata trovata una corrispondenza tra il valore letto dal file e il valore presente nella lista DDF
|
|
If IndexName >= 0 Then
|
|
' restituisco il valore DDF della lista associato all'indice passato
|
|
SelItem = Trim(List(IndexName))
|
|
Else
|
|
' il nome DDF non è corretto
|
|
' Error in reading {0}: line {1}. It is not a member of the list.
|
|
sErrorInfo &= String.Format(EgtMsg(50137), sVal, IndexLine)
|
|
' This param will be initialized by default.
|
|
sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50138)) & vbCrLf
|
|
' aggiungo un nuovo elemento solo nella lista da mostrare a video, quella dei ddf non deve essere toccata
|
|
List.Add(sVal)
|
|
SelItem = List(List.Count - 1)
|
|
CompoTemplateItem.ErrorValue = True
|
|
CurrCompoParam.ErrorInReading = True
|
|
'SelItem = List(0)
|
|
End If
|
|
' assegno al parametro della compnente il valore "filtrato"
|
|
DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetSelItem(SelItem)
|
|
'DirectCast(CurrCompoParam, ComboBoxOnOffParam).SelItem = SelItem
|
|
DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(True)
|
|
' se il nome esiste ma è sbagliato
|
|
ElseIf Not String.IsNullOrWhiteSpace(GetKey(sLine)) Then
|
|
' significa che la TextBoxOnOff è stata disattivata
|
|
DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
|
|
' passo al parametro successivo senza cambiare linea del file DDF
|
|
IndexParam += 1
|
|
Continue While
|
|
End If
|
|
End If
|
|
Else
|
|
If Not IsNameCompo(IndexLine) And TypeOf DirectCast(CompoTemplateItem.CompoParamList(IndexParam), CompoParam) Is TextBoxOnOffParam Then
|
|
CurrCompoParam.ErrorInReading = False
|
|
CompoTemplateItem.ErrorValue = False
|
|
DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
|
|
ElseIf Not IsNameCompo(IndexLine) And TypeOf DirectCast(CompoTemplateItem.CompoParamList(IndexParam), CompoParam) Is ComboBoxOnOffParam Then
|
|
CurrCompoParam.ErrorInReading = False
|
|
CompoTemplateItem.ErrorValue = False
|
|
DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
|
|
ElseIf IsNameCompo(IndexLine) And TypeOf DirectCast(CompoTemplateItem.CompoParamList(IndexParam), CompoParam) Is TextBoxOnOffParam Then
|
|
CurrCompoParam.ErrorInReading = False
|
|
CompoTemplateItem.ErrorValue = False
|
|
DirectCast(CurrCompoParam, TextBoxOnOffParam).SetIsActive(False)
|
|
' non incremento l'indice della riga, passo al parametro successivo
|
|
IndexParam += 1
|
|
Continue While
|
|
ElseIf IsNameCompo(IndexLine) And TypeOf DirectCast(CompoTemplateItem.CompoParamList(IndexParam), CompoParam) Is ComboBoxOnOffParam Then
|
|
CurrCompoParam.ErrorInReading = False
|
|
CompoTemplateItem.ErrorValue = False
|
|
DirectCast(CurrCompoParam, ComboBoxOnOffParam).SetIsActive(False)
|
|
' non incremento l'indice della riga, passo al parametro successivo
|
|
IndexParam += 1
|
|
Continue While
|
|
Else
|
|
' Error in reading: line {0}. Expected {1}.
|
|
sErrorInfo &= String.Format(EgtMsg(50139), IndexLine + 1, Trim(CompoTemplateItem.CompoParamList(IndexParam).DDFName))
|
|
' All missing params will be initialized by default.
|
|
sErrorInfo &= String.Format(Environment.NewLine & EgtMsg(50140)) & vbCrLf
|
|
Part.FirstReadingEdge = True
|
|
CompoTemplateItem.MissingParameter = True
|
|
CurrCompoParam.MissingParameterInReading = True
|
|
For Index As Integer = IndexParam To CompoTemplateItem.CompoParamList.Count - 1
|
|
CompoTemplateItem.CompoParamList(Index).MissingParameterInReading = True
|
|
Next
|
|
End If
|
|
End If
|
|
' Avanzo nell'elenco dei parametri e nel file DDF
|
|
IndexParam += 1
|
|
IndexLine = NextIndex(IndexLine)
|
|
End While
|
|
End If
|
|
End Sub
|
|
|
|
' verifcio che la riga sia il nome di una componente (esempio: "hinges:")
|
|
Private Function IsNameCompo(ByRef IndexLine As Integer) As Boolean
|
|
' verifico che il file non sia terminato
|
|
If IndexLine > FileContent.Count - 1 Then
|
|
Return False
|
|
End If
|
|
' per riconoscere una componente: no spazi ad inizio riga, dopo i ":" riga vuota
|
|
If FileContent(IndexLine).StartsWith(OptionModule.m_sSpaceTabCompo) AndAlso
|
|
GetValueWithoutKey(FileContent(IndexLine)) = String.Empty Then
|
|
m_StopNextIndexLine = True
|
|
Return True
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
' controllo che tutti i bevel siano dello stesso tipo
|
|
Private Function ControlBevel(BLock As String, BHinge As String, BTop As String, BBottom As String) As String
|
|
Dim BBevel As String = String.Empty
|
|
' carico i Bevel non nulli in un vettore
|
|
Dim ArrayProfile(3) As String
|
|
If Not String.IsNullOrEmpty(BLock) Then
|
|
ArrayProfile(0) = BLock
|
|
BBevel = BLock
|
|
Else
|
|
ArrayProfile(0) = String.Empty
|
|
End If
|
|
If Not String.IsNullOrEmpty(BHinge) Then
|
|
ArrayProfile(1) = BHinge
|
|
BBevel = BHinge
|
|
Else
|
|
ArrayProfile(1) = String.Empty
|
|
End If
|
|
If Not String.IsNullOrEmpty(BTop) Then
|
|
ArrayProfile(2) = BTop
|
|
BBevel = BTop
|
|
Else
|
|
ArrayProfile(2) = String.Empty
|
|
End If
|
|
If Not String.IsNullOrEmpty(BBottom) Then
|
|
ArrayProfile(3) = BBottom
|
|
BBevel = BBottom
|
|
Else
|
|
ArrayProfile(3) = String.Empty
|
|
End If
|
|
For Index1 As Integer = 0 To 2
|
|
For Index2 As Integer = Index1 + 1 To 3
|
|
If Not String.IsNullOrEmpty(ArrayProfile(Index1)) And Not String.IsNullOrEmpty(ArrayProfile(Index2)) Then
|
|
' eseguo il confronto
|
|
If ArrayProfile(Index1) <> ArrayProfile(Index2) Then
|
|
If m_Swing.Contains("I") Then
|
|
If (Index1 = 0 OrElse Index2 = 0) Then
|
|
SetInvertBevel(True)
|
|
Continue For
|
|
End If
|
|
End If
|
|
' 50101 =Error
|
|
' 50170 =Incongruity between the bevel, it has been resolved by default.
|
|
MessageBox.Show(EgtMsg(50170), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Part.FirstReadingEdge = True ' per mantere attivo l'asterisco di modifica
|
|
BBevel = ArrayProfile(Index1)
|
|
Exit For
|
|
Else
|
|
BBevel = ArrayProfile(Index1)
|
|
End If
|
|
End If
|
|
Next
|
|
Next
|
|
Return BBevel
|
|
End Function
|
|
|
|
' restituisce il messaggio di modifica del bevel
|
|
Private Sub Modifybevel(Bevel As String, OppositeBevel As String)
|
|
If Bevel = ConstGen.BEVEL_GRAPHIC Then
|
|
bModifyBevel = True
|
|
Part.FirstReadingEdge = True
|
|
End If
|
|
If Bevel = OppositeBevel Then
|
|
' "Door dispositiopn has been modify."
|
|
If Not InvertBevel Then
|
|
bModifyBevel = True
|
|
Part.FirstReadingEdge = True
|
|
End If
|
|
End If
|
|
' Modifico il secure (diverso da zero)
|
|
If String.IsNullOrEmpty(Bevel) AndAlso m_Secure <> "0" AndAlso m_Secure <> DdfFile.SetSecure(m_SwingAlias.Name, m_DispositionItem.Name, m_Secure) Then
|
|
bModifyBevel = True
|
|
Part.FirstReadingEdge = True ' per mantere attivo l'asterisco di modifica
|
|
End If
|
|
' caso speciale
|
|
If String.IsNullOrEmpty(Bevel) AndAlso m_Secure = "0" AndAlso DdfFile.SetSecure(m_SwingAlias.Name, m_DispositionItem.Name, m_Secure) = ConstGen.SWING_UP Then
|
|
bModifyBevel = True
|
|
Part.FirstReadingEdge = True ' per mantere attivo l'asterisco di modifica
|
|
End If
|
|
End Sub
|
|
|
|
' verifico che il parametro letto da ddf esista
|
|
Private Function ControlProfileInList(ByRef Local_ListEdgeType As ObservableCollection(Of EdgeType), ByRef sEdgeType As String) As Boolean
|
|
For IndexList As Integer = 0 To Local_ListEdgeType.Count - 1
|
|
If sEdgeType = Local_ListEdgeType(IndexList).Name OrElse sEdgeType = Local_ListEdgeType(IndexList).BevelDDF Then
|
|
Return True
|
|
End If
|
|
Next
|
|
Return False
|
|
End Function
|
|
|
|
#End Region ' Lettura ddf
|
|
|
|
#Region "COSTRUTTORE"
|
|
|
|
Sub New(ref_PartDoor As PartDoor)
|
|
m_refPartDoor = ref_PartDoor
|
|
'CompoParam.m_rfSetTitle = AddressOf SetTitle
|
|
End Sub
|
|
|
|
' utilizzata per generare la porta/jamb dell'Hardware
|
|
Sub New(Hardware As String)
|
|
|
|
If Not String.IsNullOrEmpty(Hardware) Then
|
|
Me.m_Width = OptionModule.m_WidthJamb
|
|
Me.m_Height = OptionModule.m_Height
|
|
Me.m_Thickness = OptionModule.m_ThicknessJamb
|
|
Me.SetSwing(OptionModule.m_Swing)
|
|
If Not IsNothing(OptionModule.m_CurrMaterial) Then
|
|
Try
|
|
Me.SetMaterial(m_MaterialList.First(Function(x) x.Name = Trim(OptionModule.m_CurrMaterial.Name)))
|
|
Catch ex As Exception
|
|
Me.SetMaterial(OptionModule.m_MaterialList(0))
|
|
End Try
|
|
Else
|
|
Me.SetMaterial(OptionModule.m_MaterialList(0))
|
|
End If
|
|
Me.m_IsActive = True
|
|
Me.m_Measure = ConvertMmUnitsToString(OptionModule.m_bIsMmUnit)
|
|
Me.m_Weight = OptionModule.m_Weight
|
|
Me.SetLockEdgeType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.SetHingeEdgeType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.SetTopType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.SetBottomType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.m_LockEdgeMachining = OptionModule.m_LockEdgeMachining
|
|
Me.m_HingeEdgeMachining = OptionModule.m_HingeEdgeMachining
|
|
Me.m_TopMachining = OptionModule.m_TopMachining
|
|
Me.m_BottomMachining = OptionModule.m_BottomMachining
|
|
Me.m_LockEdgeOverMaterial = OptionModule.m_LockEdgeOverMaterial
|
|
Me.m_HingeEdgeOverMaterial = OptionModule.m_HingeEdgeOverMaterial
|
|
Me.m_TopOverMaterial = OptionModule.m_TopOverMaterial
|
|
Me.m_BottomOverMaterial = OptionModule.m_BottomOverMaterial
|
|
Me.SetDispositionItem(OptionModule.m_Disposition)
|
|
Me.TypePart = ConstGen.PART_FRAME_LEFT
|
|
Return
|
|
End If
|
|
|
|
Dim bCLoneDoor As Boolean = (GetMainPrivateProfileInt(S_GENERAL, "CloneDoor", 0) = 1)
|
|
' Se abilitato in file Ini "DoorClone" allora verifico se esiste una porta corrente
|
|
If bCLoneDoor And Not IsNothing(Map.refAssemblyManagerVM) AndAlso Not IsNothing(Map.refAssemblyManagerVM.CurrProject) AndAlso
|
|
Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) AndAlso
|
|
Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly) AndAlso
|
|
Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly.ListPartDoor) Then
|
|
' Se presente una sola anta
|
|
Dim nPartDoor As Integer = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly.ListPartDoor.Count
|
|
If nPartDoor = 1 Then
|
|
Dim LocalPartDoor As PartDoor = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly.ListPartDoor(0)
|
|
If Not IsNothing(LocalPartDoor.Door) Then
|
|
Me.m_Width = LocalPartDoor.Door.m_Width
|
|
Me.m_Height = LocalPartDoor.Door.m_Height
|
|
Me.m_Thickness = LocalPartDoor.Door.m_Thickness
|
|
Me.SetSwing(LocalPartDoor.Door.m_Swing)
|
|
Me.SetLockEdgeType(New EdgeType(LocalPartDoor.Door.LockEdgeType.Name, Visibility.Visible))
|
|
Me.SetHingeEdgeType(New EdgeType(LocalPartDoor.Door.HingeEdgeType.Name, Visibility.Visible))
|
|
Me.SetTopType(New EdgeType(LocalPartDoor.Door.TopType.Name, Visibility.Visible))
|
|
Me.SetBottomType(New EdgeType(LocalPartDoor.Door.BottomType.Name, Visibility.Visible))
|
|
Else
|
|
' Devo usare i parametri di default
|
|
Me.m_Width = OptionModule.m_Width
|
|
Me.m_Height = OptionModule.m_Height
|
|
Me.m_Thickness = OptionModule.m_Thickness
|
|
Me.SetSwing(OptionModule.m_Swing)
|
|
Me.SetLockEdgeType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.SetHingeEdgeType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.SetTopType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.SetBottomType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
End If
|
|
|
|
ElseIf nPartDoor > 1 Then
|
|
' Assemblati
|
|
Dim WdSelPartV As New SelectPartV()
|
|
Dim WdSelPartVM As New SelectPartVM("Selezione della porta", "Selezione anta", nPartDoor, 1)
|
|
WdSelPartV.DataContext = WdSelPartVM
|
|
WdSelPartV.ShowDialog()
|
|
Dim nSelection As Integer = CInt(WdSelPartVM.Selection.Split(" "c)(1)) - 1
|
|
' Apro una finestra per chiedere quale anta usare come riferimento
|
|
Dim LocalPartDoor As PartDoor = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly.ListPartDoor(nSelection)
|
|
Me.m_Width = LocalPartDoor.Door.m_Width
|
|
Me.m_Height = LocalPartDoor.Door.m_Height
|
|
Me.m_Thickness = LocalPartDoor.Door.m_Thickness
|
|
Me.SetSwing(LocalPartDoor.Door.m_Swing)
|
|
Me.SetLockEdgeType(New EdgeType(LocalPartDoor.Door.LockEdgeType.Name, Visibility.Visible))
|
|
Me.SetHingeEdgeType(New EdgeType(LocalPartDoor.Door.HingeEdgeType.Name, Visibility.Visible))
|
|
Me.SetTopType(New EdgeType(LocalPartDoor.Door.TopType.Name, Visibility.Visible))
|
|
Me.SetBottomType(New EdgeType(LocalPartDoor.Door.BottomType.Name, Visibility.Visible))
|
|
Else
|
|
' Devo usare i parametri di default
|
|
Me.m_Width = OptionModule.m_Width
|
|
Me.m_Height = OptionModule.m_Height
|
|
Me.m_Thickness = OptionModule.m_Thickness
|
|
Me.SetSwing(OptionModule.m_Swing)
|
|
Me.SetLockEdgeType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.SetHingeEdgeType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.SetTopType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.SetBottomType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
End If
|
|
Else
|
|
Me.m_Width = OptionModule.m_Width
|
|
Me.m_Height = OptionModule.m_Height
|
|
Me.m_Thickness = OptionModule.m_Thickness
|
|
Me.SetSwing(OptionModule.m_Swing)
|
|
Me.SetLockEdgeType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.SetHingeEdgeType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.SetTopType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
Me.SetBottomType(New EdgeType(ConstGen.BEVEL_SQUARED, Visibility.Visible))
|
|
End If
|
|
|
|
If Not IsNothing(OptionModule.m_CurrMaterial) Then
|
|
Try
|
|
Me.SetMaterial(m_MaterialList.First(Function(x) x.Name = Trim(OptionModule.m_CurrMaterial.Name)))
|
|
Catch ex As Exception
|
|
Me.SetMaterial(OptionModule.m_MaterialList(0))
|
|
End Try
|
|
Else
|
|
Me.SetMaterial(OptionModule.m_MaterialList(0))
|
|
End If
|
|
Me.m_IsActive = True
|
|
Me.m_Measure = ConvertMmUnitsToString(OptionModule.m_bIsMmUnit)
|
|
Me.m_Weight = OptionModule.m_Weight
|
|
Me.m_LockEdgeMachining = OptionModule.m_LockEdgeMachining
|
|
Me.m_HingeEdgeMachining = OptionModule.m_HingeEdgeMachining
|
|
Me.m_TopMachining = OptionModule.m_TopMachining
|
|
Me.m_BottomMachining = OptionModule.m_BottomMachining
|
|
Me.m_LockEdgeOverMaterial = OptionModule.m_LockEdgeOverMaterial
|
|
Me.m_HingeEdgeOverMaterial = OptionModule.m_HingeEdgeOverMaterial
|
|
Me.m_TopOverMaterial = OptionModule.m_TopOverMaterial
|
|
Me.m_BottomOverMaterial = OptionModule.m_BottomOverMaterial
|
|
Me.SetDispositionItem(OptionModule.m_Disposition)
|
|
Me.TypePart = ConstGen.PART_DO_ & "1"
|
|
End Sub
|
|
|
|
#End Region ' Costruttore
|
|
|
|
Public Function ShallowCopy() As Part
|
|
Return DirectCast(Me.MemberwiseClone(), Part)
|
|
End Function
|
|
|
|
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
|
|
|
Public Sub NotifyPropertyChanged(propName As String)
|
|
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
End Sub
|
|
|
|
End Class
|