diff --git a/Assembly/Assembly.vb b/Assembly/Assembly.vb
index 4593052..323c805 100644
--- a/Assembly/Assembly.vb
+++ b/Assembly/Assembly.vb
@@ -939,13 +939,19 @@ Public Class Assembly
' 50163= Error in reading General Assembly in DDF
sErrorInfo += String.Format(EgtMsg(50102), EgtMsg(50163) + vbCrLf)
ReadAssembly = Nothing
+ Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False
+ Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
Else
- If ReadAssembly.GetDDFDoor(IndexLine) = -1 Then
+ If ReadAssembly.GetDDFDoor(IndexLine, sErrorInfo) = -1 Then
ReadAssembly = Nothing
+ Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False
+ Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
End If
End If
Else
ReadAssembly = Nothing
+ Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False
+ Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
End If
If Not String.IsNullOrWhiteSpace(sErrorInfo) Then
' 50164=In General Assembly:
@@ -1215,7 +1221,7 @@ Public Class Assembly
End Function
' dopo la lettura delle informazioni dell'assemblato
- Private Function GetDDFDoor(IndexLine As Integer) As Integer
+ Private Function GetDDFDoor(IndexLine As Integer, ByRef sErrorInfo As String) As Integer
Dim Line As Integer = IndexLine
While Line < FileContent.Count - 1 AndAlso Not Search3Dots(FileContent(Line))
Dim Local_PartDoor As New PartDoor
@@ -1239,12 +1245,15 @@ Public Class Assembly
Map.refCompoPanelVM.GoBackVisibility = Visibility.Visible
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage
Else
- ' significa che stiamo per leggere una porta singola
+ ' significa che stiamo per leggere una porta singola, cerco una porta
+ If Not Local_Door.TypePart.Contains("DO_") Then
+ sErrorInfo = "The current ddf is an Assembly. Any modify will be saved as single door."
+ Continue While
+ End If
Local_Door.IsActive = True
Local_PartDoor.Door = Local_Door
Local_PartDoor.Door.SwingTypeList = OptionModule.m_SwingTypeList
Local_PartDoor.SetIsChecked(Local_Door.IsActive)
- 'SetArrayPartDoor(Local_PartDoor, 0)
ListPartDoor.Add(Local_PartDoor)
Map.refPartPageVM.CurrPart = Local_Door
Map.refCompoPanelVM.GoBackVisibility = Visibility.Collapsed
@@ -1313,12 +1322,22 @@ Public Class Assembly
If Not m_Exterior Then Local_PartDoor.Door.IsActive = False
End Select
End While
- 'DoorVisibility()
- BuiltReffCompo = True
- SetPartDoorCurrAssembly()
- Map.refAssemblyManagerVM.CreateAssociation(Me)
- MatchCompo()
- Return 1
+
+ If ListPartDoorOfDoor.Count < 1 Then
+ Map.refSceneManagerVM.RefreshBtn()
+ EgtZoom(ZM.ALL)
+ sErrorInfo = "The current ddf does not contain a door!"
+ Return -1
+ Else
+ If Not String.IsNullOrEmpty(sErrorInfo) Then
+ Part.FirstReadingEdge = True
+ End If
+ End If
+ BuiltReffCompo = True
+ SetPartDoorCurrAssembly()
+ Map.refAssemblyManagerVM.CreateAssociation(Me)
+ MatchCompo()
+ Return 1
End Function
#Region "Associazione delle compo lette da ddf"
@@ -1510,24 +1529,57 @@ Public Class Assembly
' se non è stata trovata nessuna associazione esco
If IsNothing(refPartDoor) Then Return False
+ ' verifico che il nome non sia scritto direttamente nel file lua
+ Dim CurrDoorHArdwareFile As String = CurrCompo.CompoType.Path & "\" & CurrCompo.TemplateSelItem
+ If Path.GetExtension(CurrDoorHArdwareFile) <> NGE_EXTENSION Then
+ CurrDoorHArdwareFile &= LUA_EXTENSION
+ End If
+ If File.Exists(CurrDoorHArdwareFile) Then
+ Dim ReadCurrCompo() As String = File.ReadAllLines(CurrDoorHArdwareFile)
+ For LineIndex = 0 To ReadCurrCompo.Count - 1
+ ' cerco il titolo [Match File]: se lo trovo
+ If RegexFunction.IsMatchingParameterTitle(ReadCurrCompo(LineIndex)) Then
+ ' mi preparo per leggere la prima riga dopo il titolo
+ Dim ParamIndex As Integer = 1
+ FrameFile = Trim(RegexFunction.ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_MATCHING_FILE))
+ While String.IsNullOrEmpty(FrameFile) And LineIndex + ParamIndex < ReadCurrCompo(LineIndex + ParamIndex).Count
+ ParamIndex += 1
+ FrameFile = Trim(RegexFunction.ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_MATCHING_FILE))
+ End While
+ ' quando termino il ciclo while posso uscire anche dal for
+ Exit For
+ End If
+ Next
+ End If
+ ' se non esiste nessun accoppiamento allora esco ed elimino la componente
+ If FrameFile.Contains("None") Then
+ If Not IsNothing(CurrCompo.refJambCompo) Then
+ Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo, True)
+ CurrCompo.refJambCompo = Nothing
+ End If
+ Return False
+ End If
+ ' converto il numero di porte da string a int
Int32.TryParse(Map.refAssemblyPageVM.CurrAssembly.DoorNumber, nDoorNbr)
' cerco il nome nella tabella: se lo script lua da errori, e la variabile FrameFile è vuota esco
- If Not CalcCompoMatching(CurrCompo.CompoType.Path, nDoorNbr, CurrCompo.TemplateSelItem, FrameFile) AndAlso
- String.IsNullOrEmpty(FrameFile) Then
+ If String.IsNullOrEmpty(FrameFile) AndAlso
+ Not CalcCompoMatching(CurrCompo.CompoType.Path, nDoorNbr, CurrCompo.TemplateSelItem, FrameFile) AndAlso
+ String.IsNullOrEmpty(FrameFile) Then
+ ' elimino la componente di riferimento
If Not IsNothing(CurrCompo.refJambCompo) Then
- Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo.refJambCompo)
+ Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo, True)
CurrCompo.refJambCompo = Nothing
End If
Return False
End If
' costruisco il percosrso del file Config.ini associato al FrameFile
- If Not SearchFileConfig(FrameFile, FrameFileConfig) AndAlso Not File.Exists(FrameFileConfig) Then
+ If Not SearchFileConfig(FrameFile, FrameFileConfig) Then
' 50144 =Warning, 50166 =Jamb compo does not exist
MessageBox.Show(EgtMsg(50166), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
' se il file FrameFileConfig.ini non esiste allora elimino il riferimento
If Not IsNothing(CurrCompo.refJambCompo) Then
- Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo.refJambCompo)
+ Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo, True)
CurrCompo.refJambCompo = Nothing
End If
' restituisco false perchè la componente non è stata creata
@@ -1631,7 +1683,7 @@ Public Class Assembly
If BuiltReffCompo Then CreateCompoOnJamb(CurrCompo)
Case "JambIsCheked"
- Map.refAssemblyManagerVM.CreateJamb(Me)
+ Map.refAssemblyManagerVM.CreateJamb(Me, False)
Map.refAssemblyManagerVM.LoadOM_M_ET(Me)
Map.refAssemblyManagerVM.CreateAssociation(Me)
SetNewDimensionAssembly()
@@ -1690,7 +1742,7 @@ Public Class Assembly
Public Sub UpDateAllCompo()
Dim IdexDoorNumber As Integer = 0
IdexDoorNumber = CInt(m_DoorNumber)
-
+ If ListPartDoorOfDoor.Count < 1 Then Return
For IndexDoor As Integer = 0 To IdexDoorNumber - 1
For IndexCompo As Integer = 0 To ListPartDoorOfDoor(IndexDoor).Door.CompoList.Count - 1
' per ogni componente di ogni porta, se esiste una componente di riferimento
@@ -2302,6 +2354,20 @@ Public Class Assembly
#End Region ' Swing
+ Public Sub RefreshJambCheck()
+ For Each Item In ListPartDoor
+ If Item.Door.TypePart.Contains("FL_") Then
+ JambLIsChecked = Item.Door.IsActive
+ ElseIf Item.Door.TypePart.Contains("FT_") Then
+ JambTIsChecked = Item.Door.IsActive
+ ElseIf Item.Door.TypePart.Contains("FB_") Then
+ JambBIsChecked = Item.Door.IsActive
+ ElseIf Item.Door.TypePart.Contains("FT_") Then
+ JambTIsChecked = Item.Door.IsActive
+ End If
+ Next
+ End Sub
+
' definisc le costanti dell'assemblato
Public Sub SetVarAssembly()
Dim dHeight As Double
diff --git a/AssemblyManager/AssemblyManagerVM.vb b/AssemblyManager/AssemblyManagerVM.vb
index 557ebc2..f8a772b 100644
--- a/AssemblyManager/AssemblyManagerVM.vb
+++ b/AssemblyManager/AssemblyManagerVM.vb
@@ -80,10 +80,19 @@ Public Class AssemblyManagerVM
End Sub
Public Function Save(SavedAssName As AssemblyName) As Boolean
- If IsNothing(SavedAssName) Then Return False
+ If IsNothing(SavedAssName) OrElse IsNothing(SavedAssName.SelAssembly) Then Return False
' Salvo
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then
- DdfFile.WriteDDFPart(SavedAssName.SelAssembly.ListPartDoorOfDoor(0).Door, SavedAssName.Name, True, False)
+ ' questa condizione non DOVREBBE mai accadere, perchè viene interrotto prima il caricamento
+ If SavedAssName.SelAssembly.ListPartDoorOfDoor.Count < 1 Then
+ If MessageBox.Show("The current ddf is a part of a frame, do you want to save?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) = MessageBoxResult.Yes Then
+ DdfFile.WriteDDFPart(SavedAssName.SelAssembly.ListPartDoor(0).Door, SavedAssName.Name, True, False)
+ Else
+ Return False
+ End If
+ Else
+ DdfFile.WriteDDFPart(SavedAssName.SelAssembly.ListPartDoorOfDoor(0).Door, SavedAssName.Name, True, False)
+ End If
Else
DdfFile.WriteDDFAssembly(SavedAssName.SelAssembly, SavedAssName.Name, True)
End If
@@ -91,7 +100,7 @@ Public Class AssemblyManagerVM
SavedAssName.IsModified = False
SavedAssName.NotifyPropertyChanged("IsModify")
End If
-
+
Return True
End Function
@@ -258,7 +267,7 @@ Public Class AssemblyManagerVM
End Sub
' creazione dei jamb
- Public Sub CreateJamb(ByRef CurrAssembly As Assembly)
+ Public Sub CreateJamb(ByRef CurrAssembly As Assembly, Optional bNewAssembly As Boolean = True)
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then Return
' in questa fase carico separatamete i valori di ogni jamb
' in particolare le differenze tra i jamb sono -> Type, -> le dimensioni (ThicknessHead = Door.Height)
@@ -271,10 +280,15 @@ Public Class AssemblyManagerVM
LeftJamb.Door.SetWidth(CurrAssembly.Width)
' assegno la lista completa degli swing perchè la selezione dello swing corretto avviene nel programma
LeftJamb.Door.SwingTypeList = OptionModule.m_SwingTypeList
- LeftJamb.Door.IsActive = OptionModule.m_LeftJambChk
' definisce la disposizione (da selezionare in una sola anta)
LeftJamb.Door.SetDispositionItem(OptionModule.m_Disposition)
- LeftJamb.IsChecked = OptionModule.m_LeftJambChk
+ If bNewAssembly Then
+ LeftJamb.IsChecked = OptionModule.m_LeftJambChk
+ LeftJamb.Door.IsActive = OptionModule.m_LeftJambChk
+ Else
+ LeftJamb.IsChecked = False
+ LeftJamb.Door.IsActive = False
+ End If
CreateNewPropertiesListJamb(LeftJamb.Door.PropertiesList)
' aggiungo alla lista dei PartDoor
CurrAssembly.ListPartDoor.Add(LeftJamb)
@@ -289,10 +303,15 @@ Public Class AssemblyManagerVM
RightJamb.Door.SetWidth(CurrAssembly.Width)
' assegno la lista completa degli swing perchè la selezione dello swing corretto avviene nel programma
RightJamb.Door.SwingTypeList = OptionModule.m_SwingTypeList
- RightJamb.Door.IsActive = OptionModule.m_RightJambChk
' definisce la disposizione (da selezionare in una sola anta)
RightJamb.Door.SetDispositionItem(OptionModule.m_Disposition)
- RightJamb.IsChecked = OptionModule.m_RightJambChk
+ If bNewAssembly Then
+ RightJamb.IsChecked = OptionModule.m_RightJambChk
+ RightJamb.Door.IsActive = OptionModule.m_RightJambChk
+ Else
+ RightJamb.IsChecked = False
+ RightJamb.Door.IsActive = False
+ End If
CreateNewPropertiesListJamb(RightJamb.Door.PropertiesList)
' aggiungo alla lista dei PartDoor
CurrAssembly.ListPartDoor.Add(RightJamb)
@@ -307,10 +326,15 @@ Public Class AssemblyManagerVM
TopJamb.Door.SetHeight(CurrAssembly.ThicknessHead)
' assegno la lista completa degli swing perchè la selezione dello swing corretto avviene nel programma
TopJamb.Door.SwingTypeList = OptionModule.m_SwingTypeList
- TopJamb.Door.IsActive = OptionModule.m_TopJambChk
' definisce la disposizione (da selezionare in una sola anta)
TopJamb.Door.SetDispositionItem(OptionModule.m_Disposition)
- TopJamb.IsChecked = OptionModule.m_TopJambChk
+ If bNewAssembly Then
+ TopJamb.IsChecked = OptionModule.m_TopJambChk
+ TopJamb.Door.IsActive = OptionModule.m_TopJambChk
+ Else
+ TopJamb.IsChecked = False
+ TopJamb.Door.IsActive = False
+ End If
CreateNewPropertiesListJamb(TopJamb.Door.PropertiesList)
CurrAssembly.ListPartDoor.Add(TopJamb)
End If
@@ -327,9 +351,14 @@ Public Class AssemblyManagerVM
BottomJamb.Door.IsActive = OptionModule.m_BottomJambChk
' definisce la disposizione (da selezionare in una sola anta)
BottomJamb.Door.SetDispositionItem(OptionModule.m_Disposition)
- BottomJamb.IsChecked = OptionModule.m_TopJambChk
CreateNewPropertiesListJamb(BottomJamb.Door.PropertiesList)
- BottomJamb.IsChecked = True
+ If bNewAssembly Then
+ BottomJamb.IsChecked = True
+ BottomJamb.IsChecked = OptionModule.m_TopJambChk
+ Else
+ BottomJamb.IsChecked = False
+ BottomJamb.IsChecked = False
+ End If
' aggiungo alla lista dei PartDoor
CurrAssembly.ListPartDoor.Add(BottomJamb)
ElseIf Not IsNothing(ReserchPartDoor("FB_")) AndAlso Not CurrAssembly.Exterior Then
@@ -338,12 +367,12 @@ Public Class AssemblyManagerVM
LocalJamb = Nothing
End If
- ' i parametri che non sono ancora stati caricati sono:
- ' Swing -> dalla porta
- ' Size -> dalla porta
- ' OverMaterial -> LoadOM_M_ET
- ' Machining -> LoadOM_M_ET
- ' EdgeType -> LoadOM_M_ET
+ ' i parametri che non sono ancora stati caricati sono:
+ ' Swing -> dalla porta
+ ' Size -> dalla porta
+ ' OverMaterial -> LoadOM_M_ET
+ ' Machining -> LoadOM_M_ET
+ ' EdgeType -> LoadOM_M_ET
End Sub
@@ -678,13 +707,14 @@ Public Class AssemblyManagerVM
'----------------------------------------------------------------------------------------------------------------------------------------------------
' Creo nuovo assembly
' Lancio la finestra per chiedere il nome dell'assemblato
- Dim SaveFileDialog As New EgtWPFLib5.EgtSaveFileDialog
+ Dim SaveFileDialog As New MySaveFileDialogVM
+ Dim SaveFileDialogWnd As New EgtWPFLib5.SaveFileDialogV(Application.Current.MainWindow, SaveFileDialog)
' New Door
SaveFileDialog.Title = EgtMsg(50113)
SaveFileDialog.Directory = m_CurrProject.Name
SaveFileDialog.Extension = DDF_EXTENSION
' Se annullo esco
- If Not SaveFileDialog.EgtShowDialog Then Return
+ If Not SaveFileDialogWnd.ShowDialog Then Return
' Controllo se il nome della porta ha estensione
If Path.HasExtension(SaveFileDialog.FileName) Then
Dim sExtension As String = Path.GetExtension(SaveFileDialog.FileName)
diff --git a/Constants/ConstCompo.vb b/Constants/ConstCompo.vb
index b901504..b3505a6 100644
--- a/Constants/ConstCompo.vb
+++ b/Constants/ConstCompo.vb
@@ -60,7 +60,7 @@ Module ConstCompo
' K_NAME come sopra indicato
Public Const K_COMPO As String = "Compo"
Public Const S_NGECONFIG As String = "NgeConfig"
- Public Const K_DEFAULT As String = "Default"
+ Public Const K_DEFAULT As String = "Default"
Public Const S_POSITIONSIDE As String = "PositionSide"
Public Const K_SIDE As String = "Side"
Public Const S_GR_PARAM_DEFAULT = "Graphic parameters"
@@ -70,6 +70,14 @@ Module ConstCompo
Public Const S_LAYER As String = "Layer"
Public Const K_LAYER_NAME As String = "LayerName"
+ Public Const K_MATCHING_FILE As String = "MatchingFile"
+ Public Const MATCHING_FILE_TEMPLATE As String = "Match File"
+ Public Const MATCHING_FILE_AUTOMATIC As String = "Automatic"
+ Public Const MATCHING_FILE_NONE As String = "None"
+ Public Const MATCHING_INI As String = "Matching"
+ Public Const BRAND_INI As String = "Brand"
+ Public Const BRAND_FILE_INI As String = "File"
+
' Hardware
Public Const S_HARDWARE As String = "Hardware"
Public Const K_TYPE As String = "Type"
diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb
index d712f32..1af2ae0 100644
--- a/Constants/ConstIni.vb
+++ b/Constants/ConstIni.vb
@@ -31,6 +31,7 @@ Module ConstIni
Public Const K_DISABLEHM As String = "DisableHM"
Public Const K_DISABLEDELETECOMMANDHM As String = "DisableDeleteCommandH"
Public Const K_DISABLEPROPERTIES As String = "DisableProperties"
+ Public Const K_DISABLEADDGEOMETRY As String = "DisableAddGeometry"
Public Const S_LANGUAGES As String = "Languages"
Public Const K_LANGUAGE As String = "Language"
diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb
index 83323da..06ee9c8 100644
--- a/DoorParameters/Compo.vb
+++ b/DoorParameters/Compo.vb
@@ -270,6 +270,8 @@ Public Class Compo
Return m_SelFile
End Get
Set(value As String)
+ ' se il valore è nothing significa che non è stata fatta nessuna selezione, quindi esco
+ If IsNothing(value) Then Return
m_SelFile = value
' ricostruisco il nome del template da passare alle funzioni
Dim ModelDir As String = String.Empty
@@ -355,7 +357,8 @@ Public Class Compo
' ricevuto il nome scritto nel file ddf viene scomposto per asseganare una parte alla proprietà Brand e una a alla proprietà File
Public Sub SplitBrandFile(TemplateValue As String)
Dim ItemsTemplate() As String = TemplateValue.Split("\"c)
- If ItemsTemplate.Count < 1 Then Return
+ ' il nome deve contenere: Hardware\Directory.Frame\File
+ If ItemsTemplate.Count < 3 Then Return
SetSelBrand(Trim(ItemsTemplate(1)))
Dim sFile As String = String.Empty
sFile &= ItemsTemplate(2)
@@ -1651,11 +1654,33 @@ Public Class ComboBoxParam
CurrCompo.SetTemplateSelItem(CurrCompo.TemplateSelItem)
Map.refAssemblyPageVM.CurrAssembly.CreateCompoOnJamb(CurrCompo, Trim(m_SelItem))
End If
+ ' verifico di essere nella configurazione HardwareManager e che la Compo chiamata si chiama "Match File"
+ If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage And CmpPar.CurrCompo.TemplateName = "Match File" Then
+ Select Case CmpPar.DDFName
+ Case ConstCompo.MATCHING_INI
+ ' devo caricare la lista dei Brand da associare
+ Dim BLD As ObservableCollection(Of CompoBrandDir) = Map.refHardwarePageVM.CurrHardware.SelectMatching(Me, Me.CurrCompo)
+ Map.refHardwarePageVM.CurrHardware.SelectFileMatching(Me, BLD)
+ Case ConstCompo.BRAND_INI
+ Map.refHardwarePageVM.CurrHardware.SlectBrandMatching(Me)
+ End Select
+ End If
Map.refSceneManagerVM.RefreshBtn()
End Set
End Property
Friend Sub SetSelItem(value As String)
m_SelItem = value
+ ' verifico di essere nella configurazione HardwareManager e che la Compo chiamata si chiama "Match File"
+ If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage And Me.CurrCompo.TemplateName = "Match File" Then
+ Select Case Me.DDFName
+ Case ConstCompo.MATCHING_INI
+ ' devo caricare la lista dei Brand da associare
+ Dim BLD As ObservableCollection(Of CompoBrandDir) = Map.refHardwarePageVM.CurrHardware.SelectMatching(Me, Me.CurrCompo)
+ Map.refHardwarePageVM.CurrHardware.SelectFileMatching(Me, BLD)
+ Case ConstCompo.BRAND_INI
+ Map.refHardwarePageVM.CurrHardware.SlectBrandMatching(Me)
+ End Select
+ End If
NotifyPropertyChanged("SelItem")
End Sub
@@ -1906,6 +1931,12 @@ Public Class ComboBoxParamLua
End Set
End Property
+ Public ReadOnly Property VisibilityButtonAddGeometry As Visibility
+ Get
+ Return OptionModule.m_DisableAddGeometry
+ End Get
+ End Property
+
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, ItemList As ObservableCollection(Of String), ItemListDDF As ObservableCollection(Of String), sSelItem As String, Optional sLayerName As String = "", Optional sKey2 As String = "")
MyBase.New(sDDFName, sName, CurrCompo, ItemList, ItemListDDF, sSelItem, sLayerName)
m_refParam = sKey2
diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb
index 6567cb2..1b4c9aa 100644
--- a/DoorParameters/Part.vb
+++ b/DoorParameters/Part.vb
@@ -7,8 +7,12 @@ 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
+
' costruisco il riferimento con l'oggetto PartDoor che ospita il Part
Private m_refPartDoor As PartDoor
Public Property refPartDoor As PartDoor
@@ -215,14 +219,18 @@ Public Class Part
'SetVarSize()
UpdateToolTip()
NotifyPropertyChanged("Height")
- Map.refAssemblyPageVM.CurrAssembly.SetDimension("Height")
- Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
+ 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
NotifyPropertyChanged("Height")
- Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
+ 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
@@ -258,7 +266,9 @@ Public Class Part
Public Sub SetWidth(sWidth As String)
m_Width = sWidth
NotifyPropertyChanged("Width")
- Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
+ 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
@@ -892,7 +902,7 @@ Public Class Part
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))
+ 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
@@ -1364,7 +1374,7 @@ Public Class Part
Item.IsChecked = False
Next
End If
- If ReadDoor.bModifyProperties Then
+ If ReadDoor.bModifyProperties And Not FirstReadingEdge Then
' 50194 = Properties has been deleted
MessageBox.Show(EgtMsg(50194), EgtMsg(50118), MessageBoxButton.OK, MessageBoxImage.Information)
FirstReadingEdge = True
@@ -2502,8 +2512,32 @@ Public Class Part
'CompoParam.m_rfSetTitle = AddressOf SetTitle
End Sub
- ' utilizzata per generare la porta dell'Hardware
+ ' 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)
+ 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
Me.m_Width = OptionModule.m_Width
Me.m_Height = OptionModule.m_Height
Me.m_Thickness = OptionModule.m_Thickness
@@ -2527,6 +2561,7 @@ Public Class Part
Me.TypePart = ConstGen.PART_DO_ & "1"
End Sub
+
#End Region ' Costruttore
Public Function ShallowCopy() As Part
diff --git a/EgtDOORCreator.vbproj b/EgtDOORCreator.vbproj
index 08760a1..d6febfd 100644
--- a/EgtDOORCreator.vbproj
+++ b/EgtDOORCreator.vbproj
@@ -189,6 +189,9 @@
PrintWndV.xaml
+
+ MySaveFileDialogV.xaml
+ ProjectManagerHardwareV.xaml
@@ -198,6 +201,7 @@
ProjectManagerV.xaml
+ DimensioningPanelV.xaml
@@ -317,6 +321,10 @@
DesignerMSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+ DesignerMSBuild:Compile
diff --git a/HardwareManager/Hardware.vb b/HardwareManager/Hardware.vb
index 0804963..41f672a 100644
--- a/HardwareManager/Hardware.vb
+++ b/HardwareManager/Hardware.vb
@@ -12,6 +12,7 @@ Public Class Hardware
Dim ErrorReading As String = String.Empty
Dim BackupDir As String = IniFile.m_CompoDir & ConstGen.BACKUPDIR
Dim bNewHardware As Boolean = False
+ Dim bIsFrame As Boolean = False
' Path StdTemplate.ini
Private m_StdTemplate As String = String.Empty ' il percorso viene aggiornato ad ogni scelta dell'hardware in LoadType()
@@ -53,6 +54,14 @@ Public Class Hardware
DeleteTempFile()
m_SelBrand = value
If Not IsNothing(m_SelBrand) Then
+ ' riconosce il tipo di Hardaware in base alla cartella in cui è slavato
+ If m_SelBrand.ModelDir.ToLower.Contains(FRAME_FOLDER) Then
+ bIsFrame = True
+ Map.refHardwarePageVM.GenericPart = Map.refHardwarePageVM.Jamb
+ Else
+ bIsFrame = False
+ Map.refHardwarePageVM.GenericPart = Map.refHardwarePageVM.Door
+ End If
' Carico lista template
TemplateList = m_SelBrand.ModelFileList
If m_SelBrand.ModelFileList.Count > 0 Then
@@ -197,6 +206,130 @@ Public Class Hardware
#End Region ' TypeList
+#Region "MATCHING"
+ 'creo il capitolo "Match File"
+ Private Function CreateChapterMatching() As Compo
+ If Me.SelBrand.ModelDir.ToLower.Contains(".frame") Then Return Nothing
+
+ ' creo la classe che ospiterà gli oggetti di tipo ComboBox
+ Dim CompoMatch As New Compo(m_HardwareGeneral)
+ CompoMatch.TemplateDDFName = MATCHING_FILE_TEMPLATE
+ CompoMatch.TemplateName = MATCHING_FILE_TEMPLATE
+ ' creo le liste delle configurazioni
+ Dim LocalHardwareListName As New ObservableCollection(Of String)
+ Dim LocalHardwareListDDFName As New ObservableCollection(Of String)
+ If File.Exists(m_HardwareGeneral.Path & "\" & MATCHING_FILE_NAME) Then
+ LocalHardwareListName.Add(MATCHING_FILE_AUTOMATIC)
+ LocalHardwareListDDFName.Add(MATCHING_FILE_AUTOMATIC)
+ End If
+ LocalHardwareListName.Add(MATCHING_FILE_NONE)
+ LocalHardwareListDDFName.Add(MATCHING_FILE_NONE)
+ ' ricerco il capitolo nel file di configurazione della componente
+ IniFile.GetPrivateProfileMatchHardware(ConstCompo.MATCHING_INI, "List", LocalHardwareListDDFName, LocalHardwareListName, m_HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME)
+
+ If m_HardwareGeneral.FrameFolderList.Count > 0 Then
+ LocalHardwareListName.Add(m_HardwareGeneral.Name)
+ LocalHardwareListDDFName.Add(m_HardwareGeneral.DDFName)
+ End If
+ ' controllo che i nomi inseriti nella lista abbiano delle cartelle ".Frame"
+ For Each Item In Map.refCompoPanelHardwareVM.CompoTypeList
+ For ElemntIndex As Integer = LocalHardwareListDDFName.Count - 1 To 0 Step -1
+ If Item.DDFName = LocalHardwareListDDFName(ElemntIndex) Then
+ If Item.FrameFolderList.Count < 1 Then
+ Dim Index As Integer = LocalHardwareListName.IndexOf(Item.Name)
+ LocalHardwareListName.RemoveAt(Index)
+ LocalHardwareListDDFName.RemoveAt(Index)
+ Exit For
+ End If
+ End If
+ Next
+ Next
+
+ If LocalHardwareListDDFName.Count < 1 Then Return Nothing
+ ' creo l'oggetto da mostrare a video , 50224=Matching
+ Dim ComboBoxMatch As New ComboBoxParam(ConstCompo.MATCHING_INI, EgtMsg(50224), CompoMatch, LocalHardwareListName, LocalHardwareListDDFName, LocalHardwareListName(0))
+ CompoMatch.CompoParamList.Add(ComboBoxMatch)
+
+ Return CompoMatch
+ End Function
+
+ ' indica la selezione del tipo di Matching (in caso di associazione speciale restituisce l'elenco dei brand)
+ Public Function SelectMatching(ComboBoxMatch As ComboBoxParam, CompoMatch As Compo) As ObservableCollection(Of CompoBrandDir)
+ ' dalla lista che ho appena salvato devo recuperare l'elenco dei brand e dei file
+ Dim BrandList As New ObservableCollection(Of CompoBrandDir)
+ For Each Item In Map.refCompoPanelHardwareVM.CompoTypeList
+ If Item.Name = ComboBoxMatch.SelItem Then
+ BrandList = Item.FrameFolderList
+ Exit For
+ End If
+ Next
+ Return BrandList
+ End Function
+
+ ' a seconda della scelta fatta nel passaggio precedente Aggiorna la grafica per mostrare l'elenco dei brand e dei file
+ Public Sub SelectFileMatching(ComboBoxMatch As ComboBoxParam, BrandList As ObservableCollection(Of CompoBrandDir))
+ ' dalla lista che ho appena salvato devo recuperare l'elenco dei brand e dei file
+ Dim BrandListGraphic As New ObservableCollection(Of String)
+ Dim CompoMatch As Compo = ComboBoxMatch.CurrCompo
+ For Each Item In Map.refCompoPanelHardwareVM.CompoTypeList
+ If Item.Name = ComboBoxMatch.SelItem Then
+ BrandList = Item.FrameFolderList
+ For Each Element In BrandList
+ BrandListGraphic.Add(Element.ModelDirGraphic)
+ Next
+ Exit For
+ End If
+ Next
+ ' prima di procedere ripulisco completamente l'elenco
+ If CompoMatch.CompoParamList.Count = 3 Then
+ CompoMatch.CompoParamList.RemoveAt(2)
+ CompoMatch.CompoParamList.RemoveAt(1)
+ End If
+ ' se la lista dei brand non è vuota e la lista dei file non è vuota allora mostro a video gli elenchi aggiornati
+ If BrandList.Count > 0 AndAlso BrandList(0).ModelFileList.Count > 0 Then
+ Dim ComboBoxBrand As New ComboBoxParam(ConstCompo.BRAND_INI, EgtMsg(50225), CompoMatch, BrandListGraphic, BrandListGraphic, BrandListGraphic(0))
+ CompoMatch.CompoParamList.Add(ComboBoxBrand)
+ Dim FileList As New ObservableCollection(Of String)
+ FileList = BrandList(0).ModelFileList
+ Dim ComboBoxTemplate As New ComboBoxParam(ConstCompo.BRAND_FILE_INI, EgtMsg(50226), CompoMatch, FileList, FileList, FileList(0))
+ CompoMatch.CompoParamList.Add(ComboBoxTemplate)
+ Else
+
+ End If
+ End Sub
+
+ ' dalla scelta del brand restituisce la lista dei file corretta
+ Public Sub SlectBrandMatching(ComboBoxBrand As ComboBoxParam)
+ Dim CurrCompo As Compo = ComboBoxBrand.CurrCompo
+ Dim ComboBoxMatch As ComboBoxParam = DirectCast(CurrCompo.CompoParamList(0), ComboBoxParam)
+ Dim BrandListGraphic As New ObservableCollection(Of String)
+ Dim BrandList As New ObservableCollection(Of CompoBrandDir)
+ For Each Item In Map.refCompoPanelHardwareVM.CompoTypeList
+ If Item.Name = ComboBoxMatch.SelItem Then
+ BrandList = Item.FrameFolderList
+ For Each Element In BrandList
+ BrandListGraphic.Add(Element.ModelDirGraphic)
+ Next
+ Exit For
+ End If
+ Next
+ Dim Index As Integer = -1
+ For Each Item In BrandList
+ If Item.ModelDirGraphic = ComboBoxBrand.SelItem Then
+ Index = BrandList.IndexOf(Item)
+ Exit For
+ End If
+ Next
+ If Index = -1 Then Return
+ CurrCompo.CompoParamList.RemoveAt(2)
+ Dim FileList As New ObservableCollection(Of String)
+ FileList = BrandList(Index).ModelFileList
+ Dim ComboBoxTemplate As New ComboBoxParam(ConstCompo.BRAND_FILE_INI, EgtMsg(50226), CurrCompo, FileList, FileList, FileList(0))
+ CurrCompo.CompoParamList.Add(ComboBoxTemplate)
+ End Sub
+
+#End Region ' Matching
+
#Region "GENERAL FUNCTION"
#Region "Caricamento"
@@ -243,6 +376,55 @@ Public Class Hardware
End If
End Sub
+ ' carico lo swing da assegnare al part
+ Private Sub LoadSwingFromTemplate()
+ m_StdTemplate = m_HardwareGeneral.Path & "\" & STD_TEMPLATE
+ If Not File.Exists(m_StdTemplate) Then Return
+ Dim SwingTemplate As String = String.Empty
+ IniFile.StdTemplateGetPrivateProfileString("Hardware", "Swing", "RH", SwingTemplate)
+ Map.refHardwarePageVM.GenericPart.SetSwing(SwingTemplate)
+ If bIsFrame Then
+ IniFile.StdTemplateGetPrivateProfileString("Hardware", "SwingFrame", "RH", SwingTemplate)
+ Map.refHardwarePageVM.GenericPart.SetSwing(SwingTemplate)
+ End If
+ End Sub
+
+ Private Sub FindSideJamb()
+ If Map.refHardwarePageVM.GenericPart.CompoList.Count < 1 Then Return
+ If String.IsNullOrEmpty(HardwareGeneral.JambSide) Then
+ For Each Item In Map.refHardwarePageVM.GenericPart.CompoList(0).CompoParamList
+ If TypeOf Item Is ComboBoxParam AndAlso
+ Item.DDFName = "side" Then
+ Dim CBoxPar As ComboBoxParam = DirectCast(Item, ComboBoxParam)
+ HardwareGeneral.SetJambSide(CBoxPar.SelItem)
+ Exit For
+ End If
+ Next
+ End If
+ If HardwareGeneral.JambSide.ToLower.Contains("hinge") Then
+ Map.refHardwarePageVM.GenericPart.TypePart = PART_FRAME_LEFT & HINGE
+ Map.refHardwarePageVM.GenericPart.SetWidth(OptionModule.m_WidthJamb)
+ Map.refHardwarePageVM.GenericPart.SetHeight(OptionModule.m_Height)
+ Return
+ ElseIf HardwareGeneral.JambSide.ToLower.Contains("lock") Then
+ Map.refHardwarePageVM.GenericPart.TypePart = PART_FRAME_LEFT & LOCK
+ Map.refHardwarePageVM.GenericPart.SetWidth(OptionModule.m_WidthJamb)
+ Map.refHardwarePageVM.GenericPart.SetHeight(OptionModule.m_Height)
+ Return
+ ElseIf HardwareGeneral.JambSide.ToLower.Contains("top") Then
+ Map.refHardwarePageVM.GenericPart.TypePart = PART_FRAME_TOP & TOP
+ Map.refHardwarePageVM.GenericPart.SetWidth(OptionModule.m_Width)
+ Map.refHardwarePageVM.GenericPart.SetHeight(OptionModule.m_ThicknessHead)
+ Return
+ ElseIf HardwareGeneral.JambSide.ToLower.Contains("bottom") Then
+ Map.refHardwarePageVM.GenericPart.TypePart = PART_FRAME_BOTTOM & BOTTOM
+ Map.refHardwarePageVM.GenericPart.SetWidth(OptionModule.m_Width)
+ Map.refHardwarePageVM.GenericPart.SetHeight(OptionModule.m_ThicknessHead)
+ Return
+ End If
+
+ End Sub
+
' carico la lista dei tipi --> devo stampare gli errori
Private Function LoadType() As Boolean
' costruisco la Path del template da leggere
@@ -354,10 +536,10 @@ Public Class Hardware
Exit For
End If
Next
- Dim Swing As String = String.Empty
- If StdTemplateGetPrivateProfileGroupChapter(S_HARDWARE, "Swing", Swing) Then
- Map.refHardwarePageVM.Door.SetSwing(Swing)
- End If
+ 'Dim Swing As String = String.Empty
+ 'If StdTemplateGetPrivateProfileGroupChapter(S_HARDWARE, "Swing", Swing) Then
+ ' Map.refHardwarePageVM.Door.SetSwing(Swing)
+ 'End If
Dim S_CHAPTER As String = S_GR_PARAM_HARDWARE & IndexChapter & "." ' il nome del capitolo da leggere "ParametersN."
While EgtUILib.GetPrivateProfileString(S_CHAPTER & ChapterIndex, K_PARAM & ParamIndex, "", sParam, m_StdTemplate) > 0 ' Verifico che esista il capitolo nuovo "Type-ChapterIndex"
Dim Chapter As New Compo(m_HardwareGeneral)
@@ -407,6 +589,11 @@ Public Class Hardware
ParamIndex = 1
ChapterIndex += 1
End While ' termina lettura della configurazione
+ Dim LocalCompoMatch As Compo = CreateChapterMatching()
+ If Not IsNothing(LocalCompoMatch) Then
+ LocalCompoMatch.SetIsFixed(True)
+ GroupChapters.Add(LocalCompoMatch)
+ End If
End Sub
' carico la liste dei nomi dei capitoli
@@ -435,6 +622,7 @@ Public Class Hardware
' inizio la lettura del file lua selezionato
Dim FileContent() As String
Dim CurrItemPath As String = CurrPath()
+ Dim MatchingFile As String = String.Empty
Dim Version As String = "2" ' 2 è la versione nuova, 1 la versione vecchia
Dim IsActiveVersion As Integer = 0
@@ -515,6 +703,11 @@ Public Class Hardware
For IndexName As Integer = 0 To m_GroupChapterName.Count - 1
CascadedChapter(m_GroupChapters, m_GroupChapterName(IndexName))
Next
+
+ ' ricerco il nome dell'associazione
+ MatchingFile = ReadMatchingFile(FileContent)
+ LoadMatchingFile(MatchingFile)
+
Return True
End Function
@@ -612,7 +805,9 @@ Public Class Hardware
Text.SetIsChecked(Utility.ConvertCheckBox(sValue))
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is ComboBoxParamLua Then
Dim Text As ComboBoxParamLua = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), ComboBoxParamLua)
- Text.SetSelItem(Text.ItemList(0))
+ Text.ItemListDDF = RefreshListGeometry(Text.ItemListDDF)
+ Text.ItemList = RefreshListGeometry(Text.ItemList)
+ If Text.ItemList.Count > 0 Then Text.SetSelItem(Text.ItemList(0))
For IndexCombo As Integer = 0 To Text.ItemListDDF.Count - 1
If Trim(Utility.DeleteSuperScript(Text.ItemListDDF(IndexCombo))) = Trim(Utility.DeleteSuperScript(sValue)) Then Text.SetSelItem(Text.ItemList(IndexCombo))
Next
@@ -633,6 +828,24 @@ Public Class Hardware
Return False
End Function
+ Private Function RefreshListGeometry(ByRef GeometryList As ObservableCollection(Of String)) As ObservableCollection(Of String)
+ Dim CurrListGeomtry As New ObservableCollection(Of String)
+ If bIsFrame Then
+ For Each ItemGeomtry In GeometryList
+ If ItemGeomtry.ToLower.Contains("frame") Then
+ CurrListGeomtry.Add(ItemGeomtry)
+ End If
+ Next
+ Return CurrListGeomtry
+ End If
+ For Each ItemGeomtry In GeometryList
+ If Not ItemGeomtry.ToLower.Contains("frame") Then
+ CurrListGeomtry.Add(ItemGeomtry)
+ End If
+ Next
+ Return CurrListGeomtry
+ End Function
+
' so già che il file contiene un foro al posto di una mortise
Private Function FindParamTemplateInConfigListOldVersionLock(sParam As String, sValue As String, MakeHole As Boolean) As Boolean
If MakeHole Then
@@ -665,6 +878,123 @@ Public Class Hardware
Return FindParamTemplateInConfigList(sParam, sValue)
End Function
+ ' ricerco nel file .lua dell'hardware se esiste un'associazione
+ Private Function ReadMatchingFile(sFile() As String) As String
+ Dim LineIndex As Integer = 0
+ Dim ParamIndex As Integer = 1
+ Dim FrameFile As String = String.Empty
+ For LineIndex = 0 To sFile.Count - 1
+ If RegexFunction.IsMatchingParameterTitle(sFile(LineIndex)) Then
+ FrameFile = Trim(RegexFunction.ParamLine(sFile(LineIndex + ParamIndex), K_MATCHING_FILE))
+ While String.IsNullOrEmpty(FrameFile) And LineIndex + ParamIndex < sFile(LineIndex + ParamIndex).Count
+ ParamIndex += 1
+ FrameFile = Trim(RegexFunction.ParamLine(sFile(LineIndex + ParamIndex), K_MATCHING_FILE))
+ Exit For
+ End While
+ End If
+ Next
+ Return FrameFile
+ End Function
+
+ ' aggiorna la grafica (dato il nome del file) --> devo stampare gli errori
+ Private Function LoadMatchingFile(MatchingFile As String) As Boolean
+ For Each ItemChapter In m_GroupChapters
+ If ItemChapter.TemplateDDFName = "Match File" Then
+ Dim ComboBoxMatch As ComboBoxParam = DirectCast(ItemChapter.CompoParamList(0), ComboBoxParam)
+
+ Dim sItem() As String = MatchingFile.Split("\"c)
+ ' Hinge\StdMort.Frame\1_5s
+ If sItem.Count > 2 Then
+ For IndexCompoType As Integer = 0 To Map.refCompoPanelVM.CompoTypeList.Count - 1
+ If Path.GetFileName(Map.refCompoPanelVM.CompoTypeList(IndexCompoType).Path) = sItem(0) Then
+ ' ricerco la radice del direttorio
+ For IndexParam As Integer = 0 To ComboBoxMatch.ItemListDDF.Count - 1
+ If ComboBoxMatch.ItemListDDF(IndexParam) = Map.refCompoPanelVM.CompoTypeList(IndexCompoType).DDFName Then
+ ComboBoxMatch.SetSelItem(ComboBoxMatch.ItemList(IndexParam))
+ Exit For
+ End If
+ Next
+ ' se il caricamento è fallito (non son stati caricati anche gli altri campi) allora esco
+ If ItemChapter.CompoParamList.Count < 2 Then
+ MatchingFile = String.Empty
+ Exit For
+ End If
+ ' ricerco il brand
+ Dim ComboBoxBrand As ComboBoxParam = DirectCast(ItemChapter.CompoParamList(1), ComboBoxParam)
+ For IndexBrand As Integer = 0 To ComboBoxBrand.ItemListDDF.Count - 1
+ If ComboBoxBrand.ItemListDDF(IndexBrand) = sItem(1) Then
+ ComboBoxBrand.SetSelItem(ComboBoxBrand.ItemListDDF(IndexBrand))
+ Exit For
+ End If
+ Next
+ ' se non è stato trovato il brand corretto allora esco
+ If IsNothing(ComboBoxBrand.SelItem) Then
+ MatchingFile = String.Empty
+ Exit For
+ End If
+ ' ricerco il file
+ Dim ComboBoxFile As ComboBoxParam = DirectCast(ItemChapter.CompoParamList(2), ComboBoxParam)
+ For IndexFile As Integer = 0 To ComboBoxFile.ItemListDDF.Count - 1
+ If ComboBoxFile.ItemListDDF(IndexFile) = sItem(2) Then
+ ComboBoxFile.SetSelItem(ComboBoxFile.ItemListDDF(IndexFile))
+ Exit For
+ End If
+ Next
+ If IsNothing(ComboBoxFile.SelItem) Then
+ MatchingFile = String.Empty
+ Exit For
+ End If
+ ' termino le associazioni
+ Exit For
+ End If
+ Next
+ ElseIf MatchingFile <> "None" Then
+ ' se non è corretta l'estensione allora svuoto il nome associato
+ MatchingFile = String.Empty
+ Else
+ For IndexParam As Integer = 0 To ComboBoxMatch.ItemListDDF.Count - 1
+ If ComboBoxMatch.ItemListDDF(IndexParam) = "None" Then
+ ComboBoxMatch.SetSelItem(ComboBoxMatch.ItemListDDF(IndexParam))
+ Exit For
+ End If
+ Next
+ End If
+
+ ' se l'associazione è andata a buon fine allora esco, altimenti continuo
+ If Not IsNothing(ComboBoxMatch.SelItem) Then Exit For
+
+ ' "Automatic"
+ If String.IsNullOrEmpty(MatchingFile) Then
+ ' cerco di associare con "Automatic"
+ For IndexParam As Integer = 0 To ComboBoxMatch.ItemListDDF.Count - 1
+ If ComboBoxMatch.ItemListDDF(IndexParam) = "Automatic" Then
+ ComboBoxMatch.SetSelItem(ComboBoxMatch.ItemListDDF(IndexParam))
+ Exit For
+ End If
+ Next
+ ' se fallisce associo "None"
+ If IsNothing(ComboBoxMatch.SelItem) Then
+ For IndexParam As Integer = 0 To ComboBoxMatch.ItemListDDF.Count - 1
+ If ComboBoxMatch.ItemListDDF(IndexParam) = "None" Then
+ ComboBoxMatch.SetSelItem(ComboBoxMatch.ItemList(IndexParam))
+ Exit For
+ End If
+ Next
+ End If
+ ElseIf Trim(MatchingFile) = "None" Then
+ For IndexParam As Integer = 0 To ComboBoxMatch.ItemListDDF.Count - 1
+ If ComboBoxMatch.ItemListDDF(IndexParam) = "None" Then
+ ComboBoxMatch.SetSelItem(ComboBoxMatch.ItemList(IndexParam))
+ Exit For
+ End If
+ Next
+ End If
+ End If
+ Next
+
+ Return True
+ End Function
+
#End Region ' Caricamneto
#Region "Salvataggio, Duplica, Nuovo, Aggiorna"
@@ -912,7 +1242,7 @@ Public Class Hardware
Public Function RefreshTempHardware() As Boolean
Dim ErrorMsg As String = String.Empty
' Pulisco da componenti precedenti
- Map.refHardwarePageVM.Door.CompoList.Clear()
+ Map.refHardwarePageVM.GenericPart.CompoList.Clear()
If String.IsNullOrWhiteSpace(Map.refHardwarePageVM.CurrHardware.SelTemplate) Then Return False
Dim NewFileContent As New ObservableCollection(Of String)
If Not WriteFile(NewFileContent) Then Return False
@@ -922,8 +1252,12 @@ Public Class Hardware
Dim sTempFileHardw As String = m_HardwareGeneral.Path & "\" & ModelDir & TEMP_FILE_HARDWARE
' salvo il file
File.WriteAllLines(sTempFileHardw, NewFileContent)
+ LoadSwingFromTemplate()
' aggiungo la componente
- Map.refHardwarePageVM.Door.AddNewHardware(m_HardwareGeneral, ModelDir & Path.GetFileNameWithoutExtension(TEMP_FILE_HARDWARE))
+ Map.refHardwarePageVM.GenericPart.AddNewHardware(m_HardwareGeneral, ModelDir & Path.GetFileNameWithoutExtension(TEMP_FILE_HARDWARE))
+ If bIsFrame Then
+ FindSideJamb()
+ End If
Return True
End Function
@@ -986,6 +1320,34 @@ Public Class Hardware
Dim bIsActive As Boolean = True
Dim NameParam = Utility.FindNameParam(sValue)
If String.IsNullOrEmpty(NameParam) Then Return False
+
+ If NameParam = K_MATCHING_FILE Then
+ For IndexGroupChapters As Integer = 0 To m_GroupChapters.Count - 1
+ If m_GroupChapters(IndexGroupChapters).TemplateName = MATCHING_FILE_TEMPLATE Then
+ sValue = String.Empty
+ If DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(0), ComboBoxParam).SelItem = MATCHING_FILE_AUTOMATIC Then
+ sValue = String.Empty
+ Return True
+ ElseIf DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(0), ComboBoxParam).SelItem = MATCHING_FILE_NONE Then
+ sValue = MATCHING_FILE_NONE
+ Return True
+ End If
+ For Each Item In Map.refCompoPanelVM.CompoTypeList
+ If Item.Name = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(0), ComboBoxParam).SelItem Then
+ sValue &= Path.GetFileName(Item.Path)
+ Exit For
+ End If
+ Next
+ If m_GroupChapters(IndexGroupChapters).CompoParamList.Count > 2 Then
+ sValue &= "\" & DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(1), ComboBoxParam).SelItem
+ sValue &= "\" & DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(2), ComboBoxParam).SelItem
+ Return True
+ End If
+ End If
+ Next
+ Return False
+ End If
+
For IndexGroupChapters As Integer = 0 To m_GroupChapters.Count - 1
For IndexChapter As Integer = 0 To m_GroupChapters(IndexGroupChapters).CompoParamList.Count - 1
If m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter).DDFName = NameParam Then
diff --git a/HardwareManager/HardwarePageV.xaml b/HardwareManager/HardwarePageV.xaml
index 4182e06..73b530d 100644
--- a/HardwareManager/HardwarePageV.xaml
+++ b/HardwareManager/HardwarePageV.xaml
@@ -48,6 +48,7 @@
Style="{StaticResource DoorParamsCmBx}"
IsEnabled="{Binding IsRaedOnly}"/>