cedcf1dd4f
- aggiunta di nuovo parametro ( ActiveBox); - possibilità di selezionare l'ultimo ddf letto ( in modalità singola porta); - elimino l'errore dopo la modifica dei parametri; - porto il focus sul ddf selezionato ( in modalità progetto).
1848 lines
87 KiB
VB.net
1848 lines
87 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.Collections.ObjectModel
|
|
Imports System.IO
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class Hardware
|
|
Implements INotifyPropertyChanged
|
|
|
|
Friend Shared DoRefresh As Boolean = True
|
|
Friend Shared FirstSelection As Boolean = True
|
|
Dim ReLoading As Boolean = False
|
|
Dim bTypeListExist As Boolean = False
|
|
Dim m_GroupChapterName As New ObservableCollection(Of String)
|
|
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
|
|
|
|
Dim sLastTemplate As String = String.Empty
|
|
Dim m_LastDirectory As CompoBrandDir
|
|
|
|
' Path StdTemplate.ini
|
|
Private m_StdTemplate As String = String.Empty ' il percorso viene aggiornato ad ogni scelta dell'hardware in LoadType()
|
|
Public ReadOnly Property StdTemplate As String
|
|
Get
|
|
Return m_StdTemplate
|
|
End Get
|
|
End Property
|
|
|
|
' i parametetri sono suddivisi in sottocapitolli (gruppi di parametri)
|
|
Private m_GroupChapters As New ObservableCollection(Of Compo)
|
|
Public Property GroupChapters As ObservableCollection(Of Compo)
|
|
Get
|
|
Return m_GroupChapters
|
|
End Get
|
|
Set(value As ObservableCollection(Of Compo))
|
|
m_GroupChapters = value
|
|
End Set
|
|
End Property
|
|
|
|
#Region "BRAND"
|
|
|
|
Public ReadOnly Property BrandList As ObservableCollection(Of CompoBrandDir)
|
|
Get
|
|
If Not IsNothing(m_HardwareGeneral) Then
|
|
Return m_HardwareGeneral.HardwareFolderList
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_SelBrand As CompoBrandDir
|
|
Public Property SelBrand As CompoBrandDir
|
|
Get
|
|
Return m_SelBrand
|
|
End Get
|
|
Set(value As CompoBrandDir)
|
|
If Not IsNothing(m_SelBrand) Then
|
|
' sto carciando la cartella per la prima volta
|
|
m_LastDirectory = New CompoBrandDir(m_SelBrand, m_HardwareGeneral.Path)
|
|
End If
|
|
|
|
If SaveControl() = SaveResult.nCancel Then
|
|
RefreshTemplateListEgtDOORCreator()
|
|
Return
|
|
End If
|
|
|
|
If IsNothing(value) Then
|
|
m_SelBrand = m_LastDirectory
|
|
Else
|
|
m_SelBrand = value
|
|
End If
|
|
|
|
' se decido di procedere allora elimino il file temporaneo
|
|
DeleteTempFile()
|
|
' verifico che la selezione abbia senso, altrimenti mantengo la selezione precedente
|
|
If Not IsNothing(value) Then
|
|
m_SelBrand = value
|
|
ElseIf Not IsNothing(value) AndAlso Not Directory.Exists(value.ModelDir) Then
|
|
ErrorReading = value.ModelDir & ": " & "Directory does not exist!"
|
|
RefreshTemplateListEgtDOORCreator()
|
|
Else
|
|
Return
|
|
End If
|
|
|
|
' se l'oggetto Brand esiste
|
|
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 (la lista dei file lua)
|
|
TemplateList = m_SelBrand.ModelFileList
|
|
' verifico che la lista contenga almeno un file
|
|
If m_SelBrand.ModelFileList.Count > 0 Then
|
|
' verifico se esisteva un file selzionato, e che quetso esista ancora
|
|
If Not String.IsNullOrWhiteSpace(SelTemplate) AndAlso File.Exists(m_SelBrand.ModelDir & "\" & SelTemplate & LUA_EXTENSION) Then
|
|
' ricarico l'elemento dalla lista
|
|
For Each ItemFile In m_SelBrand.ModelFileList
|
|
If ItemFile = m_SelTemplate Then
|
|
SelTemplate = ItemFile
|
|
Exit For
|
|
End If
|
|
Next
|
|
ElseIf File.Exists(m_SelBrand.ModelDir & "\" & m_SelBrand.ModelFileList(0) & LUA_EXTENSION) Then
|
|
' se non esiste nessuna selezione carico il primo file della lista
|
|
SelTemplate = m_SelBrand.ModelFileList(0)
|
|
Else
|
|
' se i controlli precedenti falliscono allora restituisco stringa vuota
|
|
SelTemplate = String.Empty
|
|
End If
|
|
Else
|
|
SelTemplate = String.Empty
|
|
End If
|
|
Else
|
|
SelTemplate = String.Empty
|
|
End If
|
|
' termine della selezione
|
|
NotifyPropertyChanged("SelBrand")
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Brand
|
|
|
|
#Region "TEMPLATE"
|
|
|
|
Private m_HardwareGeneral As CompoType
|
|
Public Property HardwareGeneral As CompoType
|
|
Get
|
|
Return m_HardwareGeneral
|
|
End Get
|
|
Set(value As CompoType)
|
|
m_HardwareGeneral = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_TemplateList As New ObservableCollection(Of String)
|
|
Public Property TemplateList As ObservableCollection(Of String)
|
|
Get
|
|
Return m_TemplateList
|
|
End Get
|
|
Set(value As ObservableCollection(Of String))
|
|
m_TemplateList = value
|
|
NotifyPropertyChanged("TemplateList")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelTemplate As String
|
|
' questa proprietà non è usata nel momento in cui generiamo un nuovo Hardware
|
|
Public Property SelTemplate As String
|
|
Get
|
|
Return m_SelTemplate
|
|
End Get
|
|
Set(value As String)
|
|
' salvo l'ultimo valore registrato
|
|
sLastTemplate = m_SelTemplate
|
|
If m_SelTemplate = value Then Return
|
|
m_SelTemplate = value
|
|
If SaveControl() = SaveResult.nCancel Then
|
|
Application.Current.Dispatcher.BeginInvoke(New Action(Sub()
|
|
m_SelTemplate = sLastTemplate
|
|
NotifyPropertyChanged("SelTemplate")
|
|
End Sub), System.Windows.Threading.DispatcherPriority.ContextIdle, Nothing)
|
|
NotifyPropertyChanged("TemplateList")
|
|
Return
|
|
End If
|
|
sLastTemplate = m_SelTemplate
|
|
' pulisco la lista dei capitoli per il nuovo Hardware
|
|
ClearGroupChapters()
|
|
' controllo che la selezione abbia restituito un nome
|
|
If Not String.IsNullOrWhiteSpace(m_SelTemplate) Then
|
|
If bTypeListExist Then
|
|
' se restituisce dei problemi in fase di caricamento del file allora eseguo un reload delle liste
|
|
If Not SetTypeFromTemplate(m_SelTemplate) Then
|
|
m_SelTemplate = String.Empty
|
|
ShowErrorMsg()
|
|
RefreshTemplateListEgtDOORCreator()
|
|
Return
|
|
End If
|
|
NotifyPropertyChanged("VisibilityType")
|
|
End If
|
|
FirstSelection = True ' Comunico grafica di eseguire lo zoom
|
|
ReadChapterTemplate() ' Rileggo i parametri del SetdTemplate
|
|
ReadTemplate(m_SelTemplate) ' Carico i dati del template
|
|
' Map.refSceneManagerVM.RefreshBtn()
|
|
End If
|
|
NotifyPropertyChanged("SelTemplate")
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
' NotifyPropertyChanged("TemplateList")
|
|
ShowErrorMsg()
|
|
End Set
|
|
End Property
|
|
|
|
Private m_VisibilityTemplate As Visibility = Visibility.Visible
|
|
Public Property VisibilityTemplate As Visibility
|
|
Get
|
|
Return m_VisibilityTemplate
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_VisibilityTemplate = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Name-Template
|
|
|
|
#Region "TYPELIST"
|
|
|
|
Private m_TypeList As New List(Of TypeHardware)
|
|
Public Property TypeList As List(Of TypeHardware)
|
|
Get
|
|
Return m_TypeList
|
|
End Get
|
|
Set(value As List(Of TypeHardware))
|
|
m_TypeList = value
|
|
NotifyPropertyChanged("TypeList")
|
|
End Set
|
|
End Property
|
|
|
|
' se non dovessere esistere un tipo, al momento del salvataggio cerca il file con nome Template ed estensione .Templ
|
|
Private m_SelType As TypeHardware = New TypeHardware(TYPE_STD_TEMPLATE, TYPE_STD_TEMPLATE_INI)
|
|
Public Property SelType As TypeHardware
|
|
Get
|
|
Return m_SelType
|
|
End Get
|
|
Set(value As TypeHardware)
|
|
' verifico se tipo è cambiato -- OrElse value.Name <> m_SelType.Name
|
|
Dim bChanged As Boolean = If(Not IsNothing(m_SelType), value.NameINI <> m_SelType.NameINI, True)
|
|
m_SelType = value
|
|
' se cambiato carico il suo progetto con quotature/suggerimenti
|
|
If bChanged Then Map.refHardwareHelpSceneHostV.LoadHelpProject()
|
|
NotifyPropertyChanged("SelType")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_VisibilityType As Visibility = Visibility.Collapsed
|
|
Public Property VisibilityType As Visibility
|
|
Get
|
|
Return m_VisibilityType
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_VisibilityType = value
|
|
NotifyPropertyChanged("VisibilityType")
|
|
End Set
|
|
End Property
|
|
|
|
' se non viene modificata il tipo non può essere modificato
|
|
Private m_IsEnableType As Boolean = False
|
|
Public Property IsEnableType As Boolean
|
|
Get
|
|
If Not VisibilityType = Visibility.Visible Then Return False
|
|
Return m_IsEnableType
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_IsEnableType = value
|
|
NotifyPropertyChanged("IsEnableType")
|
|
End Set
|
|
End Property
|
|
|
|
#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"
|
|
|
|
Public Function ShowErrorMsg() As Boolean
|
|
If Not String.IsNullOrEmpty(ErrorReading) Then
|
|
MessageBox.Show(ErrorReading, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
ErrorReading = String.Empty
|
|
Return True
|
|
End Function
|
|
|
|
' elimina il file temporaneo CurrHardware.lua
|
|
Public Function DeleteTempFile() As Boolean
|
|
Dim CurrHardwareFile As String = String.Empty
|
|
Dim ModelDir As String = String.Empty
|
|
If IsNothing(m_SelBrand) Then Return False
|
|
If m_SelBrand.ModelDir <> RegexFunction.ModelTemplate(m_HardwareGeneral.Path) Then ModelDir = m_SelBrand.ModelDirGraphic & "\"
|
|
CurrHardwareFile = m_HardwareGeneral.Path & "\" & ModelDir & ConstGen.TEMP_FILE_HARDWARE
|
|
Try
|
|
File.Delete(CurrHardwareFile)
|
|
Catch ex As Exception
|
|
End Try
|
|
Return True
|
|
End Function
|
|
|
|
' Carica il nome della Componente, La lista dei template, La lista dei tipi
|
|
Public Sub LoadTemplate(ByRef CurrCompoType As CompoType)
|
|
' eseguo un aggiornamento della lista
|
|
CurrCompoType.LoadListTemplate()
|
|
' carico il general dell'hardware
|
|
m_HardwareGeneral = CurrCompoType
|
|
NotifyPropertyChanged("BrandList")
|
|
bTypeListExist = LoadType() ' carico la lista dei Type
|
|
If Not bTypeListExist Then
|
|
'SelBrand = Nothing
|
|
SelBrand = BrandList(0)
|
|
ElseIf BrandList.Count > 0 Then
|
|
SelBrand = BrandList(0)
|
|
Else
|
|
EgtNewFile()
|
|
End If
|
|
Dim ErrorList As String = String.Empty
|
|
If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME) = 0 Then
|
|
VisibilityTemplate = Visibility.Collapsed
|
|
NotifyPropertyChanged("VisibilityTemplate")
|
|
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
|
|
m_StdTemplate = m_HardwareGeneral.Path & "\" & STD_TEMPLATE
|
|
If Not File.Exists(m_StdTemplate) Then Return False
|
|
Dim List As New List(Of String) ' lista temporanea "1/Mort"
|
|
If IniFile.StdTemplateGetPrivateProfileList(S_HARDWARE, K_TYPE, List) Then
|
|
m_VisibilityType = Visibility.Visible ' rendo visibile la lista
|
|
' leggo nomi
|
|
Dim ArrayNameSplit(1) As String
|
|
For IndexListType As Integer = 0 To List.Count - 1
|
|
ArrayNameSplit = List(IndexListType).Split("/"c)
|
|
If IsNumeric(ArrayNameSplit(0)) Then
|
|
m_TypeList.Add(New TypeHardware(ArrayNameSplit(1), ArrayNameSplit(0)))
|
|
Else
|
|
' In file StdTempate.ini is missing numeric param in [Type]
|
|
ErrorReading = EgtMsg(50171) & vbCrLf
|
|
m_TypeList.Add(New TypeHardware(EgtMsg(50101), "0"))
|
|
Return False ' interrompo la lettura
|
|
End If
|
|
Next
|
|
' se esiste una lista di nomi di tipi carico di default il primo che trovo
|
|
If m_TypeList.Count > 0 Then SelType = m_TypeList(0)
|
|
'NotifyPropertyChanged("TypeListName")
|
|
Else
|
|
m_TypeList.Add(New TypeHardware(TYPE_STD_TEMPLATE, TYPE_STD_TEMPLATE_INI))
|
|
m_VisibilityType = Visibility.Collapsed
|
|
Return False ' se la lista è vuota restituisco falso
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
' setta il valore del template --> devo stampare gli errori
|
|
Private Function SetTypeFromTemplate(value As String) As Boolean
|
|
' carico di Default il valore 1
|
|
For IndexListType As Integer = 0 To TypeList.Count - 1
|
|
If TypeList(IndexListType).NameINI = "1" Then
|
|
SelType = TypeList(IndexListType)
|
|
VisibilityType = Visibility.Visible
|
|
NotifyPropertyChanged("SelType")
|
|
Exit For
|
|
End If
|
|
Next
|
|
' inizio la lettura del file lua selezionato
|
|
Dim CurrItemPath As String = CurrPath()
|
|
Dim ErrorMsg As String = String.Empty
|
|
' se il file ha estensione nge
|
|
If Path.HasExtension(CurrItemPath) AndAlso Path.GetExtension(CurrItemPath).ToLower = NGE_EXTENSION Then
|
|
' File does not exist
|
|
If Not File.Exists(CurrItemPath) Then ErrorReading = EgtMsg(50172) & vbCrLf : Return False ' controllo che esiste il file altrimenti esco
|
|
Dim ConfigDefault As String = String.Empty ' configurazione del template
|
|
EgtUILib.GetPrivateProfileString(S_NGECONFIG, K_DEFAULT, "", ConfigDefault, m_HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME)
|
|
For IndexTypeList As Integer = 0 To TypeList.Count - 1
|
|
' Definition type is not correct:
|
|
If TypeList(IndexTypeList).NameINI = ConfigDefault Then Exit For Else ErrorReading = EgtMsg(50173) & ConfigDefault & vbCrLf : Return False
|
|
Next
|
|
Else
|
|
' se il file ha estensione allora aggiungo l'estensione .lua
|
|
If Path.GetExtension(CurrItemPath).ToLower <> LUA_EXTENSION Then
|
|
CurrItemPath &= LUA_EXTENSION
|
|
End If
|
|
' controllo che esiste il file altrimenti esco
|
|
' File does not exist
|
|
If Not File.Exists(CurrItemPath) Then ErrorReading = CurrItemPath & ": " & EgtMsg(50172) & vbCrLf : Return False
|
|
' m_TemplateSelItem = value
|
|
' carico un vettore con le stringhe del file corrente
|
|
Dim ReadCurrCompo() As String = File.ReadAllLines(CurrItemPath)
|
|
Dim EndOfFile As Boolean = False
|
|
' leggo il vettore di stringhe del file corrente
|
|
For LineIndex = 0 To ReadCurrCompo.Count - 1
|
|
' copio il valore della riga
|
|
Dim CurrCompoFileLine As String = ReadCurrCompo(LineIndex)
|
|
' cerco il titolo [Graphic parameters]: se lo trovo
|
|
If RegexFunction.IsGraphicParametersTitle(CurrCompoFileLine) Then
|
|
' mi preparo per leggere la prima riga dopo il titolo
|
|
Dim ParamIndex As Integer = 1
|
|
If Not String.IsNullOrWhiteSpace(ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_DEFAULT)) Then
|
|
Dim ConfigDefault As String = Trim(ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_DEFAULT))
|
|
If Not IsNumeric(ConfigDefault) Then
|
|
' 50162 =In file {0} param 'Default' must be numeric.
|
|
ErrorReading = String.Format(EgtMsg(50162), CurrItemPath)
|
|
ErrorReading &= vbCrLf
|
|
Return False ' valore letto non è numerico
|
|
Else
|
|
For IndexListType As Integer = 0 To TypeList.Count - 1
|
|
If TypeList(IndexListType).NameINI = ConfigDefault Then
|
|
SelType = TypeList(IndexListType)
|
|
NotifyPropertyChanged("SelType")
|
|
Exit For
|
|
End If
|
|
Next
|
|
Exit For
|
|
End If
|
|
End If
|
|
End If
|
|
Next
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
' ricerca il nome dei capitoli associati e chiama la lettura dei parametri
|
|
Public Sub ReadChapterTemplate()
|
|
Dim sParam As String = String.Empty ' la stringa che contiene tutte le informazioni della componente
|
|
Dim ParamIndex As Integer = 1
|
|
Dim ChapterIndex As Integer = 1 ' numero del capitolo
|
|
Dim IndexChapter As String = "1"
|
|
For IndexTypeList As Integer = 0 To m_TypeList.Count - 1
|
|
If m_TypeList(IndexTypeList) Is SelType Then
|
|
IndexChapter = m_TypeList(IndexTypeList).NameINI
|
|
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 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)
|
|
Dim Name As String = String.Empty
|
|
Dim LuaName As String = String.Empty
|
|
|
|
' legge il nome del parametro
|
|
If StdTemplateGetPrivateProfileChapterName(S_CHAPTER & ChapterIndex, K_NAME, LuaName, Name) Then
|
|
Chapter.TemplateDDFName = LuaName
|
|
Chapter.TemplateName = Name
|
|
End If
|
|
' leggo il nome dei capitoli dei parametri
|
|
Dim GroupName As String = String.Empty
|
|
If StdTemplateGetPrivateProfileGroupChapter(S_CHAPTER & ChapterIndex, "GroupChapter", GroupName) Then
|
|
Chapter.GroupNameChapter = GroupName
|
|
SetGroupChaptername(Trim(GroupName))
|
|
End If
|
|
Dim bIsActive As Boolean = True
|
|
' legge se è attivo
|
|
Dim nIsActive As Integer = StdTemplateGetPrivateProfileInt(S_CHAPTER & ChapterIndex, K_ISACTIVE, nIsActive)
|
|
' verifico che non stia leggendo un nuovo hardware
|
|
If Not bNewHardware And nIsActive <> 2 Then
|
|
nIsActive = 0
|
|
End If
|
|
Select Case nIsActive
|
|
Case 0
|
|
Chapter.SetIsFixed(False)
|
|
Chapter.SetIsActiveChapter(False)
|
|
Case 1
|
|
Chapter.SetIsFixed(False)
|
|
Chapter.SetIsActiveChapter(True)
|
|
Case 2
|
|
Chapter.SetIsFixed(True)
|
|
Chapter.SetIsActiveChapter(True)
|
|
End Select
|
|
|
|
While EgtUILib.GetPrivateProfileString(S_CHAPTER & ChapterIndex, K_PARAM & ParamIndex, "", sParam, m_StdTemplate) > 0 ' Verifico che esista il parametro nuovo "Param-ParamIndex"
|
|
If Not String.IsNullOrWhiteSpace(sParam) Then
|
|
Dim NewParam As New CompoParam(m_HardwareGeneral.DDFName, m_HardwareGeneral.Name, Chapter)
|
|
Dim sHelpParam As String = String.Empty
|
|
EgtUILib.GetPrivateProfileString(S_CHAPTER & ChapterIndex, "HelpParam" & ParamIndex, "", sHelpParam, m_StdTemplate)
|
|
' leggo il tipo di parametro, se la lettura va a buon fine la carico
|
|
If Chapter.ReadParamHardware(sParam, sHelpParam, NewParam, ErrorReading) Then Chapter.CompoParamList.Add(NewParam)
|
|
End If
|
|
ParamIndex += 1
|
|
End While ' termina lettura del capitolo
|
|
GroupChapters.Add(Chapter)
|
|
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
|
|
Private Function SetGroupChaptername(sName As String) As Boolean
|
|
If m_GroupChapterName.Count = 0 Then m_GroupChapterName.Add(sName)
|
|
Dim bFounded As Boolean = False
|
|
For Index1 As Integer = 0 To m_GroupChapterName.Count - 1
|
|
If m_GroupChapterName(Index1) = sName Then
|
|
bFounded = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
If Not bFounded Then m_GroupChapterName.Add(sName)
|
|
Return True
|
|
End Function
|
|
|
|
' elimina le liste di parametri precedenti ad ogni selezione
|
|
Public Sub ClearGroupChapters()
|
|
If Not IsNothing(GroupChapters) Then
|
|
GroupChapters.Clear()
|
|
End If
|
|
NotifyPropertyChanged("GroupChapters")
|
|
End Sub
|
|
|
|
' legge il file lua
|
|
Friend Function ReadTemplate(sFile As String) As Boolean
|
|
' 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
|
|
Dim MakeHole As Boolean = False
|
|
If StdTemplateGetPrivateProfileChapterVersioning("Versioning", "IsActive", IsActiveVersion) Then
|
|
Version = "1"
|
|
End If
|
|
|
|
If Not Path.HasExtension(CurrItemPath) Then
|
|
CurrItemPath &= LUA_EXTENSION
|
|
ElseIf Path.GetExtension(CurrItemPath).ToLower <> LUA_EXTENSION Then
|
|
CurrItemPath &= LUA_EXTENSION
|
|
End If
|
|
Dim ErrorMsg As String = String.Empty
|
|
' se il file ha estensione o se ha estensione nge: esco
|
|
If Path.GetExtension(CurrItemPath).ToLower = NGE_EXTENSION Then
|
|
ErrorMsg = "File has nge extension."
|
|
Return False
|
|
End If
|
|
' file does not exists
|
|
If Not File.Exists(CurrItemPath) Then ErrorMsg = EgtMsg(50172) : Return False ' controllo che esiste il file altrimenti esco
|
|
FileContent = File.ReadAllLines(CurrItemPath)
|
|
' se il file esiste ma è vuoto
|
|
If FileContent.Count = 0 Then
|
|
MessageBox.Show(EgtMsg(50107), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
|
|
' cerco la versione caricata
|
|
If IsActiveVersion = 1 Then
|
|
For Each Line In FileContent
|
|
Dim CurrLine As String = Utility.DeleteLuaComment(Line)
|
|
Dim sLine() As String = CurrLine.Split("="c)
|
|
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
|
|
If sLine(0).Contains(".VER") Then
|
|
If Not IsNothing(sLine(1)) AndAlso IsNumeric(sLine(1).Replace("'", "")) Then
|
|
Version = Trim(sLine(1).Replace("'", ""))
|
|
End If
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
Select Case Version
|
|
Case "2"
|
|
For IndexLine As Integer = 0 To FileContent.Count - 1
|
|
Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
|
|
Dim sLine() As String = CurrLine.Split("="c)
|
|
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
|
|
FindParamTemplateInConfigList(Trim(sLine(0)), Trim(sLine(1)))
|
|
Next
|
|
' nuova versione
|
|
Case "1"
|
|
' se è una lock
|
|
If m_HardwareGeneral.DDFName = "locks" Then
|
|
' cerco il Parametro mh per l'attivazione del foro
|
|
For Each Line In FileContent
|
|
Dim CurrLine As String = Utility.DeleteLuaComment(Line)
|
|
Dim sLine() As String = CurrLine.Split("="c)
|
|
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
|
|
If Trim(sLine(0)) = "tLkmPar.mh" Then
|
|
If Not IsNothing(sLine(1)) AndAlso Trim(sLine(1)) = "true" Then
|
|
MakeHole = True
|
|
End If
|
|
Exit For
|
|
End If
|
|
Next
|
|
For IndexLine As Integer = 0 To FileContent.Count - 1
|
|
Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
|
|
Dim sLine() As String = CurrLine.Split("="c)
|
|
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
|
|
FindParamTemplateInConfigListOldVersionLock(Trim(sLine(0)), Trim(sLine(1)), MakeHole)
|
|
Next
|
|
Return True
|
|
End If
|
|
For IndexLine As Integer = 0 To FileContent.Count - 1
|
|
Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
|
|
Dim sLine() As String = CurrLine.Split("="c)
|
|
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
|
|
FindParamTemplateInConfigList(Trim(sLine(0)), Trim(sLine(1)))
|
|
Next
|
|
End Select
|
|
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)
|
|
ReadDefaultParamDDF(FileContent)
|
|
Return True
|
|
End Function
|
|
|
|
Private Function CascadedChapter(CompoList As ObservableCollection(Of Compo), sGroupName As String) As Boolean
|
|
' salvo l'indice del primo parametro visibile
|
|
Dim bLastVisible As Boolean = False
|
|
For Index As Integer = 0 To CompoList.Count - 1
|
|
If CompoList(Index).GroupNameChapter <> sGroupName Then Continue For
|
|
If CompoList(Index).IsActiveChapter Then
|
|
CompoList(Index).GroupVisibilityChapter = Visibility.Visible
|
|
ElseIf Not CompoList(Index).IsActiveChapter And Not bLastVisible Then
|
|
CompoList(Index).GroupVisibilityChapter = Visibility.Visible
|
|
bLastVisible = True
|
|
Else
|
|
CompoList(Index).GroupVisibilityChapter = Visibility.Collapsed
|
|
End If
|
|
Next
|
|
Return True
|
|
End Function
|
|
|
|
' caricamento dei dati del file lua
|
|
Private Function FindParamTemplateInConfigList(sParam As String, sValue As String) As Boolean
|
|
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 = sParam Then
|
|
' ho trovato una corrispondenza tra il valore de file ini e quello lua in lettura
|
|
' allora significa che tutto il capitolo associato deve essere attivo
|
|
Dim AcitvateParamNotExists As Boolean = True
|
|
For Each ItemParam In m_GroupChapters(IndexGroupChapters).CompoParamList
|
|
If TypeOf ItemParam Is ActivateParam Then
|
|
AcitvateParamNotExists = False
|
|
Exit For
|
|
End If
|
|
Next
|
|
If AcitvateParamNotExists Then m_GroupChapters(IndexGroupChapters).SetIsActiveChapter(True)
|
|
' m_GroupChapters(IndexGroupChapters).SetIsActiveChapter(True)
|
|
If TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxDGCParam Then
|
|
Dim Text As TextBoxDGCParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxDGCParam)
|
|
' se testo numerico, eseguo opportunbe conversioni per H,W e T
|
|
sValue = ConvertToDGD(Text.TypeVar, sValue)
|
|
' separare il valore tra parentesi dai termini fuoir parentesi
|
|
Dim sItems() As String = sValue.Split("+"c)
|
|
If sItems.Count > 2 Then
|
|
For IndexArray As Integer = 1 To sItems.Count - 2
|
|
sItems(0) &= "+" & sItems(IndexArray)
|
|
Next
|
|
sItems(1) = sItems(sItems.Count - 1)
|
|
End If
|
|
Dim sLen As String = Trim(Utility.GetMeasure(sItems(0)))
|
|
Dim dVal As Double = 0.0
|
|
Text.SetValue(sLen)
|
|
Text.SetConst(Text.ConstList(0))
|
|
If sItems.Count >= 2 Then
|
|
For IndexConst As Integer = 0 To Text.ConstList.Count - 1
|
|
If Text.ConstList(IndexConst) = Trim(sItems(1)) Then Text.SetConst(Text.ConstList(IndexConst)) : Exit For
|
|
Next
|
|
End If
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxThicknessParam Then
|
|
Dim Text As TextBoxThicknessParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxThicknessParam)
|
|
' se testo numerico, eseguo opportunbe conversioni per H,W e T
|
|
sValue = ConvertToDGD(Text.TypeVar, sValue)
|
|
Dim dVal As Double
|
|
Text.SetConst(Text.ConstList(2))
|
|
Text.SetValue("")
|
|
If StringToDouble(sValue, dVal) AndAlso dVal < 0.0 Then
|
|
For IndexItem As Integer = 0 To Text.ConstList.Count - 1
|
|
If Text.ConstList(IndexItem).dValue = dVal Then
|
|
Text.SetConst(Text.ConstList(IndexItem))
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
If Text.SelConst.Name = OptionModule.m_SelectedMeasureUnit Then
|
|
Dim sLen As String = Trim(Utility.GetMeasure(sValue))
|
|
Text.SetValue(sLen)
|
|
End If
|
|
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxNgeParam Then
|
|
Dim Text As TextBoxNgeParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxNgeParam)
|
|
Text.SetValue(Trim(Utility.DeleteSuperScript(sValue)))
|
|
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxParam Then
|
|
Dim Text As TextBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxParam)
|
|
' se testo numerico, eseguo opportunbe conversioni per H,W e T
|
|
sValue = ConvertToDGD(Text.TypeVar, sValue)
|
|
' controllo il tipo di dato che si aspetta
|
|
Select Case Text.TypeVar
|
|
Case ConstGen.INCHES
|
|
Dim sLen As String = Trim(Utility.GetMeasure(sValue))
|
|
Text.SetValue(sLen)
|
|
Case ConstGen.MM
|
|
Dim sLen As String = Trim(Utility.GetMeasure(sValue))
|
|
Text.SetValue(sLen)
|
|
Case ConstGen.VAL_DOUBLE
|
|
Dim dVal As Double = 0.0
|
|
If StringToDouble(sValue, dVal) Then Text.SetValue(sValue) Else Text.SetValue("0.000")
|
|
Case ConstGen.VAL_STRING
|
|
Text.SetValue(Trim(Utility.DeleteSuperScript(sValue)))
|
|
End Select
|
|
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is CheckBoxParam Then
|
|
Dim Text As CheckBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), CheckBoxParam)
|
|
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.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
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is ComboBoxParam Then
|
|
Dim Text As ComboBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), ComboBoxParam)
|
|
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
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is GhostParam Then
|
|
Dim Text As GhostParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), GhostParam)
|
|
Text.Value = sValue
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is ActivateParam Then
|
|
Dim Text As ActivateParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), ActivateParam)
|
|
Text.SetIsActivated(Utility.ConvertCheckBox(sValue))
|
|
m_GroupChapters(IndexGroupChapters).SetIsActiveChapter(Text.IsActivated)
|
|
End If
|
|
Return True
|
|
End If
|
|
Next
|
|
Next
|
|
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
|
|
Select Case sParam
|
|
Case "tLkmPar.L2"
|
|
sParam = ""
|
|
Case "tLkmPar.H2"
|
|
sParam = "tLkmPar.HB2"
|
|
Case "tLkmPar.T2"
|
|
sParam = "tLkmPar.TB2"
|
|
Case "tLkmPar.D_X"
|
|
sParam = "tLkmPar.DH_X"
|
|
Case "tLkmPar.LG2"
|
|
sParam = ""
|
|
Case "tLkmPar.LA"
|
|
sParam = ""
|
|
Case "tLkmPar.s"
|
|
sParam = ""
|
|
Case "tLkmPar.p2"
|
|
sParam = ""
|
|
Case "tLkmPar.d2"
|
|
sParam = ""
|
|
End Select
|
|
Else
|
|
Select Case sParam
|
|
Case "tLkmPar.LGH"
|
|
sParam = ""
|
|
End Select
|
|
End If
|
|
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
|
|
|
|
' legge e carica i parametri da settare nel ddf
|
|
Private Function ReadDefaultParamDDF(sFile() As String) As Boolean
|
|
Dim LineIndex As Integer = 0
|
|
Dim ParamIndex As Integer = 1
|
|
Dim KeyParam As String = String.Empty
|
|
Dim ValueParam As String = String.Empty
|
|
' inizio a leggere tutto il file lua
|
|
For LineIndex = 0 To sFile.Count - 1
|
|
' verifico che eista il titolo [DDF parameters]
|
|
If RegexFunction.IsDDFParameterTitle(sFile(LineIndex)) Then
|
|
For Each Item In GroupChapters
|
|
If Item.TemplateDDFName = "DDF" Then
|
|
' carico il nome di ogni parametro scritto nella configurazione
|
|
For Each ItemParam In Item.CompoParamList
|
|
' recupero il nome del parametro ddf scritto nel file lua
|
|
KeyParam = Trim(RegexFunction.KeyParamLine(sFile(LineIndex + ParamIndex)))
|
|
While String.IsNullOrEmpty(KeyParam) AndAlso KeyParam = ItemParam.DDFName And LineIndex + ParamIndex < sFile(LineIndex + ParamIndex).Count
|
|
ParamIndex += 1
|
|
KeyParam = Trim(RegexFunction.KeyParamLine(sFile(LineIndex + ParamIndex)))
|
|
End While
|
|
If String.IsNullOrEmpty(KeyParam) Then Continue For
|
|
ValueParam = RegexFunction.ParamLine(sFile(LineIndex + ParamIndex), KeyParam)
|
|
If String.IsNullOrEmpty(ValueParam) Then Continue For
|
|
FindParamTemplateInConfigList(KeyParam, ValueParam)
|
|
' passo alla riga successiva
|
|
LineIndex = LineIndex + ParamIndex
|
|
ParamIndex = 1
|
|
Next
|
|
End If
|
|
Next
|
|
End If
|
|
Next
|
|
Return True
|
|
End Function
|
|
|
|
' aggiorna la grafica (dato il nome del file) --> devo stampare gli errori
|
|
Private Function LoadMatchingFile(MatchingFile As String) As Boolean
|
|
If String.IsNullOrEmpty(MatchingFile) Then Return False
|
|
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, altrimenti 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"
|
|
|
|
Public Function Duplicate(sSelBrand As String, sTemplate As String) As Boolean
|
|
DoRefresh = False
|
|
If IsNothing(sTemplate) Then
|
|
' Missing name of the new template!
|
|
MessageBox.Show(EgtMsg(50174), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
|
Return False
|
|
End If
|
|
' ricostruico il percorso del file da dupicare
|
|
Dim OldDirPath As String = CurrPath()
|
|
' ricostruisco il nuovo file da creare
|
|
Dim ModelDir As String = String.Empty
|
|
If sSelBrand <> RegexFunction.ModelTemplate(m_HardwareGeneral.Path) Then ModelDir = sSelBrand & "\"
|
|
Dim CurrDirPath As String = m_HardwareGeneral.Path & "\" & ModelDir & sTemplate & LUA_EXTENSION
|
|
|
|
Dim IndexModel As Integer
|
|
Dim TemSelBrand As String = String.Empty
|
|
' carico la lista dei file presenti nel direttorio selezionato
|
|
Dim Temp_TemplateList As New ObservableCollection(Of String)
|
|
For IndexModel = 0 To m_HardwareGeneral.HardwareFolderList.Count - 1
|
|
If m_HardwareGeneral.HardwareFolderList(IndexModel).ModelDirGraphic = sSelBrand Then
|
|
TemSelBrand = m_HardwareGeneral.HardwareFolderList(IndexModel).ModelDirGraphic
|
|
Temp_TemplateList = m_HardwareGeneral.HardwareFolderList(IndexModel).ModelFileList
|
|
Exit For
|
|
End If
|
|
Next
|
|
' controllo se il nome è già presente nel direttorio selezionato
|
|
Dim bNameExist As Boolean = False
|
|
Dim IndexHardwList As Integer
|
|
For IndexHardwList = 0 To Temp_TemplateList.Count - 1
|
|
If Temp_TemplateList(IndexHardwList) = sTemplate Then
|
|
' se il nome è nella lista allora esco dal ciclo e rendo falsa la variabile bNameExist
|
|
bNameExist = True
|
|
Exit For
|
|
End If
|
|
bNameExist = False
|
|
Next
|
|
' se il nome esite già nel direttorio selezionato
|
|
If bNameExist Then
|
|
' The file: {0} already exist in directory {1} . Do you want to overwrite it
|
|
Select Case MessageBox.Show(String.Format(EgtMsg(50175), sTemplate, sSelBrand), "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
|
|
' decido di sovrescrivere il file esistente
|
|
Case MessageBoxResult.Yes
|
|
' non eseguo nulla perchè il file è sempre se stesso!
|
|
Return True
|
|
Case Else
|
|
' deicido di non sovrescrivere interrompo
|
|
Return False
|
|
End Select
|
|
End If
|
|
' elimino ilnome dalla lista dei file (alla fine il nome verrà aggiunto ancora)
|
|
For IndexTempList As Integer = 0 To Temp_TemplateList.Count - 1
|
|
If Temp_TemplateList(IndexTempList) = sTemplate Then
|
|
Temp_TemplateList.RemoveAt(IndexTempList)
|
|
Exit For
|
|
End If
|
|
Next
|
|
' carico le variabili temporanee e aggiorno la grafica (lista dei file e Brand selezionato)
|
|
m_SelBrand = m_HardwareGeneral.HardwareFolderList(IndexModel)
|
|
TemplateList = Temp_TemplateList
|
|
NotifyPropertyChanged("TemplateList")
|
|
NotifyPropertyChanged("SelBrand")
|
|
' copio il file
|
|
Try
|
|
File.Copy(OldDirPath, CurrDirPath, True)
|
|
m_SelTemplate = sTemplate
|
|
Catch ex As System.IO.IOException
|
|
MessageBox.Show("Error in copying: " & ex.Message)
|
|
' interrompo la copia e la creazione
|
|
Return False
|
|
End Try
|
|
' aggiungo il nome alla lista
|
|
RefreshTemplateListEgtDOORCreator()
|
|
'TemplateList.Add(sTemplate)
|
|
For IndexTempList As Integer = 0 To m_TemplateList.Count - 1
|
|
' aggiorno la grafica con il valore selzionato tra i template
|
|
If m_TemplateList(IndexTempList) = sTemplate Then SelTemplate = m_TemplateList(IndexTempList)
|
|
Next
|
|
SetLayerName(sTemplate)
|
|
DoRefresh = True
|
|
Return True
|
|
End Function
|
|
|
|
Public Function NewHardware(sSelBrand As String, sTemplate As String, sType As TypeHardware) As Boolean
|
|
DoRefresh = False
|
|
' ricostruico il percorso del file nuovo
|
|
Dim ModelDir As String = String.Empty
|
|
ModelDir = String.Empty
|
|
If sSelBrand <> RegexFunction.ModelTemplate(m_HardwareGeneral.Path) Then ModelDir = sSelBrand & "\"
|
|
Dim CurrDirPath As String = m_HardwareGeneral.Path & "\" & ModelDir & sTemplate & LUA_EXTENSION
|
|
Dim IndexModel As Integer
|
|
Dim TemSelBrand As String = String.Empty
|
|
' carico la lista dei file presenti nel direttorio selezionato
|
|
Dim Temp_TemplateList As New ObservableCollection(Of String)
|
|
For IndexModel = 0 To m_HardwareGeneral.HardwareFolderList.Count - 1
|
|
If m_HardwareGeneral.HardwareFolderList(IndexModel).ModelDirGraphic = sSelBrand Then
|
|
TemSelBrand = m_HardwareGeneral.HardwareFolderList(IndexModel).ModelDirGraphic
|
|
Temp_TemplateList = m_HardwareGeneral.HardwareFolderList(IndexModel).ModelFileList
|
|
Exit For
|
|
End If
|
|
Next
|
|
' controllo se il nome è già presente nel direttorio selezionato
|
|
Dim bNameExist As Boolean = False
|
|
Dim IndexHardwList As Integer
|
|
For IndexHardwList = 0 To Temp_TemplateList.Count - 1
|
|
If Temp_TemplateList(IndexHardwList) = sTemplate Then
|
|
' se il nome è nella lista allora esco dal ciclo e rendo falsa la variabile bNameExist
|
|
bNameExist = True
|
|
Exit For
|
|
End If
|
|
bNameExist = False
|
|
Next
|
|
' se il nome esite già nel direttorio selezionato
|
|
If bNameExist Then
|
|
' The file: {0} already exist in directory {1} . Do you want to overwrite it
|
|
Select Case MessageBox.Show(String.Format(EgtMsg(50175), sTemplate, sSelBrand), "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
|
|
' decido di sovrescrivere il file esistente
|
|
Case MessageBoxResult.Yes
|
|
If File.Exists(CurrDirPath) Then
|
|
Try
|
|
' elimino il file
|
|
File.Delete(CurrDirPath)
|
|
Catch ex As FileNotFoundException
|
|
' non è un problema
|
|
Catch ex As Exception
|
|
' non è un problema
|
|
End Try
|
|
End If
|
|
Case Else
|
|
' deicido di non sovrescrivere interrompo
|
|
Return False
|
|
End Select
|
|
End If
|
|
' elimino il nome dalla lista dei file (alla fine il nome verrà aggiunto ancora)
|
|
For IndexTempList As Integer = 0 To Temp_TemplateList.Count - 1
|
|
If Temp_TemplateList(IndexTempList) = sTemplate Then
|
|
Temp_TemplateList.RemoveAt(IndexTempList)
|
|
Exit For
|
|
End If
|
|
Next
|
|
' carico le variabili temporanee e aggiorno la grafica (lista dei file e Brand selezionato)
|
|
bNewHardware = True
|
|
SelBrand = m_HardwareGeneral.HardwareFolderList(IndexModel)
|
|
TemplateList = Temp_TemplateList
|
|
SelType = sType
|
|
NotifyPropertyChanged("TemplateList")
|
|
NotifyPropertyChanged("SelBrand")
|
|
' ripulisco la lista da eventuali residui di altri Hardware
|
|
ClearGroupChapters()
|
|
' rileggo le component dell'hardware da StdTemplate
|
|
ReadChapterTemplate()
|
|
' salvo il nome del file corrente nel Layer
|
|
SetLayerName(sTemplate)
|
|
bNewHardware = False
|
|
Dim ErrorMsg As String = String.Empty
|
|
Dim NewFileContent As New ObservableCollection(Of String)
|
|
If Not WriteFile(NewFileContent) Then Return False
|
|
|
|
' scrivo tutto sul file corrente
|
|
Try
|
|
File.WriteAllLines(CurrDirPath, NewFileContent)
|
|
Catch ex As System.IO.IOException
|
|
' Error in copying:
|
|
MessageBox.Show(String.Format(EgtMsg(50176), ex.Message))
|
|
Return False
|
|
End Try
|
|
|
|
Map.refProjectManagerHardwareVM.IsModified = False
|
|
RefreshTemplateListEgtDOORCreator()
|
|
'TemplateList.Add(sTemplate)
|
|
For IndexTempList As Integer = 0 To m_TemplateList.Count - 1
|
|
' aggiorno la grafica con il valore selzionato tra i template
|
|
If m_TemplateList(IndexTempList) = sTemplate Then SelTemplate = m_TemplateList(IndexTempList)
|
|
Next
|
|
DoRefresh = True
|
|
Return True
|
|
End Function
|
|
|
|
' nel caso di creazione di nuovo Hardware questa funzione attribuisce il nome del file al parametro Nome (quello usato dal layer)
|
|
Private Function SetLayerName(sTemplateName As String) As Boolean
|
|
For Each Compo In m_GroupChapters
|
|
For Each Param In Compo.CompoParamList
|
|
If Param.DDFName.Contains(".Nome") And TypeOf Param Is TextBoxParam Then
|
|
Dim Text As TextBoxParam = DirectCast(Param, TextBoxParam)
|
|
Text.Value = Trim(sTemplateName)
|
|
Return True
|
|
End If
|
|
Next
|
|
Next
|
|
Return False
|
|
End Function
|
|
|
|
' per caricare a video il nome del file nge caricato dalla tabella
|
|
Public Function SetGeometryName(sGeometryName As String) As Boolean
|
|
For Each Compo In m_GroupChapters
|
|
For Each Param In Compo.CompoParamList
|
|
If Param.DDFName.Contains(".CGF") And TypeOf Param Is TextBoxNgeParam Then
|
|
Dim Text As TextBoxNgeParam = DirectCast(Param, TextBoxNgeParam)
|
|
Text.SetValue(Trim(sGeometryName))
|
|
Return True
|
|
End If
|
|
Next
|
|
Next
|
|
Return False
|
|
End Function
|
|
|
|
Public Function DuplicateGeometryName(OldTemplateName As String) As Boolean
|
|
Dim OldGeometryName As String = String.Empty
|
|
For Each Compo In m_GroupChapters
|
|
For Each Param In Compo.CompoParamList
|
|
If Param.DDFName.Contains(".CGF") And TypeOf Param Is TextBoxNgeParam Then
|
|
Dim Text As TextBoxNgeParam = DirectCast(Param, TextBoxNgeParam)
|
|
If Not String.IsNullOrEmpty(Text.Value) Then
|
|
' inserire un avviso di cpia del file nge
|
|
OldGeometryName = Path.GetDirectoryName(OldTemplateName) & "\" & Text.Value
|
|
Dim NewGeometryName As String = CopyGeometryName(OldTemplateName, OldGeometryName)
|
|
Try
|
|
File.Copy(OldGeometryName, NewGeometryName, True)
|
|
Catch ex As System.IO.IOException
|
|
' Error in copying:
|
|
MessageBox.Show(String.Format(EgtMsg(50176), ex.Message))
|
|
' interrompo la copia e la creazione
|
|
Return False
|
|
End Try
|
|
Text.SetValue(Path.GetFileName(NewGeometryName))
|
|
Return RefreshTempHardware()
|
|
Else
|
|
Text.SetValue("")
|
|
Return RefreshTempHardware()
|
|
End If
|
|
End If
|
|
|
|
Next
|
|
Next
|
|
Return False
|
|
End Function
|
|
|
|
Private Function CopyGeometryName(OldTemplateName As String, OldGeometryName As String) As String
|
|
Dim CurrDir As String = Path.GetDirectoryName(Me.CurrPath)
|
|
Dim OldFileName As String = Path.GetFileName(OldGeometryName)
|
|
If OldFileName.Contains(Path.GetFileNameWithoutExtension(OldTemplateName)) Then
|
|
Return CurrDir & "\" & OldFileName.Replace(Path.GetFileNameWithoutExtension(OldTemplateName), Me.m_SelTemplate)
|
|
Else
|
|
Return CurrDir & "\" & Me.m_SelTemplate & "_" & OldFileName
|
|
End If
|
|
Return String.Empty
|
|
End Function
|
|
|
|
' crea il file temporaneao e scrive i valori dei parametri della componente per aggiornare la parte grafica
|
|
Public Function RefreshTempHardware() As Boolean
|
|
Dim ErrorMsg As String = String.Empty
|
|
' Pulisco da componenti precedenti
|
|
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
|
|
' costruisco il nome del percorso del file corrente
|
|
Dim ModelDir As String = String.Empty
|
|
'If m_SelBrand.ModelDir <> RegexFunction.ModelTemplate(m_HardwareGeneral.Path) Then ModelDir = m_SelBrand.ModelDirGraphic & "\"
|
|
If m_SelBrand.ModelDir <> m_HardwareGeneral.Path Then ModelDir = m_SelBrand.ModelDirGraphic & "\"
|
|
Dim sTempFileHardw As String = m_HardwareGeneral.Path & "\" & ModelDir & TEMP_FILE_HARDWARE
|
|
' salvo il file
|
|
File.WriteAllLines(sTempFileHardw, NewFileContent)
|
|
LoadSwingFromTemplate()
|
|
' aggiungo la componente
|
|
Map.refHardwarePageVM.GenericPart.AddNewHardware(m_HardwareGeneral, ModelDir & Path.GetFileNameWithoutExtension(TEMP_FILE_HARDWARE))
|
|
If bIsFrame Then
|
|
FindSideJamb()
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
Public Function Save() As Boolean
|
|
Dim ErrorMsg As String = String.Empty
|
|
' costruisco la Path del template da leggere
|
|
Dim TemplFile = m_HardwareGeneral.Path & "\" & m_SelType.Name & ".templ "
|
|
If Not File.Exists(TemplFile) Then Return False
|
|
Dim FileContent() As String = File.ReadAllLines(TemplFile)
|
|
Dim NewFileContent As New ObservableCollection(Of String)
|
|
If Not WriteFile(NewFileContent) Then Return False
|
|
' costruisco il nome del percorso del file corrente
|
|
Dim CurrConfig As String = m_HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME
|
|
Dim CurrItemPath As String = CurrPath()
|
|
' salvo il file
|
|
File.WriteAllLines(CurrItemPath, NewFileContent)
|
|
'RefreshTemplateListEgtDOORCreator()
|
|
Map.refProjectManagerHardwareVM.IsModified = False
|
|
Map.refSceneManagerVM.RefreshBtn()
|
|
Return True
|
|
End Function
|
|
|
|
Private Function WriteFile(ByRef NewFileContent As ObservableCollection(Of String)) As Boolean
|
|
For IndexName As Integer = 0 To m_GroupChapterName.Count - 1
|
|
CascadedChapter(m_GroupChapters, m_GroupChapterName(IndexName))
|
|
Next
|
|
Dim TemplFile = m_HardwareGeneral.Path & "\" & m_SelType.Name & ".templ "
|
|
If Not File.Exists(TemplFile) Then Return False
|
|
Dim FileContent() As String = File.ReadAllLines(TemplFile)
|
|
' inizio la lettura riga per riga
|
|
For IndexLine As Integer = 0 To FileContent.Count - 1
|
|
NewFileContent.Add(FileContent(IndexLine))
|
|
WriteLuaCommentParamDDF(FileContent, IndexLine, NewFileContent)
|
|
Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
|
|
Dim sLine() As String = CurrLine.Split("="c)
|
|
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For ' significa che non è un parametro
|
|
Dim sValue As String = Trim(sLine(1))
|
|
Dim sTemplValue As String = Trim(sLine(1))
|
|
If Not ConvertValueForLua(sValue) Then Continue For
|
|
FileContent(IndexLine) = FileContent(IndexLine).Replace(sTemplValue, sValue)
|
|
NewFileContent.RemoveAt(NewFileContent.Count - 1)
|
|
If Not sValue = " nil" Then
|
|
NewFileContent.Add(FileContent(IndexLine))
|
|
End If
|
|
Next
|
|
If IsNothing(NewFileContent) Then Return False
|
|
Return True
|
|
End Function
|
|
|
|
Private Function WriteLuaCommentParamDDF(sFile() As String, ByRef LineIndex As Integer, ByRef NewFileContent As ObservableCollection(Of String)) As Boolean
|
|
Dim ParamIndex As Integer = 0
|
|
Dim KeyParam As String = String.Empty
|
|
Dim sValue As String = String.Empty
|
|
' verifico che esiste il titolo da stempare
|
|
If RegexFunction.IsDDFParameterTitle(sFile(LineIndex)) Then
|
|
ParamIndex = 1
|
|
' conto il numero di parametri ddf
|
|
Dim IndexParamDDF As Integer = 0
|
|
For Each ItemChapetr In GroupChapters
|
|
If ItemChapetr.TemplateDDFName = "DDF" Then
|
|
IndexParamDDF = ItemChapetr.CompoParamList.Count
|
|
Exit For
|
|
End If
|
|
Next
|
|
' cerco un numero finito di parametri
|
|
For IndexParam As Integer = 0 To IndexParamDDF - 1
|
|
If LineIndex + ParamIndex > sFile.Count - 1 Then Return False
|
|
' recuro il nome del parametro
|
|
KeyParam = Trim(RegexFunction.KeyParamLine(sFile(LineIndex + ParamIndex)))
|
|
While String.IsNullOrEmpty(KeyParam) And LineIndex + ParamIndex < sFile(LineIndex + ParamIndex).Count
|
|
ParamIndex += 1
|
|
KeyParam = Trim(RegexFunction.KeyParamLine(sFile(LineIndex + ParamIndex)))
|
|
End While
|
|
If String.IsNullOrEmpty(KeyParam) Then Continue For
|
|
sValue = RegexFunction.ParamLine(sFile(LineIndex + ParamIndex), KeyParam)
|
|
Dim ReplaceValue = sValue
|
|
ConvertValueForLua(sValue)
|
|
sFile(LineIndex + ParamIndex) = sFile(LineIndex + ParamIndex).Replace(ReplaceValue, sValue)
|
|
If Not sValue = " nil" Then
|
|
NewFileContent.Add(sFile(LineIndex + ParamIndex))
|
|
End If
|
|
LineIndex = LineIndex + ParamIndex
|
|
Next
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
Public Function RefreshTemplateListEgtDOORCreator() As Boolean
|
|
ReLoading = True
|
|
For IndexHardw As Integer = 0 To Map.refCompoPanelVM.CompoTypeList.Count - 1
|
|
If m_HardwareGeneral.DDFName = Map.refCompoPanelVM.CompoTypeList(IndexHardw).DDFName Then
|
|
Map.refCompoPanelVM.CompoTypeList(IndexHardw).LoadListTemplate()
|
|
If Map.refCompoPanelVM.CompoTypeList(IndexHardw).FrameFolderList.Count <> m_HardwareGeneral.FrameFolderList.Count Then
|
|
m_HardwareGeneral.FrameFolderList = Map.refCompoPanelVM.CompoTypeList(IndexHardw).FrameFolderList
|
|
End If
|
|
' devo ricaricare tutte le liste!
|
|
m_HardwareGeneral.HardwareFolderList = Map.refCompoPanelVM.CompoTypeList(IndexHardw).HardwareFolderList
|
|
NotifyPropertyChanged("BrandList")
|
|
For Each Item In BrandList
|
|
If m_LastDirectory.ModelDir = Item.ModelDir Then
|
|
SelBrand = Item
|
|
NotifyPropertyChanged("BrandList")
|
|
NotifyPropertyChanged("SelBrand")
|
|
Exit For
|
|
End If
|
|
Next
|
|
ReLoading = False
|
|
Return True
|
|
Exit For
|
|
End If
|
|
Next
|
|
ReLoading = False
|
|
Return False
|
|
End Function
|
|
|
|
' dato il nome del parametri sostiuisce il valore da stampare
|
|
Public Function ConvertValueForLua(ByRef sValue As String) As Boolean
|
|
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
|
|
' verifico che il parametro da stampare sia abilitato alla stampa (altriementi NON scrivere nel file)
|
|
If Not m_GroupChapters(IndexGroupChapters).IsActiveChapter Then sValue = " nil" : Return True
|
|
If TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxDGCParam Then
|
|
Dim Text As TextBoxDGCParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxDGCParam)
|
|
sValue = String.Empty
|
|
Select Case Text.TypeVar
|
|
Case ConstGen.INCHES
|
|
If OptionModule.m_SelectedMeasureUnit = ConstGen.VAL_INCHES Then
|
|
If Text.ToolTipValue.Contains("Invalid") Then
|
|
sValue = "0.0000"
|
|
Else
|
|
sValue = Text.TypeVar & "( " & Text.Value & ")"
|
|
End If
|
|
Else
|
|
sValue = Text.Value
|
|
If MmToInches(sValue) Then sValue = Text.TypeVar & "( " & sValue & ")"
|
|
End If
|
|
Case ConstGen.MM
|
|
If OptionModule.m_SelectedMeasureUnit = ConstGen.VAL_INCHES Then
|
|
sValue = Text.Value
|
|
InchesToMm(sValue)
|
|
Else
|
|
If Text.ToolTipValue.Contains("Invalid") Then
|
|
sValue = "0.0000"
|
|
Else
|
|
sValue = Text.Value
|
|
End If
|
|
End If
|
|
End Select
|
|
' se testo numerico, eseguo opportune conversioni per H,W e T
|
|
sValue = ConvertFromDGD(Text.TypeVar, sValue)
|
|
sValue &= " + " & Text.SelConst
|
|
Return True
|
|
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxThicknessParam Then
|
|
Dim Text As TextBoxThicknessParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxThicknessParam)
|
|
sValue = String.Empty
|
|
If Text.SelConst.dValue = 0 Then
|
|
Select Case Text.TypeVar
|
|
Case ConstGen.INCHES
|
|
If OptionModule.m_SelectedMeasureUnit = ConstGen.VAL_INCHES Then
|
|
If Text.ToolTipValue.Contains("Invalid") Then
|
|
sValue = "0.0000"
|
|
Else
|
|
sValue = Text.TypeVar & "( " & Text.Value & ")"
|
|
End If
|
|
Else
|
|
sValue = Text.Value
|
|
If MmToInches(sValue) Then sValue = Text.TypeVar & "( " & sValue & ")"
|
|
End If
|
|
Case ConstGen.MM
|
|
If OptionModule.m_SelectedMeasureUnit = ConstGen.VAL_INCHES Then
|
|
sValue = Text.Value
|
|
InchesToMm(sValue)
|
|
Else
|
|
If Text.ToolTipValue.Contains("Invalid") Then
|
|
sValue = "0.0000"
|
|
Else
|
|
sValue = Text.Value
|
|
End If
|
|
End If
|
|
End Select
|
|
' se testo numerico, eseguo opportune conversioni per H,W e T
|
|
sValue = ConvertFromDGD(Text.TypeVar, sValue)
|
|
Return True
|
|
End If
|
|
sValue = DoubleToString(Text.SelConst.dValue, 1)
|
|
Return True
|
|
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxNgeParam Then
|
|
Dim Text As TextBoxNgeParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxNgeParam)
|
|
sValue = String.Empty
|
|
sValue = "'" & Text.Value & "'"
|
|
Return True
|
|
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxParam Then
|
|
Dim Text As TextBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxParam)
|
|
sValue = String.Empty
|
|
' controllo il tipo di dato che si aspetta
|
|
Select Case Text.TypeVar
|
|
Case ConstGen.INCHES
|
|
If OptionModule.m_SelectedMeasureUnit = ConstGen.VAL_INCHES Then
|
|
If Text.ToolTipValue.Contains("Invalid") Then
|
|
sValue = "0.0000"
|
|
Else
|
|
sValue = Text.TypeVar & "( " & Text.Value & ")"
|
|
End If
|
|
'sValue = Text.TypeVar & "( " & Text.ToolTipValue & ")"
|
|
Else
|
|
sValue = Text.Value
|
|
If MmToInches(sValue) Then sValue = Text.TypeVar & "( " & sValue & ")"
|
|
End If
|
|
Case ConstGen.MM
|
|
If OptionModule.m_SelectedMeasureUnit = ConstGen.VAL_INCHES Then
|
|
sValue = Text.Value
|
|
InchesToMm(sValue)
|
|
Else
|
|
If Text.ToolTipValue.Contains("Invalid") Then
|
|
sValue = "0.0000"
|
|
Else
|
|
sValue = Text.Value
|
|
End If
|
|
'sValue = Text.ToolTipValue
|
|
End If
|
|
Case ConstGen.VAL_DOUBLE
|
|
sValue = Text.Value
|
|
Case ConstGen.VAL_STRING
|
|
sValue = "'" & Text.Value & "'"
|
|
End Select
|
|
' se testo numerico, eseguo opportune conversioni per H,W e T
|
|
sValue = ConvertFromDGD(Text.TypeVar, sValue)
|
|
Return True
|
|
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxNgeParam Then
|
|
Dim Text As TextBoxNgeParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxNgeParam)
|
|
sValue = "'" & Text.Value & "'"
|
|
Return True
|
|
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is CheckBoxParam Then
|
|
Dim Text As CheckBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), CheckBoxParam)
|
|
sValue = String.Empty
|
|
If Text.IsChecked Then sValue = " true" Else sValue = " false"
|
|
Return True
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is ActivateParam Then
|
|
Dim Text As ActivateParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), ActivateParam)
|
|
sValue = String.Empty
|
|
If Text.IsActivated Then sValue = " true" Else sValue = " false"
|
|
Return True
|
|
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is ComboBoxParamLua Then
|
|
Dim Text As ComboBoxParamLua = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), ComboBoxParamLua)
|
|
sValue = String.Empty
|
|
For Index As Integer = 0 To Text.ItemList.Count - 1
|
|
If Text.SelItem = Text.ItemList(Index) Then sValue = Text.ItemListDDF(Index) : Return True
|
|
Next
|
|
sValue = Text.SelItem
|
|
Return True
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is ComboBoxParam Then
|
|
'-- attenzione a quando abbiamo da stampare delle stringhe! e non dei valori numerici
|
|
Dim Text As ComboBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), ComboBoxParam)
|
|
sValue = String.Empty
|
|
For Index As Integer = 0 To Text.ItemList.Count - 1
|
|
If Text.SelItem = Text.ItemList(Index) Then sValue = Text.ItemListDDF(Index) : Return True
|
|
Next
|
|
sValue = Text.SelItem
|
|
Return True
|
|
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is GhostParam Then
|
|
Dim Text As GhostParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), GhostParam)
|
|
sValue = Text.Value
|
|
Return True
|
|
End If
|
|
End If
|
|
Next
|
|
Next
|
|
Return True
|
|
End Function
|
|
|
|
' lista delle riposte della funzione SaveControl
|
|
Enum SaveResult As Integer
|
|
nYes
|
|
nNo
|
|
nCancel
|
|
End Enum
|
|
|
|
' restituisce il messaggio della selezione
|
|
Public Function SaveControl() As SaveResult
|
|
If ReLoading Then Return SaveResult.nYes
|
|
|
|
If Not Map.refProjectManagerHardwareVM.IsModified Then Return SaveResult.nNo
|
|
' Do you want to save the current changes?
|
|
Select Case MessageBox.Show(EgtMsg(50177), "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
|
|
Case MessageBoxResult.Yes ' decido di salvare
|
|
Save()
|
|
Return SaveResult.nYes
|
|
Case MessageBoxResult.No ' decido di non salvare
|
|
Map.refProjectManagerHardwareVM.IsModified = False
|
|
Return SaveResult.nNo
|
|
Case Else ' altrimenti non salvo
|
|
Return SaveResult.nCancel
|
|
End Select
|
|
End Function
|
|
|
|
Public Function DeleteHardware() As Boolean
|
|
DoRefresh = False
|
|
DeleteGeometry()
|
|
Dim CurrDirPath As String = CurrPath()
|
|
BackupDeletingFile(CurrDirPath)
|
|
For Each ItemFile In m_TemplateList
|
|
If ItemFile = m_SelTemplate Then
|
|
Dim IndexList As Integer = m_TemplateList.IndexOf(m_SelTemplate)
|
|
m_TemplateList.Remove(m_SelTemplate)
|
|
If IndexList > 0 Then
|
|
SelTemplate = m_TemplateList(IndexList - 1)
|
|
ElseIf IndexList = 0 And m_TemplateList.Count > 0 Then
|
|
SelTemplate = m_TemplateList(IndexList)
|
|
Else
|
|
SelTemplate = Nothing
|
|
End If
|
|
Exit For
|
|
End If
|
|
Next
|
|
If File.Exists(CurrDirPath) Then
|
|
Try
|
|
File.Delete(CurrDirPath)
|
|
Catch ex As Exception
|
|
End Try
|
|
End If
|
|
DoRefresh = True
|
|
RefreshTemplateListEgtDOORCreator()
|
|
NotifyPropertyChanged("TemplateList")
|
|
Return True
|
|
End Function
|
|
|
|
Private Function DeleteGeometry() As Boolean
|
|
Dim sGeometryName As String
|
|
For Each Compo In m_GroupChapters
|
|
For Each Param In Compo.CompoParamList
|
|
If Param.DDFName.Contains(".CGF") And TypeOf Param Is TextBoxNgeParam Then
|
|
Dim Text As TextBoxNgeParam = DirectCast(Param, TextBoxNgeParam)
|
|
If Not String.IsNullOrWhiteSpace(Text.Value) Then
|
|
sGeometryName = Path.GetDirectoryName(Me.CurrPath) & "\" & Text.Value
|
|
BackupDeletingFile(sGeometryName)
|
|
If File.Exists(sGeometryName) Then
|
|
Try
|
|
File.Delete(sGeometryName)
|
|
Catch ex As Exception
|
|
End Try
|
|
End If
|
|
End If
|
|
Return True
|
|
End If
|
|
Next
|
|
Next
|
|
Return False
|
|
End Function
|
|
|
|
' salvo nella cartella di Backup
|
|
Public Function BackupDeletingFile(DeletingFileName As String) As Boolean
|
|
Dim sCurrTime As String = Date.UtcNow.ToString.Replace(" ", "_")
|
|
sCurrTime = sCurrTime.Replace("/", "-")
|
|
sCurrTime = sCurrTime.Replace(":", "-")
|
|
Dim BackupFileName As String = Path.GetFileNameWithoutExtension(DeletingFileName) & " " & sCurrTime
|
|
If Not Directory.Exists(BackupDir) Then
|
|
Directory.CreateDirectory(BackupDir)
|
|
End If
|
|
BackupFileName = BackupDir & "\" & BackupFileName & Path.GetExtension(DeletingFileName)
|
|
' copio il file
|
|
Try
|
|
File.Copy(DeletingFileName, BackupFileName, True)
|
|
Catch ex As System.IO.IOException
|
|
' Error in copying:
|
|
MessageBox.Show(String.Format(EgtMsg(50176), ex.Message))
|
|
' interrompo la copia e la creazione
|
|
Return False
|
|
End Try
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' Salvataggio, Duplica, Nuovo, Aggiorna
|
|
|
|
Public Function CurrPath() As String
|
|
Dim ModelDir As String = String.Empty
|
|
'If m_SelBrand.ModelDir <> RegexFunction.ModelTemplate(m_HardwareGeneral.Path) Then ModelDir = m_SelBrand.ModelDirGraphic & "\"
|
|
If m_SelBrand.ModelDirGraphic <> RAD_DIR Then ModelDir = m_SelBrand.ModelDirGraphic & "\"
|
|
Return m_HardwareGeneral.Path & "\" & ModelDir & sLastTemplate & LUA_EXTENSION
|
|
End Function
|
|
|
|
Public Sub New()
|
|
' ogni nuovo hardware che creao devo avere la lista di componenti vuota
|
|
Me.ClearGroupChapters()
|
|
End Sub
|
|
|
|
#End Region ' Genaral 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
|
|
|
|
Public Class TypeHardware
|
|
Inherits VMBase
|
|
|
|
Private m_Name As String
|
|
Public Property Name As String
|
|
Get
|
|
Return m_Name
|
|
End Get
|
|
Set(value As String)
|
|
m_Name = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_NameINI As String
|
|
Public Property NameINI As String
|
|
Get
|
|
Return m_NameINI
|
|
End Get
|
|
Set(value As String)
|
|
m_NameINI = value
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(Name As String, NameINI As String)
|
|
m_Name = Name
|
|
m_NameINI = NameINI
|
|
NotifyPropertyChanged("Name")
|
|
NotifyPropertyChanged("NameINI")
|
|
End Sub
|
|
|
|
End Class
|