Files
Dario Sassi 0f8a2634bd EgtDoorCreator 3.1a1 :
- modifiche per convertire meta espressioni in file lua in espressioni di interfaccia utente.
2026-01-26 09:16:18 +01:00

3276 lines
140 KiB
VB.net

Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Module Modified
Sub SetModified()
If Not Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
If Not IsNothing(Map.refPartPageVM) AndAlso Not IsNothing(Map.refPartPageVM.CurrPart) Then
For Each Compo In Map.refPartPageVM.CurrPart.CompoList
Compo.ResetMark()
Next
End If
Else
Map.refProjectManagerHardwareVM.IsModified = True
End If
End Sub
End Module
Public Class Compo
Implements INotifyPropertyChanged
Friend TempFileDDF As String = IniFile.m_sTempDir & "\" & TEMP_FILE
' permette di bloccare il refresh della componente singola (solo se nell'Hardwaremanagaer)
Friend Shared DoRefreshCompo As Boolean = True
Friend LoadDefaultFromLua As Boolean = True
' creo la stringa che contiene la lista degli errori
Dim ErrorList As String = String.Empty
Private m_ConfigurationParameters As String
Public ReadOnly Property ConfigurationParameters As String
Get
Return m_ConfigurationParameters
End Get
End Property
Private m_CompoType As CompoType
Public ReadOnly Property CompoType As CompoType
Get
Return m_CompoType
End Get
End Property
#Region "Colori GroupBox"
' Colore della linea che circonda l'elenco dei parametri
Private m_BorderColor As SolidColorBrush = DirectCast(New BrushConverter().ConvertFrom("#DCDCDC"), SolidColorBrush)
Public Property BorderColor As SolidColorBrush
Get
Return m_BorderColor
End Get
Set(value As SolidColorBrush)
m_BorderColor = value
NotifyPropertyChanged("BorderColor")
End Set
End Property
' Colore di sfondo nell'intestazione
Private m_BackGroundColor As SolidColorBrush = DirectCast(New BrushConverter().ConvertFrom("#FFFFFF"), SolidColorBrush)
Public Property BackGroundColor As SolidColorBrush
Get
Return m_BackGroundColor
End Get
Set(value As SolidColorBrush)
m_BackGroundColor = value
NotifyPropertyChanged("BackGroundColor")
End Set
End Property
' Colore utilizzato nell'intestazione
Private m_Foreground As SolidColorBrush = DirectCast(New BrushConverter().ConvertFrom("#000000"), SolidColorBrush)
Public Property Foreground As SolidColorBrush
Get
Return m_Foreground
End Get
Set(value As SolidColorBrush)
m_Foreground = value
NotifyPropertyChanged("Foreground")
End Set
End Property
' Spessorre della linea che circonda l'elenco dei parametri
Private m_BorderThickness As Integer = 1
Public Property BorderThickness As Integer
Get
Return m_BorderThickness
End Get
Set(value As Integer)
m_BorderThickness = value
NotifyPropertyChanged("BorderThickness")
End Set
End Property
' Carettere grassetto utilizzato nell'intestazione
Private m_FontBold As FontWeight = FontWeights.Bold
Public Property FontBold As FontWeight
Get
Return m_FontBold
End Get
Set(value As FontWeight)
m_FontBold = value
NotifyPropertyChanged("FontBold")
End Set
End Property
Public Sub ResetMark()
m_BorderColor = DirectCast(New BrushConverter().ConvertFrom("#DCDCDC"), SolidColorBrush)
m_BackGroundColor = Brushes.White
m_Foreground = Brushes.Black
m_BorderThickness = 1
m_FontBold = FontWeights.Normal
NotifyPropertyChanged("BorderColor")
NotifyPropertyChanged("BackGroundColor")
NotifyPropertyChanged("Foreground")
NotifyPropertyChanged("BorderThickness")
NotifyPropertyChanged("FontBold")
End Sub
Public Sub SetMark()
m_BorderColor = DirectCast(New BrushConverter().ConvertFrom("#FF4D84C4"), SolidColorBrush)
m_BackGroundColor = DirectCast(New BrushConverter().ConvertFrom("#FFFFFFFF"), SolidColorBrush)
m_Foreground = DirectCast(New BrushConverter().ConvertFrom("#FF4D84C4"), SolidColorBrush)
m_BorderThickness = 2
m_FontBold = FontWeights.Bold
NotifyPropertyChanged("BorderColor")
NotifyPropertyChanged("BackGroundColor")
NotifyPropertyChanged("Foreground")
NotifyPropertyChanged("BorderThickness")
NotifyPropertyChanged("FontBold")
End Sub
#End Region ' Colori GroupBox
#Region "CompoRef"
' componente RIFERITA generata sul telaio
Private m_refCompoJamb As Compo
Public Property refJambCompo As Compo
Get
Return m_refCompoJamb
End Get
Set(value As Compo)
m_refCompoJamb = value
End Set
End Property
' componente di RIFERIMENTO generata sull'anta
Private m_refCompoDoor As Compo
Public Property refCompoDoor As Compo
Get
Return m_refCompoDoor
End Get
Set(value As Compo)
m_refCompoDoor = value
End Set
End Property
Private m_IsReadOnly As Boolean = False
Public Property IsReadOnly As Boolean
Get
Return m_IsReadOnly
End Get
Set(value As Boolean)
m_IsReadOnly = value
NotifyPropertyChanged("IsReadOnly")
End Set
End Property
' identifica il codice della componente
Private m_IdCode As String
Public Property IdCode As String
Get
Return m_IdCode
End Get
Set(value As String)
m_IdCode = value
End Set
End Property
' questo parametro è utilizzato per le componenti Anta-Anta
' in fase di salvateggio viene stampato "##IdCodeComponent : 20 , matched"
' indica che la componente che è stata creata è riferita
Private m_MatchedDoor As Boolean = False
Public Property MatchedDoor As Boolean
Get
Return m_MatchedDoor
End Get
Set(value As Boolean)
m_MatchedDoor = value
End Set
End Property
' deve essere settato a 1 (solo in presenza di due ante):
' - inserisco un componente sul frame Top & sulla seconda anta (dx)
' - inserisco un componente sul frema Bottom & sulla prima anta (sx)
Private m_OtherDoor As Boolean = False
Public Property OtherDoor As Boolean
Get
Return m_OtherDoor
End Get
Set(value As Boolean)
m_OtherDoor = value
NotifyPropertyChanged("OtherDoor")
End Set
End Property
' gestisce la visibilità del bottone accanto al nome componente per rigenerare il riferimento
Private m_VisibilitiReloadBtn As Visibility = Visibility.Collapsed
Public Property VisibilitiReloadBtn As Visibility
Get
If OptionModule.m_ConfigurationSoftware <> ConfigType.Assembly Then
m_VisibilitiReloadBtn = Visibility.Collapsed
End If
Return m_VisibilitiReloadBtn
End Get
Set(value As Visibility)
m_VisibilitiReloadBtn = value
NotifyPropertyChanged("VisibilitiReloadBtn")
End Set
End Property
#End Region ' CompoRef
#Region "Gestione Errori DOORCreator"
Public m_ParameterDDfList As New List(Of String)
' In caso di direttorio componente mancante
Private m_MissingDirectory As Boolean = False
Public Property MissingDirectory As Boolean
Get
Return m_MissingDirectory
End Get
Set(value As Boolean)
m_MissingDirectory = value
NotifyPropertyChanged("MissingDirectory")
End Set
End Property
' In caso di file componente mancante
Private m_MissingFile As Boolean = False
Public Property MissingFile As Boolean
Get
Return m_MissingFile
End Get
Set(value As Boolean)
m_MissingFile = value
NotifyPropertyChanged("MissingFile")
End Set
End Property
' In caso di caricamento di default della componente
Private m_LoadByDefault As Boolean = False
Public Property LoadByDefault As Boolean
Get
Return m_LoadByDefault
End Get
Set(value As Boolean)
m_LoadByDefault = value
SetImage()
NotifyPropertyChanged("ShowParamList")
NotifyPropertyChanged("IsError")
End Set
End Property
' In caso di mancanza di un paremtro da ddf
Private m_MissingParameter As Boolean = False
Public Property MissingParameter As Boolean
Get
Return m_MissingParameter
End Get
Set(value As Boolean)
m_MissingParameter = value
NotifyPropertyChanged("IsError")
End Set
End Property
' In caso di valore caricato sbagliato
Private m_ErrorValue As Boolean = False
Public Property ErrorValue As Boolean
Get
Return m_ErrorValue
End Get
Set(value As Boolean)
m_ErrorValue = value
For Each Param In Me.CompoParamList
' non evidenzio tutta la componete se è una modifica del parametro
If Param.ErrorParameter AndAlso Not Param.IsModifingRefCompoParam Then
m_ErrorValue = True
Exit For
End If
Next
NotifyPropertyChanged("IsError")
End Set
End Property
' definisce il colore dell'errore attraverso il parametro "IsError"
Private m_ErrorColor As SolidColorBrush = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorLoadByDefault), SolidColorBrush)
Public Property ErrorColor As SolidColorBrush
Get
Return m_ErrorColor
End Get
Set(value As SolidColorBrush)
m_ErrorColor = value
NotifyPropertyChanged("ErrorColor")
End Set
End Property
' definsce il tipo di carettere che deve essere visualizzato
' è assegnato assieme al colore dell'errore
Private m_FontStyleCompoBrandFile As String = "Normal"
Public Property FontStyleCompoBrandFile As String
Get
Return m_FontStyleCompoBrandFile
End Get
Set(value As String)
m_FontStyleCompoBrandFile = value
NotifyPropertyChanged("FontStyleCompoBrandFile")
End Set
End Property
Public ReadOnly Property ShowParamList As Visibility
Get
If m_LoadByDefault Then
NotifyPropertyChanged("IsError")
Return Visibility.Collapsed
End If
Return Visibility.Visible
End Get
End Property
' Sets l'immagine per l'eliminazione della componente
Public Sub SetImage()
If m_LoadByDefault Then
'm_ImageButton = "/Resources/Refresh/Error.png"
m_ImageButton = "/Resources/TopCommandBar/X.png"
Else
m_ImageButton = "/Resources/TopCommandBar/X.png"
End If
NotifyPropertyChanged("IsError")
End Sub
Private m_ImageButton As String = "/Resources/TopCommandBar/X.png"
Public ReadOnly Property ImageButton As String
Get
Return m_ImageButton
End Get
End Property
Private m_ImageHardware As String = "/Resources/InstrumentPanel/Hardware.png"
Public ReadOnly Property ImageHardware As String
Get
Return m_ImageHardware
End Get
End Property
' Ha il compito di assegnare il colore in funzione della cmbinaione di errori
' e comunicare che è stato trivato un errore
Public ReadOnly Property IsError As Boolean
Get
' è suffuciente che ci sia un errore perchè venga evidenziato nella grafica
If m_ErrorValue And Not m_MissingParameter And Not m_LoadByDefault Then
ErrorColor = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorErrorValue), SolidColorBrush)
FontStyleCompoBrandFile = "Italic"
Return True
ElseIf m_MissingParameter And Not m_ErrorValue And Not m_LoadByDefault Then
ErrorColor = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorMissingParameter), SolidColorBrush)
FontStyleCompoBrandFile = "Italic"
Return True
ElseIf m_LoadByDefault And Not m_MissingParameter And Not m_ErrorValue Then
ErrorColor = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorLoadByDefault), SolidColorBrush)
FontStyleCompoBrandFile = "Italic"
Return True
ElseIf m_LoadByDefault And (m_MissingParameter OrElse m_ErrorValue) Then
ErrorColor = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorLoadByDefault), SolidColorBrush)
FontStyleCompoBrandFile = "Italic"
Return True
ElseIf m_MissingParameter And m_ErrorValue Then
ErrorColor = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorErrorAndMissing), SolidColorBrush)
FontStyleCompoBrandFile = "Italic"
Return True
ElseIf OptionModule.m_ConfigurationSoftware = ConfigType.Assembly AndAlso Not IsNothing(refCompoDoor) Then
MissingDirectory = True
MissingFile = True
ErrorColor = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorRefCompo), SolidColorBrush)
FontStyleCompoBrandFile = "Italic"
Return False
Else
ErrorColor = DirectCast(New BrushConverter().ConvertFrom("Black"), SolidColorBrush)
FontStyleCompoBrandFile = "Normal"
Return False
End If
End Get
End Property
#End Region ' Gestione Errori
#Region "Group Chapter"
' definsce se il capitolo NON deve essere di tipo Expand
Private m_IsFixed As Boolean
Friend ReadOnly Property IsFixed As Boolean
Get
Return m_IsFixed
End Get
End Property
Friend Sub SetIsFixed(IsFixed As Boolean)
m_IsFixed = IsFixed
End Sub
' utilizzato nel HardwareManager per mostrare i parametri
Private m_IsActiveChapter As Boolean = True
Public Property IsActiveChapter As Boolean
Get
Return m_IsActiveChapter
End Get
Set(value As Boolean)
m_IsActiveChapter = value
If Not IsNothing(Map.refHardwarePageVM) AndAlso Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
For Each ItemParam In Me.CompoParamList
If TypeOf ItemParam Is ActivateParam Then
Dim Text As ActivateParam = DirectCast(ItemParam, ActivateParam)
Text.SetIsActivated(m_IsActiveChapter)
Exit For
End If
Next
SetModified()
'Map.refHardwarePageVM.CurrHardware.RefreshTempHardware()
Map.refSceneManagerVM.RefreshBtn()
End If
End Set
End Property
Public Sub SetIsActiveChapter(IsActive As Boolean)
m_IsActiveChapter = IsActive
NotifyPropertyChanged("IsActiveChapter")
End Sub
' utilizzato nel HardwareManager per mostrare i parametri in cascata
Private m_GroupNameChapter As String = String.Empty
Public Property GroupNameChapter As String
Get
Return m_GroupNameChapter
End Get
Set(value As String)
m_GroupNameChapter = value
End Set
End Property
' utilizzato nel HardwareManager per nascondere un capitolo
Private m_GroupVisibilityChapter As Visibility = Visibility.Visible
Public Property GroupVisibilityChapter As Visibility
Get
Return m_GroupVisibilityChapter
End Get
Set(value As Visibility)
m_GroupVisibilityChapter = value
NotifyPropertyChanged("GroupVisibilityChapter")
End Set
End Property
' è usato solo per i capitoli del HardwareManager
Private m_EnableChapter As Boolean = True
Public Property EnableChapter As Boolean
Get
Return m_EnableChapter
End Get
Set(value As Boolean)
m_EnableChapter = value
End Set
End Property
Public Sub SetEnableChapter(bEnableChapter As Boolean)
m_EnableChapter = bEnableChapter
m_ErrorColor = DirectCast(New BrushConverter().ConvertFrom(OptionModule.ColorDisableChapter), SolidColorBrush)
NotifyPropertyChanged("EnableChapter")
NotifyPropertyChanged("ErrorColor")
End Sub
#End Region ' Group Chapter
#Region "Selezione Template"
#Region "Brand"
' lista dei marchi
Private m_BrandListPart As New ObservableCollection(Of String)
Public Property BrandListPart As ObservableCollection(Of String)
Get
Return m_BrandListPart
End Get
Set(value As ObservableCollection(Of String))
m_BrandListPart = value
End Set
End Property
' salvo nella compoenente il direttorio fasullo
Private FakeDir As CompoBrandDir
' selezione del marchio
Private m_SelBrandPart As String
Public Property SelBrandPart As String
Get
Return m_SelBrandPart
End Get
Set(value As String)
' questa procedura deve essere eseguita SOLO dopo il caricamento della pagina!
m_SelBrandPart = value
For IndexModelList As Integer = 0 To m_BrandListPart.Count - 1
' distinguo il caricamento della lista dei frame
If m_BrandListPart(IndexModelList) = m_SelBrandPart Then
If value.ToLower.Contains(".frame") Then
If Not Directory.Exists(CompoType.Path & "\" & m_SelBrandPart) Then
' se il direttorio che cerco non esiste allora ne creo uno fasullo con una lista di file vuota
If IsNothing(FakeDir) Then
FakeDir = New CompoBrandDir(CompoType.Path & "\" & m_SelBrandPart, "")
If Not IsNothing(FakeDir) Then
' se la creazione è andata a buon fine seleziono il direttorio
CompoType.FolderList.Add(FakeDir)
End If
End If
' se il direttorio già esiste allora lo carico con la lista finta
If Not IsNothing(FakeDir) Then
FileList = New ObservableCollection(Of String)
FileList = FakeDir.ModelFileList
NotifyPropertyChanged("FileList")
End If
' se la lista finta ha almeno un valore
If FileList.Count > 0 Then
SelFile = FileList(0)
Else
SelFile = String.Empty
End If
' quindi esco (non carico nessun file)
Return
End If
For Each ItemFolderCompo In CompoType.FrameFolderList
If ItemFolderCompo.ModelDirGraphic.ToLower = m_SelBrandPart.ToLower Then
m_FileList = ItemFolderCompo.ModelFileList
Exit For
End If
Next
' m_FileList = CompoType.FrameFolderList(IndexModelList).ModelFileList
Else
If Not Directory.Exists(CompoType.Path & "\" & m_SelBrandPart) Then
' se il direttorio che cerco non esiste allora ne creo uno fasullo con una lista di file vuota
If IsNothing(FakeDir) Then
FakeDir = New CompoBrandDir(CompoType.Path & "\" & m_SelBrandPart, "")
If Not IsNothing(FakeDir) Then
' se la creazione è andata a buon fine seleziono il direttorio
CompoType.FolderList.Add(FakeDir)
End If
End If
' se il direttorio già esiste allora lo carico con la lista finta
If Not IsNothing(FakeDir) Then
FileList = New ObservableCollection(Of String)
FileList = FakeDir.ModelFileList
NotifyPropertyChanged("FileList")
End If
' se la lista finta ha almeno un valore
If FileList.Count > 0 Then
SelFile = FileList(0)
Else
SelFile = String.Empty
End If
' quindi esco (non carico nessun file)
Return
End If
For Each ItemFolderCompo In CompoType.FolderList
If ItemFolderCompo.ModelDirGraphic.ToLower = m_SelBrandPart.ToLower Then
m_FileList = ItemFolderCompo.ModelFileList
Exit For
End If
Next
End If
Exit For
End If
Next
NotifyPropertyChanged("FileList")
Dim SelItemindex As Integer = 0
' seleziono il primo file del direttorio
While SelItemindex < m_FileList.Count - 1 AndAlso Path.HasExtension(m_FileList(SelItemindex))
SelItemindex += 1
End While
If SelItemindex < m_FileList.Count Then
SelFile = m_FileList(SelItemindex)
Else
SelFile = String.Empty
End If
End Set
End Property
Public Sub SetSelBrand(sSelBrand As String)
m_SelBrandPart = sSelBrand
Dim IndexModelList As Integer = m_BrandListPart.IndexOf(Trim(sSelBrand))
If IndexModelList < 0 Then Return
If sSelBrand.ToLower.Contains(FRAME_FOLDER) Then
If IndexModelList > CompoType.FrameFolderList.Count - 1 Then Return
m_FileList = CompoType.FrameFolderList(IndexModelList).ModelFileList
Else
If IndexModelList > CompoType.FolderList.Count - 1 Then Return
m_FileList = CompoType.FolderList(IndexModelList).ModelFileList
End If
NotifyPropertyChanged("FileList")
NotifyPropertyChanged("SelBrandPart")
End Sub
#End Region ' Brand
#Region "File"
' lista dei file
Private m_FileList As New ObservableCollection(Of String)
Public Property FileList As ObservableCollection(Of String)
Get
Return m_FileList
End Get
Set(value As ObservableCollection(Of String))
m_FileList = value
NotifyPropertyChanged("FileList")
End Set
End Property
' selezione del file
Private m_SelFile As String
Public Property SelFile As String
Get
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) OrElse String.IsNullOrEmpty(value) Then Return
m_SelFile = value
' ricostruisco il nome del template da passare alle funzioni
Dim ModelDir As String = String.Empty
'If m_SelBrandPart <> RegexFunction.ModelTemplate(m_CompoType.Path) Then ModelDir = m_SelBrandPart & "\"
If m_SelBrandPart <> RAD_DIR Then ModelDir = m_SelBrandPart & "\"
Dim CurrItem As String = ModelDir & m_SelFile
' passo il nome
TemplateSelItem = CurrItem
Assembly.BuiltReffCompo = True
Map.refAssemblyPageVM.CurrAssembly.SetDimension("CreateRefCompo", Me)
Assembly.BuiltReffCompo = False
NotifyPropertyChanged("SelFile")
Map.refSceneManagerVM.RefreshBtn()
End Set
End Property
Friend Sub SetSelFile(File As String)
m_SelFile = File
' ricostruisco il nome del template da passare alle funzioni
Dim ModelDir As String = String.Empty
If m_SelBrandPart <> RegexFunction.ModelTemplate(m_CompoType.Path) Then ModelDir = m_SelBrandPart & "\"
Dim CurrItem As String = ModelDir & m_SelFile
' passo il nome
SetSelTemplate(CurrItem)
NotifyPropertyChanged("SelFile")
End Sub
#End Region ' File
Private m_TemplateVisibility As Visibility
Public Property TemplateVisibility As Visibility
Get
Return m_TemplateVisibility
End Get
Set(value As Visibility)
m_TemplateVisibility = value
End Set
End Property
' nome grafica (potrebbe essere shape o template)
Private m_TemplateName As String
Public Property TemplateName As String
Get
Return m_TemplateName
End Get
Set(value As String)
m_TemplateName = value
End Set
End Property
' nome DDF (potrebbe essere shape o template)
Private m_TemplateDDFName As String
Public Property TemplateDDFName As String
Get
Return m_TemplateDDFName
End Get
Set(value As String)
m_TemplateDDFName = value
End Set
End Property
' il messaggio associato al brand
Public ReadOnly Property BrandMsg As String
Get
Return Me.CompoType.FolderName
End Get
End Property
' Template selezionato
Private m_TemplateSelItem As String
Public Property TemplateSelItem As String
Get
Return m_TemplateSelItem
End Get
Set(value As String)
SetTemplateSelItem(value)
' LoadByDefault = False
SetModified()
'Map.refSceneManagerVM.RefreshBtn()
End Set
End Property
Private Sub SetSelTemplate(Template As String)
If Template.Contains(".\") Then Template = Template.Replace(".\", "")
SetTemplateSelItem(Template)
'SetModified()
End Sub
' 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)
' 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)
For IndexArray As Integer = 2 To ItemsTemplate.Count - 2
sFile &= "\" & ItemsTemplate(IndexArray)
IndexArray += 1
Next
SetSelFile(sFile)
End Sub
' setta il valore del template
Friend Sub SetTemplateSelItem(value As String)
Dim CurrConfig As String = m_CompoType.Path & "\" & CONFIGINI_FILE_NAME
Dim CurrItemPath As String = m_CompoType.Path & "\" & value
Dim ErrorList As String = String.Empty
Dim ConfigDefault As String = String.Empty
' se il file ha estensione nge
If Path.HasExtension(CurrItemPath) AndAlso Path.GetExtension(CurrItemPath).ToLower = NGE_EXTENSION Then
' controllo che esiste il file altrimenti esco
If Not File.Exists(CurrItemPath) Then Return
m_TemplateSelItem = value
' creo la stringa che contiene la lista degli errori
EgtUILib.GetPrivateProfileString(S_NGECONFIG, K_DEFAULT, "", ConfigDefault, CurrConfig)
' ricerco la parola chiave Param nella stringa nel file Config.ini
ReadParamConfig(ErrorList, ConfigDefault)
ReadDefaultParamLua(CurrItemPath, Me)
Else
' se il file non ha estensione allora aggiungo l'estensione .lua
If Not Path.GetExtension(CurrItemPath).ToLower = LUA_EXTENSION Then
CurrItemPath &= LUA_EXTENSION
End If
' seleziono il nome, controllo che esista il file altrimenti esco
m_TemplateSelItem = value
If Not File.Exists(CurrItemPath) Then
If Directory.Exists(Path.GetDirectoryName(CurrItemPath)) Then
Me.MissingDirectory = False
Me.MissingFile = True
Else
Me.MissingDirectory = True
Me.MissingFile = True
End If
Me.LoadByDefault = True
Return
End If
Me.LoadByDefault = False
Me.MissingDirectory = False
Me.MissingFile = False
' carico un vettore con le stringhe del file corrente
Dim ReadCurrCompo() As String = File.ReadAllLines(CurrItemPath)
For LineIndex = 0 To ReadCurrCompo.Count - 1
' cerco il titolo [Graphic parameters]: se lo trovo
If RegexFunction.IsGraphicParametersTitle(ReadCurrCompo(LineIndex)) Then
' mi preparo per leggere la prima riga dopo il titolo
Dim ParamIndex As Integer = 1
ConfigDefault = Trim(RegexFunction.ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_DEFAULT))
While String.IsNullOrEmpty(ConfigDefault) And LineIndex + ParamIndex < ReadCurrCompo(LineIndex + ParamIndex).Count
ParamIndex += 1
ConfigDefault = Trim(RegexFunction.ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_DEFAULT))
End While
' quando termino il ciclo while posso uscire anche dal for
Exit For
End If
Next
ReadParamConfig(ErrorList, ConfigDefault)
ReadDefaultParamLua(CurrItemPath, Me)
Map.refAssemblyManagerVM.ReadParams(Me, "")
End If
If Not String.IsNullOrWhiteSpace(ErrorList) Then EgtOutLog(ErrorList)
End Sub
' setto la lista dei parametri da caricare
Private Sub ReadParamConfig(ByRef ErrorList As String, DefaultConfig As String)
Dim NewCompoParam As CompoParam = Nothing
Dim ParamIndex As Integer = 1
Dim sParam As String = String.Empty
Dim CurrConfig As String = m_CompoType.Path & "\" & CONFIGINI_FILE_NAME
Dim S_CHAPTER As String
If String.IsNullOrWhiteSpace(DefaultConfig) Then
S_CHAPTER = S_GR_PARAM_DEFAULT & "1"
Else
S_CHAPTER = S_GR_PARAM_DEFAULT & DefaultConfig
End If
' ripulisco la lista dei parametri sempre!
If m_ConfigurationParameters <> S_CHAPTER Then m_CompoParamList.Clear()
m_ConfigurationParameters = S_CHAPTER
' leggo il nome del parametro che servirà a riordinare le quote in fase di stampa
GetPrivateProfileTidyLayer(S_CHAPTER, K_PARAM_LAYER, m_TidyParam, CurrConfig)
While EgtUILib.GetPrivateProfileString(S_CHAPTER, K_PARAM & ParamIndex, "", sParam, CurrConfig) > 0
If Not String.IsNullOrWhiteSpace(sParam) Then
' leggo il tipo di parametro
ReadParam(sParam, NewCompoParam, ErrorList)
' carico il parametro nella lista della componente
InsertCompoParam(NewCompoParam, ParamIndex)
End If
ParamIndex += 1
End While
Me.ErrorValue = False
Me.MissingParameter = False
For Each ItemParam In Me.CompoParamList
If ItemParam.ErrorInReading Then Me.ErrorValue = True
If ItemParam.MissingParameterInReading Then Me.MissingParameter = True
Next
End Sub
' inserisco il parametro letto nella lista dei paramtri senza modificare i parametri già esistenti
Private Sub InsertCompoParam(NewCompoParam As CompoParam, ParamIndex As Integer)
If Not IsNothing(NewCompoParam) Then
' se non esiste l'indice
If Not m_CompoParamList.Count > ParamIndex - 1 Then
' creo il parametro
Me.CompoParamList.Insert(ParamIndex - 1, NewCompoParam)
Else
' se esiste ma è diverso il nome DDF o il tipo
If m_CompoParamList(ParamIndex - 1).DDFName <> NewCompoParam.DDFName OrElse
Not Object.ReferenceEquals(m_CompoParamList(ParamIndex - 1).GetType(), NewCompoParam.GetType()) Then
' creo il nuovo parametro
m_CompoParamList.RemoveAt(ParamIndex - 1)
m_CompoParamList.Insert(ParamIndex - 1, NewCompoParam)
End If
End If
End If
End Sub
#Region "SettemplateREFCOMPO"
Friend Sub SetTemplateSelItemRefCompo(sFrameFile As String, CurrRefCompo As Compo)
' salvo una copia del percorso del direttorio
Dim CurrItemPath As String = CurrRefCompo.CompoType.Path
' costruisco il percorso del file Config.ini
Dim CurrConfig As String = CurrItemPath & "\" & CONFIGINI_FILE_NAME
' stringa per gestire gli errori
Dim ErrorList As String = String.Empty
' se il nome del file contiente tutto il suo perscorso (cioè la path del direttorio)
If sFrameFile.Contains(CurrItemPath) Then
' sottraggo al nome del file il percorso del direttorio
sFrameFile = sFrameFile.Substring(CurrItemPath.Count + 1)
CurrItemPath &= "\" & sFrameFile
Else
CurrItemPath &= "\" & sFrameFile
End If
' CurrItemPath -> il nome del percorso completo del file
' sFrameFile -> il nome del file che deve essere stampato nel ddf
' se il file ha estensione nge
If Path.HasExtension(CurrItemPath) AndAlso Path.GetExtension(CurrItemPath).ToLower = NGE_EXTENSION Then
' controllo che esiste il file altrimenti esco
If Not File.Exists(CurrItemPath) Then Return
' Possibile errore! sFrame non è il riferiento alla lista m_TemplateItemList
CurrRefCompo.TemplateSelItem = sFrameFile
' creo la stringa che contiene la lista degli errori
Dim ParamIndex As Integer = 1
Dim ConfigDefault As String = String.Empty
EgtUILib.GetPrivateProfileString(S_NGECONFIG, K_DEFAULT, "", ConfigDefault, CurrConfig)
' ricerco la parola chiave Param nella stringa nel file Cinfig.ini
ReadParamConfig(ErrorList, ConfigDefault)
Else
' se il file non ha estensione allora creo l'estensione .lua
If Not Path.GetExtension(CurrItemPath).ToLower = LUA_EXTENSION Then
CurrItemPath &= LUA_EXTENSION
End If
' controllo che esiste il file altrimenti esco
If Not File.Exists(CurrItemPath) Then Return
Assembly.BuiltReffCompo = False
CurrRefCompo.TemplateSelItem = sFrameFile
' carico un vettore con le stringhe del file corrente
Dim ReadCurrCompo() As String = File.ReadAllLines(CurrItemPath)
Assembly.BuiltReffCompo = True
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
Dim NewCompoParam As CompoParam = Nothing
Dim bIsFinished As Boolean = False
' se la lettura del primo parametro "--Default=" restituisce un valore non nullo
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
' se il valore letto non è numerico allora esco dal cilo per la lettura dei parametri
Exit For
Else
ReadParamConfig(ErrorList, ConfigDefault)
Exit For
End If
Else
' se il primo parametro non è "Dafault" allora mi aspetto di leggere i parametri
While Not bIsFinished
' attualizzo il componente a nulla
NewCompoParam = Nothing
' cerco nella riga successiva al titolo il primo parametro
If Not String.IsNullOrWhiteSpace(ReadCurrCompo(LineIndex + ParamIndex)) Then
Dim ReadLine As String
' carico i valori della stringa che seguono la chiave "--Param1="
ReadLine = ParamLine(ReadCurrCompo(LineIndex + ParamIndex), K_PARAM & ParamIndex)
' se uno dei paraemtri è completamente sbagliato allora restituisce falso e non riempo la NewCompoParam che rimane Nothing
bIsFinished = Not ReadParam(ReadLine, NewCompoParam, ErrorList)
Else
' altrimenti se la riga è vuota mi sposto alla successiva
LineIndex += 1
' e continuo il ciclo while
Continue While
End If
' insrisco la nuova componenenet: se la riga è vuota o la componente non è stata creata allora il componete è Nothing
InsertCompoParam(NewCompoParam, ParamIndex)
' se il parametro è stato creato passa alla riga successiva
If Not bIsFinished Then ParamIndex += 1
End While
NotifyPropertyChanged("TemplateSelItem")
End If
' esiste già una lista
For DeleteIndex = Me.refJambCompo.CompoParamList.Count - 1 To ParamIndex - 1 Step -1
Me.refJambCompo.CompoParamList.RemoveAt(DeleteIndex)
Next
Exit For
ElseIf LineIndex = ReadCurrCompo.Count - 1 Then
' se non trovo il capitoletto nel file leggo i parametri di default del file Config.ini
Dim ParamIndex As Integer = 1
Dim NewCompoParam As CompoParam = Nothing
ReadParamConfigRefCompo(NewCompoParam, ErrorList, ParamIndex, "", CurrRefCompo)
Exit For
End If
Next
End If
If Not String.IsNullOrWhiteSpace(ErrorList) Then EgtOutLog(ErrorList)
End Sub
' setto la lista dei parametri da caricare la lista dei paramestri
Private Sub ReadParamConfigRefCompo(ByRef NewCompoParam As CompoParam, ByRef ErrorList As String, ParamIndex As Integer, DefaultConfig As String, CurrRefCompo As Compo)
Dim sParam As String = String.Empty
Dim CurrConfig As String = CurrRefCompo.CompoType.Path & "\" & CONFIGINI_FILE_NAME
Dim S_CHAPTER As String
If String.IsNullOrWhiteSpace(DefaultConfig) Then
S_CHAPTER = S_GR_PARAM_DEFAULT & "1"
Else
S_CHAPTER = S_GR_PARAM_DEFAULT & DefaultConfig
End If
While EgtUILib.GetPrivateProfileString(S_CHAPTER, K_PARAM & ParamIndex, "", sParam, CurrConfig) > 0
If Not String.IsNullOrWhiteSpace(sParam) Then
' leggo il tipo di parametro
ReadParam(sParam, NewCompoParam, ErrorList)
' carico il parametro nella lista della componente
InsertCompoParamRef(NewCompoParam, ParamIndex, CurrRefCompo)
End If
ParamIndex += 1
End While
' controllo di aver tolto tutti i parametri che potrrebbero esistere da una precedente chiamata
For DeleteIndex = CurrRefCompo.CompoParamList.Count - 1 To ParamIndex - 1 Step -1
CurrRefCompo.CompoParamList.RemoveAt(DeleteIndex)
Next
End Sub
' inserisco il parametro letto nella lista dei paramtri senza modificare i parametri già esistenti
Private Sub InsertCompoParamRef(NewCompoParam As CompoParam, ParamIndex As Integer, CurrRefCompo As Compo)
If Not IsNothing(NewCompoParam) Then
' se non esiste l'indice
If Not CurrRefCompo.CompoParamList.Count > ParamIndex - 1 Then
' creo il parametro combo
CurrRefCompo.CompoParamList.Insert(ParamIndex - 1, NewCompoParam)
Else
' se esiste ma è diverso il nome DDF
If Not m_CompoParamList(ParamIndex - 1).DDFName = NewCompoParam.DDFName Then
' creo il nuovo parametro combo
CurrRefCompo.CompoParamList.RemoveAt(ParamIndex - 1)
CurrRefCompo.CompoParamList.Insert(ParamIndex - 1, NewCompoParam)
End If
End If
End If
End Sub
#End Region ' SetTemplateREFCOMPO
' Utilizzo nome DDF e nome, restituisco il nome solo se esiste un messaggio associato
Private Function MsgControl(sDDFName As String, sName As String, ByRef sErrorList As String) As String
'Se nome è numerico
Dim nInd As Integer
If Integer.TryParse(sName, nInd) Then
' recupero il messaggio
Dim sMsg As String = EgtMsg(nInd)
' se non esiste lo sostituico con il nome
Dim ErrorMsg As String = "Msg" & Trim(sName)
If String.Equals(sMsg, ErrorMsg) Then
' Errore nella lettura dei messaggi. Non esiste corrispondenza con il numero {0}.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50119), sName))
Return sDDFName
' altrimenti lo restituisco
Else
Return sMsg
End If
' Altrimenti restituisco il nome
Else
Return sName
End If
End Function
' Lettura dei parametri da .ini
Public Function ReadParam(sReadLine As String, ByRef NewCompoParam As CompoParam, ByRef sErrorList As String) As Boolean
' Se linea vuota, esco con errore
If String.IsNullOrWhiteSpace(sReadLine) Then
' Empty line
sErrorList = ConcatErrorString(sErrorList, EgtMsg(50167))
Return False
End If
' Scompongo la linea nelle sue parti
Dim sItems() As String = sReadLine.Split(";"c)
' Devono esserci almeno due parti
If sItems.Count() < 2 Then
' Errore nella lettura {0} nel parametro {1} della componente: non esiste.
Dim sError As String = String.Format(EgtMsg(50121), m_CompoType.DDFName, sItems(0))
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
' La prima parte definisce la categoria
Select Case Trim(sItems(0))
Case INI_COMBOBOX
' NomeDDF e Nome del combo
Dim sComboList() As String = sItems(1).Split("/"c)
Dim sDDFName As String = String.Empty
Dim sName As String = String.Empty
If sComboList.Count() >= 1 Then sDDFName = Trim(sComboList(0))
If sComboList.Count() >= 2 Then
sName = Trim(MsgControl(sComboList(0), sComboList(1), sErrorList))
Else
sName = sDDFName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sComboList(0), m_CompoType.Path))
End If
' La combobox deve contenere almeno un elemento "ComboBox; NomeDDF/Nome; NomeDDFItem/NomeItem, ...."
If sItems.Count < 3 Then
' Errore nella lettura {0} nel parametro {1} della componente: non esiste.
Dim sError As String = String.Format(EgtMsg(50121), sDDFName, m_CompoType.DDFName)
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
' Ricavo i diversi item
Dim bEnableCopy As Boolean = true
If sItems(2).Contains("$") then
bEnableCopy = False
sItems(2) = sItems(2).Replace("$","")
End If
Dim sComboItemList() As String = sItems(2).Split(","c)
Dim ComboItemList As New ObservableCollection(Of String)
Dim DDFComboItemList As New ObservableCollection(Of String)
For ItemIndex = 0 To sComboItemList.Count - 1
Dim ComboItem() As String = sComboItemList(ItemIndex).Split("/"c)
' se esiste il NomeDDFItem
If ComboItem.Count >= 1 Then DDFComboItemList.Add(Trim(ComboItem(0)))
' se esiste anche il NomeItem
If ComboItem.Count >= 2 Then
' carico la lista con i nomi
ComboItemList.Add(Trim(MsgControl(ComboItem(0), ComboItem(1), sErrorList)))
Else
' se esiste solo un nome considero sia il nome DDF
ComboItemList.Add(Trim(ComboItem(0)))
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), ComboItem(0), m_CompoType.Path))
End If
Next
' Creo il parametro
If bEnableCopy then
NewCompoParam = New ComboBoxParam(sDDFName, sName, Me, ComboItemList, DDFComboItemList, ComboItemList(0))
Else
NewCompoParam = New ComboBoxParam(sDDFName, sName, Me, ComboItemList, DDFComboItemList, "")
End If
Return True
Case INI_COMBOBOX_ONOFF
' NomeDDF e Nome del combo
Dim sComboList() As String = sItems(1).Split("/"c)
Dim sDDFName As String = String.Empty
Dim sName As String = String.Empty
If sComboList.Count() >= 1 Then sDDFName = Trim(sComboList(0))
If sComboList.Count() >= 2 Then
sName = Trim(MsgControl(sComboList(0), sComboList(1), sErrorList))
Else
sName = sDDFName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sComboList(0), m_CompoType.Path))
End If
' La combobox deve contenere almeno un elemento "ComboBox; NomeDDF/Nome; NomeDDFItem/NomeItem, ...."
If sItems.Count < 3 Then
' Errore nella lettura {0} nel parametro {1} della componente: non esiste.
Dim sError As String = String.Format(EgtMsg(50121), sDDFName, m_CompoType.DDFName)
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
Dim nActiveBox As Double = 1
Dim bActiveBox As Boolean = True
If sItems.Count > 3 AndAlso StringToDouble(sItems(3), nActiveBox) AndAlso nActiveBox = 0 Then
bActiveBox = False
End If
' Ricavo i diversi item
Dim bEnableCopy As Boolean = true
If sItems(2).Contains("$") then
bEnableCopy = False
sItems(2) = sItems(2).Replace("$","")
End If
Dim sComboItemList() As String = sItems(2).Split(","c)
Dim ComboItemList As New ObservableCollection(Of String)
Dim DDFComboItemList As New ObservableCollection(Of String)
For ItemIndex = 0 To sComboItemList.Count - 1
Dim ComboItem() As String = sComboItemList(ItemIndex).Split("/"c)
' se esiste il NomeDDFItem
If ComboItem.Count >= 1 Then DDFComboItemList.Add(Trim(ComboItem(0)))
' se esiste anche il NomeItem
If ComboItem.Count >= 2 Then
' carico la lista con i nomi
ComboItemList.Add(Trim(MsgControl(ComboItem(0), ComboItem(1), sErrorList)))
Else
' se esiste solo un nome considero sia il nome DDF
ComboItemList.Add(Trim(ComboItem(0)))
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), ComboItem(0), m_CompoType.Path))
End If
Next
' Creo il parametro
If bEnableCopy then
NewCompoParam = New ComboBoxOnOffParam(sDDFName, sName, Me, ComboItemList, DDFComboItemList, ComboItemList(0), "", bActiveBox)
Else
NewCompoParam = New ComboBoxOnOffParam(sDDFName, sName, Me, ComboItemList, DDFComboItemList, "", "", bActiveBox)
End If
Return True
Case INI_TEXTBOX, INI_TEXTBOX_D
' NomeDDF e Nome del Text
Dim sTextList() As String = sItems(1).Split("/"c)
Dim sDDFName As String = String.Empty
Dim sName As String = String.Empty
If sTextList.Count() >= 1 Then sDDFName = Trim(sTextList(0))
If sTextList.Count() >= 2 Then
sName = Trim(MsgControl(sTextList(0), sTextList(1), sErrorList))
Else
sName = sDDFName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sTextList(0), m_CompoType.Path))
End If
' Se ci sono 2 elementi "TextBox; NomeDDF/Nome"
If sItems.Count < 3 Then
NewCompoParam = New TextBoxParam(sDDFName, sName, Me, "0.000", Nothing, Nothing)
If Trim(sItems(0)).EndsWith("d"c) Then
Dim Loc_TextBox_d As TextBoxParam = DirectCast(NewCompoParam, TextBoxParam)
Loc_TextBox_d.bIsLen = False
NewCompoParam = Loc_TextBox_d
End If
' Errore nella lettura {0} nel parametro {1} della componente: non esiste il valore.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50125), sName, m_CompoType.DDFName))
Return True
End If
' recupero il valore di default
Dim dHeight As Double = 500 ' Attenzione ai mm
If Not Trim(sItems(0)).EndsWith("d"c) AndAlso Not ConvertCompoConfig(sItems(2), dHeight) Then
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50147), sName, sItems(2)))
End If
NewCompoParam = New TextBoxParam(sDDFName, sName, Me, sItems(2), Nothing, Nothing)
If Trim(sItems(0)).EndsWith("d"c) Then
Dim Loc_TextBox_d As TextBoxParam = DirectCast(NewCompoParam, TextBoxParam)
Loc_TextBox_d.bIsLen = False
NewCompoParam = Loc_TextBox_d
End If
Return True
Case INI_TEXTBOX_ONOFF, INI_TEXTBOX_ONOFF_D
' NomeDDF e Nome del Text
Dim sTextList() As String = sItems(1).Split("/"c)
Dim sDDFName As String = String.Empty
Dim sName As String = String.Empty
If sTextList.Count() >= 1 Then sDDFName = Trim(sTextList(0))
If sTextList.Count() >= 2 Then
sName = Trim(MsgControl(sTextList(0), sTextList(1), sErrorList))
Else
sName = sDDFName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sTextList(0), m_CompoType.Path))
End If
' Se ci sono 2 elementi "TextBox; NomeDDF/Nome"
If sItems.Count < 3 Then
NewCompoParam = New TextBoxOnOffParam(sDDFName, sName, Me, "0.000", Nothing, Nothing, False)
If Trim(sItems(0)).EndsWith("d"c) Then
Dim Loc_TextBox_d As TextBoxOnOffParam = DirectCast(NewCompoParam, TextBoxOnOffParam)
Loc_TextBox_d.bIsLen = False
NewCompoParam = Loc_TextBox_d
End If
' Errore nella lettura {0} nel parametro {1} della componente: non esiste il valore.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50125), sName, m_CompoType.DDFName))
Return True
End If
Dim nActiveBox As Double = 1
Dim bActiveBox As Boolean = True
If sItems.Count > 3 AndAlso StringToDouble(sItems(3), nActiveBox) AndAlso nActiveBox = 0 Then
bActiveBox = False
End If
' recupero il valore di default
Dim dHeight As Double = 500 ' Attenzione ai mm
If Not Trim(sItems(0)).EndsWith("d"c) AndAlso Not ConvertCompoConfig(sItems(2), dHeight) Then
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50147), sName, sItems(2)))
End If
NewCompoParam = New TextBoxOnOffParam(sDDFName, sName, Me, sItems(2), Nothing, Nothing, bActiveBox)
If Trim(sItems(0)).EndsWith("d"c) Then
Dim Loc_TextBox_d As TextBoxOnOffParam = DirectCast(NewCompoParam, TextBoxOnOffParam)
Loc_TextBox_d.bIsLen = False
NewCompoParam = Loc_TextBox_d
End If
Return True
End Select
Return False
End Function
Public Function ReadParamHardware(sReadLine As String, sHelpParam As String, ByRef NewCompoParam As CompoParam, ByRef sErrorList As String) As Boolean
' Se linea vuota, esco con errore
If String.IsNullOrWhiteSpace(sReadLine) Then
' Empty Line
sErrorList = ConcatErrorString(sErrorList, EgtMsg(50167))
Return False
End If
' Scompongo la linea nelle sue parti
Dim sItems() As String = sReadLine.Split(";"c)
' Devono esserci almeno due parti
If sItems.Count() < 2 Then
' Error reading {0} param in {1} compo: incomplete definition in StdTemplate.ini .
Dim sError As String = String.Format(EgtMsg(50501), m_CompoType.DDFName, sItems(0))
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
' La prima parte definisce la categoria
Select Case Trim(sItems(0))
Case INI_COMBOBOX
' NomeDDF e Nome del combo "ComboBox; LG/geometry name; MortiseHinge/MortiseHinge, LG/LG"
Dim sComboList() As String = sItems(1).Split("/"c)
Dim sDDFName As String = String.Empty
Dim sName As String = String.Empty
If sComboList.Count() >= 1 Then sDDFName = Trim(sComboList(0))
If sComboList.Count() >= 2 Then
sName = Trim(MsgControl(sComboList(0), sComboList(1), sErrorList))
Else
sName = sDDFName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sComboList(0), m_CompoType.Path))
End If
' La combobox deve contenere almeno un elemento "ComboBox; NomeDDF/Nome; NomeDDFItem/NomeItem, ...."
If sItems.Count < 3 Then
' Error reading {0} param in {1} compo: incomplete definition in StdTemplate.ini .
Dim sError As String = String.Format(EgtMsg(50501), sDDFName, m_CompoType.DDFName)
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
' Ricavo i diversi item
Dim sComboItemList() As String = sItems(2).Split(","c)
Dim ComboItemList As New ObservableCollection(Of String)
Dim DDFComboItemList As New ObservableCollection(Of String)
For ItemIndex = 0 To sComboItemList.Count - 1
Dim ComboItem() As String = sComboItemList(ItemIndex).Split("/"c)
' se esiste il NomeDDFItem
If ComboItem.Count >= 1 Then DDFComboItemList.Add(Trim(ComboItem(0)))
' se esiste anche il NomeItem
If ComboItem.Count >= 2 Then
' carico la lista con i nomi
ComboItemList.Add(Trim(MsgControl(ComboItem(0), ComboItem(1), sErrorList)))
Else
' se esiste solo un nome considero sia il nome DDF
ComboItemList.Add(Trim(ComboItem(0)))
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), ComboItem(0), m_CompoType.Path))
End If
Next
' Creo il parametro
NewCompoParam = New ComboBoxParam(sDDFName, sName, Me, ComboItemList, DDFComboItemList, ComboItemList(0), sHelpParam)
Return True
Case INI_COMBOBOX_LUA
' NomeDDF e Nome del combo "ComboBoxLua; LG/geometry name; key1/L; refParam"
Dim sComboList() As String = sItems(1).Split("/"c)
Dim sLuaName As String = String.Empty
Dim sName As String = String.Empty
If sComboList.Count() >= 1 Then sLuaName = Trim(sComboList(0))
If sComboList.Count() >= 2 Then
sName = Trim(MsgControl(sComboList(0), sComboList(1), sErrorList))
Else
sName = sLuaName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sComboList(0), m_CompoType.Path))
End If
' La combobox deve contenere almeno un elemento "ComboBoxLua; NomeDDF/Nome; Key/NomeParametro, ...."
Dim sNameGeometry As String = String.Empty
If sItems.Count < 3 Then
If Not CompoMatch.ReserchInTable(Me.CompoType.DDFName, "", sNameGeometry) Then
' Error reading {0} param in {1} compo: incomplete definition in StdTemplate.ini .
Dim sError As String = String.Format(EgtMsg(50501), sLuaName, m_CompoType.DDFName)
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
End If
' prima chiave di ricerca trovata
If sItems.Count >= 3 Then
Dim sKey1() As String = sItems(2).Split("/"c)
Dim sKeyParamLua As String = String.Empty
Dim sKey1Param As String = String.Empty
If sKey1.Count() >= 1 Then sKey1Param = Trim(sKey1(0))
If sKey1.Count() >= 2 Then
sKeyParamLua = Trim(sKey1(1))
Else
sKeyParamLua = Trim(sKey1(0))
End If
If Not CompoMatch.ReserchInTable(Me.CompoType.DDFName, sKeyParamLua, sNameGeometry) Then
' Error reading {0} param in {1} compo: no matching (look at GeometryNameList.ini) .
Dim sError As String = String.Format(EgtMsg(50502), sLuaName, m_CompoType.DDFName)
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
End If
' cerco la seconda chiave di ricerca (il nome del parametero associato all'utensile - di solito il diametro)
' Bisogna modificare i valori della tabella!
Dim sKey2ParamLua As String = String.Empty
If sItems.Count > 3 Then
Dim sKey2() As String = sItems(3).Split("/"c)
Dim sKey2Param As String = String.Empty
If sKey2.Count() >= 1 Then sKey2Param = Trim(sKey2(0))
End If
' Ricavo i diversi item da CompoMatch.ReserchInTable
If String.IsNullOrEmpty(sNameGeometry) Then
' Error reading {0} param in {1} compo: no matching (look at GeometryNameList.ini) .
Dim sError As String = String.Format(EgtMsg(50502), sLuaName, m_CompoType.DDFName)
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
Dim sComboItemList() As String = sNameGeometry.Split(","c)
Dim ComboItemList As New ObservableCollection(Of String)
Dim LuaComboItemList As New ObservableCollection(Of String)
For ItemIndex = 0 To sComboItemList.Count - 1
ComboItemList.Add(Trim(sComboItemList(ItemIndex)))
LuaComboItemList.Add(Trim("'" & sComboItemList(ItemIndex) & "'"))
Next
' Creo il parametro
NewCompoParam = New ComboBoxParamLua(sLuaName, sName, Me, ComboItemList, LuaComboItemList, ComboItemList(0), sHelpParam, sKey2ParamLua)
Return True
Case INI_COMBOBOX_ONOFF
' NomeDDF e Nome del combo
Dim sComboList() As String = sItems(1).Split("/"c)
Dim sDDFName As String = String.Empty
Dim sName As String = String.Empty
If sComboList.Count() >= 1 Then sDDFName = Trim(sComboList(0))
If sComboList.Count() >= 2 Then
sName = Trim(MsgControl(sComboList(0), sComboList(1), sErrorList))
Else
sName = sDDFName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sComboList(0), m_CompoType.Path))
End If
' La combobox deve contenere almeno un elemento "ComboBox; NomeDDF/Nome; NomeDDFItem/NomeItem, ...."
If sItems.Count < 3 Then
' Error reading {0} param in {1} compo: incomplete definition in StdTemplate.ini .
Dim sError As String = String.Format(EgtMsg(50501), sDDFName, m_CompoType.DDFName)
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
' Ricavo i diversi item
Dim sComboItemList() As String = sItems(2).Split(","c)
Dim ComboItemList As New ObservableCollection(Of String)
Dim DDFComboItemList As New ObservableCollection(Of String)
For ItemIndex = 0 To sComboItemList.Count - 1
Dim ComboItem() As String = sComboItemList(ItemIndex).Split("/"c)
' se esiste il NomeDDFItem
If ComboItem.Count >= 1 Then DDFComboItemList.Add(Trim(ComboItem(0)))
' se esiste anche il NomeItem
If ComboItem.Count >= 2 Then
' carico la lista con i nomi
ComboItemList.Add(Trim(MsgControl(ComboItem(0), ComboItem(1), sErrorList)))
Else
' se esiste solo un nome considero sia il nome DDF
ComboItemList.Add(Trim(ComboItem(0)))
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), ComboItem(0), m_CompoType.Path))
End If
Next
' Creo il parametro
NewCompoParam = New ComboBoxOnOffParam(sDDFName, sName, Me, ComboItemList, DDFComboItemList, ComboItemList(0), sHelpParam)
Return True
Case INI_TEXTBOX
' NomeDDF e Nome del Text
Dim sTextList() As String = sItems(1).Split("/"c)
Dim sLuaName As String = String.Empty
Dim sName As String = String.Empty
If sTextList.Count() >= 1 Then sLuaName = Trim(sTextList(0))
If sTextList.Count() >= 2 Then
sName = Trim(MsgControl(sTextList(0), sTextList(1), sErrorList))
Else
sName = sLuaName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sTextList(0), m_CompoType.Path))
End If
' Se ci sono 2 elementi "TextBox; NomeDDF/Nome"
If sItems.Count < 3 Then
NewCompoParam = New TextBoxParam(sLuaName, sName, Me, "0.000", Nothing, Nothing)
' Errore nella lettura {0} nel parametro {1} della componente: non esiste il valore.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50125), sName, m_CompoType.DDFName))
Return True
End If
' Se ci sono almeno 3 elementi "TextBox; NomeDDF/Nome; inch/4.5000"
' recupero il valore di default
Dim dHeight As Double = 500 ' Attenzione ai mm
Dim dDefaultValue As Double = 0.0
Dim sTypeValue As String = String.Empty
Dim sValue As String = String.Empty
Dim sValueList() As String = sItems(2).Split("/"c)
If sValueList.Count() >= 1 Then sValue = Trim(sValueList(0))
If sValueList.Count() >= 2 Then
sTypeValue = Trim(sValueList(1))
Else
sTypeValue = ConstGen.MM
End If
' a seconda del tipo Eseguo il controllo della variabile
Dim sDefaultValue As String = "0.0"
Select Case sTypeValue
Case ConstGen.VAL_DOUBLE
If StringToDouble(sValue, dDefaultValue) Then
sDefaultValue = DoubleToString(dDefaultValue, 5)
Else
Return False
End If
Case ConstGen.INCHES
' ricevo un valore in Inches
If OptionModule.m_SelectedMeasureUnit = ConstGen.MM Then
' converto il valore caricato in mm
If StringToLen(sValue, dDefaultValue) Then
' restituisco il valore convertito in mm in stringa
sDefaultValue = DoubleToString(dDefaultValue, 4)
Else
' altrimenti esco
Return False
End If
Else
' non deovo convertire il valore caricato perchè è nella stessa unità dell'interfaccia
If StringToDouble(sValue, dDefaultValue) Then
' restituisco il valore convertito in mm in stringa
sDefaultValue = DoubleToString(dDefaultValue, 4)
Else
Return False
End If
End If
ConvertCompoConfig(sDefaultValue, 9999)
Case ConstGen.MM
If Not StringToDouble(sValue, dDefaultValue) Then Return False
' ricevo un numero in mm e lo voglio convertire nell'unità dell'interfaccia
sDefaultValue = LenToString(dDefaultValue, 4)
ConvertCompoConfig(sDefaultValue, 9999)
Case ConstGen.VAL_STRING
sDefaultValue = sValue
Case Else ' il tipo non è tra quelli indicati sopra
' Errore nell'espressione {0}. {1} non associa nulla.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50147), NewCompoParam.Name, sItems(2)))
Return False
End Select
' ConvertCompoConfig(sDefaultValue, 9999)
NewCompoParam = New TextBoxParam(sLuaName, sName, Me, sDefaultValue, Nothing, Nothing, sTypeValue, sHelpParam)
Return True
Case INI_TEXTBOX_ONOFF
' NomeDDF e Nome del Text
Dim sTextList() As String = sItems(1).Split("/"c)
Dim sDDFName As String = String.Empty
Dim sName As String = String.Empty
If sTextList.Count() >= 1 Then sDDFName = Trim(sTextList(0))
If sTextList.Count() >= 2 Then
sName = Trim(MsgControl(sTextList(0), sTextList(1), sErrorList))
Else
sName = sDDFName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sTextList(0), m_CompoType.Path))
End If
' Se ci sono 2 elementi "TextBox; NomeDDF/Nome"
If sItems.Count < 3 Then
NewCompoParam = New TextBoxOnOffParam(sDDFName, sName, Me, "0.000", Nothing, Nothing, sHelpParam)
' Errore nella lettura {0} nel parametro {1} della componente: non esiste il valore.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50125), sName, m_CompoType.DDFName))
Return True
End If
' recupero il valore di default
Dim dHeight As Double = 500 ' Attenzione ai mm
Dim dDefaultValue As Double = 0.0
Dim sTypeValue As String = String.Empty
Dim sValue As String = String.Empty
Dim sValueList() As String = sItems(2).Split("/"c)
If sValueList.Count() >= 1 Then sValue = Trim(sValueList(0))
If sValueList.Count() >= 2 Then
sTypeValue = Trim(sValueList(1))
Else
sTypeValue = ConstGen.MM
End If
' a seconda del tipo Eseguo il controllo della variabile
Dim sDefaultValue As String = "0.0"
Select Case sTypeValue
Case ConstGen.VAL_DOUBLE
If StringToDouble(sValue, dDefaultValue) Then
sDefaultValue = DoubleToString(dDefaultValue, 5)
Else
Return False
End If
Case ConstGen.INCHES
' ricevo un valore in Inches
If OptionModule.m_SelectedMeasureUnit = ConstGen.MM Then
' converto il valore caricato in mm
If StringToLen(sValue, dDefaultValue) Then
' restituisco il valore convertito in mm in stringa
sDefaultValue = DoubleToString(dDefaultValue, 4)
Else
' altrimenti esco
Return False
End If
Else
' non deovo convertire il valore caricato perchè è nella stessa unità dell'interfaccia
If StringToDouble(sValue, dDefaultValue) Then
' restituisco il valore convertito in mm in stringa
sDefaultValue = DoubleToString(dDefaultValue, 4)
Else
Return False
End If
End If
Case ConstGen.MM
If Not StringToDouble(sValue, dDefaultValue) Then Return False
' ricevo un numero in mm e lo voglio convertire nell'unità dell'interfaccia
sDefaultValue = LenToString(dDefaultValue, 4)
Case ConstGen.VAL_STRING
sDefaultValue = sValue
Case Else ' il tipo non è tra quelli indicati sopra
' Errore nell'espressione {0}. {1} non associa nulla.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50147), NewCompoParam.Name, sItems(2)))
Return False
End Select
ConvertCompoConfig(sDefaultValue, 9999)
NewCompoParam = New TextBoxOnOffParam(sDDFName, sName, Me, sDefaultValue, Nothing, Nothing, sTypeValue, sHelpParam)
Return True
'If StringToDouble(sItems(2), dDefaultValue) AndAlso dDefaultValue < dHeight Then
' Dim sDefaultValue As String = DoubleToString(dDefaultValue, 5)
' NewCompoParam = New TextBoxOnOffParam(sDDFName, sName, Me, sDefaultValue, Nothing, Nothing, sHelpParam)
' Return True
'Else
' NewCompoParam = New TextBoxOnOffParam(sDDFName, sName, Me, "0.000", Nothing, Nothing, sHelpParam)
' ' Errore nell'espressione {0}. {1} non associa nulla.
' sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50147), NewCompoParam.Name, sItems(2)))
' Return True
'End If
Case INI_TEXTBOXNGE
' NomeDDF e Nome del Text
Dim sTextList() As String = sItems(1).Split("/"c)
Dim sDDFName As String = String.Empty
Dim sName As String = String.Empty
If sTextList.Count() >= 1 Then sDDFName = Trim(sTextList(0))
If sTextList.Count() >= 2 Then
sName = Trim(MsgControl(sTextList(0), sTextList(1), sErrorList))
Else
sName = sDDFName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sTextList(0), m_CompoType.Path))
End If
' Se ci sono 2 elementi "TextBox; NomeDDF/Nome"
If sItems.Count < 3 Then
NewCompoParam = New TextBoxNgeParam(sDDFName, sName, Me, "", Nothing, Nothing, sHelpParam)
Return True
End If
If Not IsNothing(sItems(2)) Then
NewCompoParam = New TextBoxNgeParam(sDDFName, sName, Me, sItems(2), Nothing, Nothing, sHelpParam)
Return True
Else
NewCompoParam = New TextBoxNgeParam(sDDFName, sName, Me, "", Nothing, Nothing, sHelpParam)
Return True
End If
Case INI_TEXTBOXLUA
' NomeDDF e Nome del Text
Dim sTextList() As String = sItems(1).Split("/"c)
Dim sDDFName As String = String.Empty
Dim sName As String = String.Empty
If sTextList.Count() >= 1 Then sDDFName = Trim(sTextList(0))
If sTextList.Count() >= 2 Then
sName = Trim(MsgControl(sTextList(0), sTextList(1), sErrorList))
Else
sName = sDDFName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sTextList(0), m_CompoType.Path))
End If
' Se ci sono 2 elementi "TextBox; NomeDDF/Nome"
If sItems.Count < 3 Then
NewCompoParam = New TextBoxLuaParam(sDDFName, sName, Me, "", Nothing, Nothing, sHelpParam)
Return True
End If
If Not IsNothing(sItems(2)) Then
NewCompoParam = New TextBoxLuaParam(sDDFName, sName, Me, sItems(2), Nothing, Nothing, sHelpParam)
Return True
Else
NewCompoParam = New TextBoxLuaParam(sDDFName, sName, Me, "", Nothing, Nothing, sHelpParam)
Return True
End If
Case INI_TEXTBOXDGC
' NomeDDF e Nome del Text
Dim sTextList() As String = sItems(1).Split("/"c)
Dim sLuaName As String = String.Empty
Dim sName As String = String.Empty
If sTextList.Count() >= 1 Then sLuaName = Trim(sTextList(0))
If sTextList.Count() >= 2 Then
sName = Trim(MsgControl(sTextList(0), sTextList(1), sErrorList))
Else
sName = sLuaName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sTextList(0), m_CompoType.Path))
End If
' Se ci sono 2 elementi "TextBox; NomeDDF/Nome"
If sItems.Count < 3 Then
NewCompoParam = New TextBoxOnOffParam(sLuaName, sName, Me, "0.000", Nothing, Nothing, sHelpParam)
' Errore nella lettura {0} nel parametro {1} della componente: non esiste il valore.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50125), sName, m_CompoType.DDFName))
Return True
End If
' recupero il valore di default
Dim dHeight As Double = 500 ' Attenzione ai mm
Dim dDefaultValue As Double = 0.0
Dim sTypeValue As String = String.Empty
Dim sValue As String = String.Empty
Dim sValueList() As String = sItems(2).Split("/"c)
If sValueList.Count() >= 1 Then sValue = Trim(sValueList(0))
If sValueList.Count() >= 2 Then
sTypeValue = Trim(sValueList(1))
Else
sTypeValue = ConstGen.MM
End If
' il tipo di parametro che posso accettare è mm o inch
Dim sDefaultValue As String = "0.0"
Select Case sTypeValue
Case ConstGen.INCHES
' ricevo un valore in Inches
If OptionModule.m_SelectedMeasureUnit = ConstGen.MM Then
' converto il valore caricato in mm
If StringToLen(sValue, dDefaultValue) Then
' restituisco il valore convertito in mm in stringa per interfaccia
sDefaultValue = DoubleToString(dDefaultValue, 4)
Else
' altrimenti esco
Return False
End If
Else
' non deovo convertire il valore caricato perchè è nella stessa unità dell'interfaccia
If StringToDouble(sValue, dDefaultValue) Then
' restituisco il valore convertito in mm in stringa per interfaccia
sDefaultValue = DoubleToString(dDefaultValue, 4)
Else
Return False
End If
End If
Case ConstGen.MM
If Not StringToDouble(sValue, dDefaultValue) Then Return False
' ricevo un numero in mm e lo voglio convertire nell'unità dell'interfaccia
sDefaultValue = LenToString(dDefaultValue, 4)
End Select
ConvertCompoConfig(sDefaultValue, 9999)
If sItems.Count < 4 Then
' significa che si comporta come fosse una semplice TextBox
NewCompoParam = New TextBoxParam(sLuaName, sName, Me, sDefaultValue, Nothing, Nothing, sTypeValue, sHelpParam)
Return True
End If
Dim sConst() As String = sItems(3).Split(","c)
Dim sListConst As New List(Of String)
sListConst.Add("0") ' il primo parametro della lista deve essere sempre quello nullo
For Index As Integer = 0 To sConst.Count - 1
If Trim(sConst(Index)) = "0" Then Continue For
sListConst.Add(Trim(sConst(Index)))
Next
NewCompoParam = New TextBoxDGCParam(sLuaName, sName, Me, sDefaultValue, Nothing, Nothing, sListConst, sTypeValue, sHelpParam)
Return True
Case INI_TEXTBOXTHICKNESS
' NomeDDF e Nome del Text
Dim sTextList() As String = sItems(1).Split("/"c)
Dim sLuaName As String = String.Empty
Dim sName As String = String.Empty
If sTextList.Count() >= 1 Then sLuaName = Trim(sTextList(0))
If sTextList.Count() >= 2 Then
sName = Trim(MsgControl(sTextList(0), sTextList(1), sErrorList))
Else
sName = sLuaName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sTextList(0), m_CompoType.Path))
End If
' Se ci sono 2 elementi "TextBox; NomeDDF/Nome"
If sItems.Count < 3 Then
NewCompoParam = New TextBoxOnOffParam(sLuaName, sName, Me, "0.000", Nothing, Nothing, sHelpParam)
' Errore nella lettura {0} nel parametro {1} della componente: non esiste il valore.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50125), sName, m_CompoType.DDFName))
Return True
End If
' recupero il valore di default
Dim dHeight As Double = 500 ' Attenzione ai mm
Dim dDefaultValue As Double = 0.0
Dim sTypeValue As String = String.Empty
Dim sValue As String = String.Empty
Dim sValueList() As String = sItems(2).Split("/"c)
If sValueList.Count() >= 1 Then sValue = Trim(sValueList(0))
If sValueList.Count() >= 2 Then
sTypeValue = Trim(sValueList(1))
Else
sTypeValue = ConstGen.MM
End If
' il tipo di parametro che posso accettare è mm o inch
Dim sDefaultValue As String = "0.0"
Select Case sTypeValue
Case ConstGen.INCHES
' ricevo un valore in Inches
If OptionModule.m_SelectedMeasureUnit = ConstGen.MM Then
' converto il valore caricato in mm
If StringToLen(sValue, dDefaultValue) Then
' restituisco il valore convertito in mm in stringa per interfaccia
sDefaultValue = DoubleToString(dDefaultValue, 4)
Else
' altrimenti esco
Return False
End If
Else
' non deovo convertire il valore caricato perchè è nella stessa unità dell'interfaccia
If StringToDouble(sValue, dDefaultValue) Then
' restituisco il valore convertito in mm in stringa per interfaccia
sDefaultValue = DoubleToString(dDefaultValue, 4)
Else
Return False
End If
End If
Case ConstGen.MM
If Not StringToDouble(sValue, dDefaultValue) Then Return False
' ricevo un numero in mm e lo voglio convertire nell'unità dell'interfaccia
sDefaultValue = LenToString(dDefaultValue, 4)
End Select
ConvertCompoConfig(sDefaultValue, 9999)
Dim sListConst As New List(Of ItemConstThickness)({New ItemConstThickness("thru", -1), New ItemConstThickness("half", -0.5), New ItemConstThickness(OptionModule.m_SelectedMeasureUnit, 0)})
NewCompoParam = New TextBoxThicknessParam(sLuaName, sName, Me, sDefaultValue, Nothing, Nothing, sListConst, sTypeValue, sHelpParam)
Return True
Case INI_CHECKBOX
' NomeDDF e Nome del Text
Dim sTextList() As String = sItems(1).Split("/"c)
Dim sLuaName As String = String.Empty
Dim sName As String = String.Empty
If sTextList.Count() >= 1 Then sLuaName = Trim(sTextList(0))
If sTextList.Count() >= 2 Then
sName = Trim(MsgControl(sTextList(0), sTextList(1), sErrorList))
Else
sName = sLuaName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sTextList(0), m_CompoType.Path))
End If
If sItems.Count < 3 Then
' Errore nella lettura {0} nel parametro {1} della componente: non esiste.
Dim sError As String = String.Format(EgtMsg(50121), sLuaName, m_CompoType.DDFName)
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
Dim nInd As Integer
Dim bCheck As Boolean = False
If Integer.TryParse(sItems(2), nInd) Then
If nInd = 1 Then bCheck = True Else bCheck = False
Else
' Errore nella lettura {0} nel parametro {1} della componente: non esiste il valore.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50125), sName, m_CompoType.DDFName))
End If
NewCompoParam = New CheckBoxParam(sLuaName, sName, Me, bCheck, sHelpParam)
Return True
Case INI_GHOST
' NomeDDF e Nome del Text
Dim sTextList() As String = sItems(1).Split("/"c)
Dim sLuaName As String = String.Empty
Dim sName As String = String.Empty
If sTextList.Count() >= 1 Then sLuaName = Trim(sTextList(0))
If sTextList.Count() >= 2 Then
sName = Trim(MsgControl(sTextList(0), sTextList(1), sErrorList))
Else
sName = sLuaName
End If
If sItems.Count < 3 Then
' Errore nella lettura {0} nel parametro {1} della componente: non esiste.
Dim sError As String = String.Format(EgtMsg(50121), sLuaName, m_CompoType.DDFName, sHelpParam)
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
Dim DefaultValue As String = String.Empty
DefaultValue = Trim(sItems(2))
If String.IsNullOrEmpty(DefaultValue) Then
' Errore nella lettura {0} nel parametro {1} della componente: non esiste.
Dim sError As String = String.Format(EgtMsg(50121), sLuaName, m_CompoType.DDFName)
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
NewCompoParam = New GhostParam(sLuaName, sName, Me, DefaultValue)
Return True
Case "ActiveBox"
' NomeDDF e Nome del Text
Dim sTextList() As String = sItems(1).Split("/"c)
Dim sLuaName As String = String.Empty
Dim sName As String = String.Empty
If sTextList.Count() >= 1 Then sLuaName = Trim(sTextList(0))
If sTextList.Count() >= 2 Then
sName = Trim(MsgControl(sTextList(0), sTextList(1), sErrorList))
Else
sName = sLuaName
' Errore nella lettura del nome {0} in {1}. Attesa una corrispondenza numerica.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50120), sTextList(0), m_CompoType.Path))
End If
If sItems.Count < 3 Then
' Errore nella lettura {0} nel parametro {1} della componente: non esiste.
Dim sError As String = String.Format(EgtMsg(50121), sLuaName, m_CompoType.DDFName)
sErrorList = ConcatErrorString(sErrorList, sError)
Return False
End If
Dim nInd As Integer
Dim bCheck As Boolean = False
If Integer.TryParse(sItems(2), nInd) Then
If nInd = 1 Then bCheck = True Else bCheck = False
Else
' Errore nella lettura {0} nel parametro {1} della componente: non esiste il valore.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50125), sName, m_CompoType.DDFName))
End If
NewCompoParam = New ActivateParam(sLuaName, sName, Me, bCheck, sHelpParam)
Return True
End Select
Return False
End Function
' legge i parametri di default scritti nel file Lua della componente
Public Function ReadDefaultParamLua(sFileNameComplete As String, NewCompo As Compo) As Boolean
If Not LoadDefaultFromLua Then Return False
If String.IsNullOrEmpty(sFileNameComplete) Then Return False
If Not File.Exists(sFileNameComplete) Then Return False
Try
Dim sFileTest() As String = File.ReadAllLines(sFileNameComplete)
Catch ex As Exception
EgtOutLog("Error in reading file " & sFileNameComplete)
Return False
End Try
Dim sFile() As String = File.ReadAllLines(sFileNameComplete)
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 ItemParam In NewCompo.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
If KeyParam <> ItemParam.DDFName Then Continue For
ValueParam = RegexFunction.ParamLine(sFile(LineIndex + ParamIndex), KeyParam)
If String.IsNullOrEmpty(ValueParam) Then Continue For
LoadParamFromLua(ValueParam, ItemParam)
LineIndex = LineIndex + ParamIndex
ParamIndex = 1
Next
End If
Next
Return True
End Function
' Conversione da meta espressione in file lua ad espressione valida in interfaccia
Private Function ConvertFromLua( sValue As String) As String
' sistemo variabili
sValue = sValue.Replace( "(DGD.dW)", "W")
sValue = sValue.Replace( "(DGD.dW/25.4)", "W")
sValue = sValue.Replace( "(DGD.dT)", "T")
sValue = sValue.Replace( "(DGD.dT/25.4)", "T")
sValue = sValue.Replace( "(DGD.dH)", "H")
sValue = sValue.Replace( "(DGD.dH/25.4)", "H")
' elimino inch(...) o mm(...)
sValue = RegexFunction.Brackets(sValue)
' sistemo per unità in interfaccia
Utility.ConvertCurrentUnitMeasure(sValue)
return sValue
End Function
' carico il parametro letto
Private Function LoadParamFromLua(sValue As String, ByRef CurrCompoParam As CompoParam) As Boolean
If TypeOf CurrCompoParam Is TextBoxOnOffParam Then
Dim TempParam As TextBoxOnOffParam = DirectCast(CurrCompoParam, TextBoxOnOffParam)
If Map.refMainWindowVM.SelectedPage <> MainWindowVM.ListPageEnum.nHardwarePage Then
If Not TempParam.EnableCopy Then Return False
End If
Dim sItems() As String = sValue.Split(";"c)
' estraggo il primo valore: -- NomeParamOnOff = inch(0.6); 0
Dim ReadValue As String = ConvertFromLua( sItems(0))
TempParam.SetValue(ReadValue)
' verifico se deve essere attivata
If sItems.Count > 1 AndAlso sItems(1).Trim = "0" Then
TempParam.SetIsActive(False)
Else
TempParam.SetIsActive(True)
End If
TempParam.NotifyPropertyChanged("IsActive")
Return True
ElseIf TypeOf CurrCompoParam Is TextBoxParam Then
Dim TempParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam)
If Map.refMainWindowVM.SelectedPage <> MainWindowVM.ListPageEnum.nHardwarePage Then
If Not TempParam.EnableCopy Then Return False
End If
Dim ReadValue As String = ConvertFromLua( sValue)
TempParam.SetValue(ReadValue)
Return True
ElseIf TypeOf CurrCompoParam Is ComboBoxOnOffParam Then
Dim TempParam As ComboBoxOnOffParam = DirectCast(CurrCompoParam, ComboBoxOnOffParam)
If Map.refMainWindowVM.SelectedPage <> MainWindowVM.ListPageEnum.nHardwarePage Then
If Not TempParam.EnableCopy Then Return False
End If
Dim sItems() As String = sValue.Split(";"c)
' estraggo il primo valore: -- NomeParamOnOff = inch(0.6); 0
sValue = sItems(0)
Dim ReadValue = Trim(sValue)
For Each Item In TempParam.ItemListDDF
If Trim(Item).ToLower = ReadValue.ToLower Then
TempParam.SetSelItem(TempParam.ItemList(TempParam.ItemListDDF.IndexOf(Item)))
' verifico se deve essere attivata
If sItems.Count > 1 Then
If sItems(1).Trim <> "0" Then
TempParam.SetIsActive(True)
Else
TempParam.SetIsActive(False)
End If
Else
TempParam.SetIsActive(True)
End If
TempParam.NotifyPropertyChanged("IsActive")
Exit For
End If
Next
Return True
ElseIf TypeOf CurrCompoParam Is ComboBoxParam Then
Dim TempParam As ComboBoxParam = DirectCast(CurrCompoParam, ComboBoxParam)
If Map.refMainWindowVM.SelectedPage <> MainWindowVM.ListPageEnum.nHardwarePage Then
If Not TempParam.EnableCopy Then Return False
End If
Dim ReadValue = Trim(sValue)
For Each Item In TempParam.ItemList
If Trim(Item) = ReadValue Then
TempParam.SetSelItem(Item)
Exit For
End If
Next
Return True
End If
Return False
End Function
#End Region ' Selezione Template
Private m_TidyParam As String
Public Property TidyParam As String
Get
Return m_TidyParam
End Get
Set(value As String)
m_TidyParam = value
End Set
End Property
Private m_CompoParamList As New ObservableCollection(Of CompoParam)
Public Property CompoParamList As ObservableCollection(Of CompoParam)
Get
Return m_CompoParamList
End Get
Set(value As ObservableCollection(Of CompoParam))
m_CompoParamList = value
End Set
End Property
' Definizione comando
Private m_CmdDelete As ICommand
Private m_CmdReload As ICommand
Private m_CmdGoToHardware As ICommand
' creo una copia dell'oggetto
Sub New(CompoType As CompoType)
m_CompoType = CompoType.DeepCopy()
If OptionModule.ReadOnlyDDF Then IsReadOnly = OptionModule.ReadOnlyDDF
End Sub
' creo un riferiemento all'oggetto
Sub New(CompoType As CompoType, Reference As Boolean)
m_CompoType = CompoType
End Sub
#Region "COMMANDS"
#Region "DeleteCommand"
Public ReadOnly Property DeleteCommand As ICommand
Get
If m_CmdDelete Is Nothing Then
m_CmdDelete = New Command(AddressOf SubDelete)
End If
Return m_CmdDelete
End Get
End Property
Private Sub SubDelete()
Delete(True)
End Sub
Public Sub Delete(Optional RefreshDraw As Boolean = True)
Dim DeleteNameHardware As String = Me.CompoType.Name
Map.refPartPageVM.CurrPart.RemoveCompo(Me)
If RefreshDraw Then Map.refSceneManagerVM.RefreshBtn()
SetModified()
Dim bExist As Boolean = False
' aggiorno lista hardware di quotatura
Map.refDimensioningPanelVM.LoadHardwareDimList()
End Sub
#End Region ' DeleteCommand
#Region "ReloadCompoRef"
Public ReadOnly Property ReloadCompoRefCmd As ICommand
Get
If m_CmdReload Is Nothing Then
m_CmdReload = New Command(AddressOf ReloadCompoRef)
End If
Return m_CmdReload
End Get
End Property
Public Sub ReloadCompoRef()
If Not IsNothing(Map.refAssemblyPageVM) AndAlso Not IsNothing(Map.refAssemblyPageVM.CurrAssembly) Then
' FRAME
If Not IsNothing(Me.refCompoDoor) Then
Dim sSide As String = ""
If Map.refPartPageVM.CurrPart.TypePart.Contains(ConstGen.PART_FRAME_TOP) Then
sSide = "top"
ElseIf Map.refPartPageVM.CurrPart.TypePart.Contains(ConstGen.PART_FRAME_BOTTOM) Then
sSide = "bottom"
End If
' se decido di non sovrascrivere allora devo ricalcoare tutte le compoenti non modificate
Map.refAssemblyPageVM.CurrAssembly.CreateCompoOnJambFromJamb(Me.refCompoDoor, sSide)
' aggiorno la grafica
Map.refSceneManagerVM.RefreshBtn()
Return
End If
' DOOR
' controllo se le componenti sono già state modificate
If Not IsNothing(Me.refJambCompo) Then
' 50551=The current parameters have been modified:
Dim sMsg As String = EgtMsg(50551)
Dim sListParam As String = ""
For Each Param In Me.refJambCompo.CompoParamList
If Param.IsModifingRefCompoParam Then
sListParam &= Param.Name & ", "
Exit For
End If
Next
If Not String.IsNullOrEmpty(sListParam) Then
' 50552=Do you want to overwrite?, 50144=Warning
sMsg = sMsg & sListParam & vbCrLf & EgtMsg(50552)
Select Case MessageBox.Show(sMsg, EgtMsg(50144), MessageBoxButton.YesNoCancel, MessageBoxImage.Warning)
Case MessageBoxResult.Cancel
Return
Case MessageBoxResult.No
If Not IsNothing(Map.refPartPageVM) AndAlso
Not IsNothing(Map.refPartPageVM.CurrPart) Then
Map.refAssemblyPageVM.CurrAssembly.UpDateCurrCompoJamb(Me, Map.refPartPageVM.CurrPart.TypePart, False)
Return
End If
End Select
End If
End If
If Map.refAssemblyPageVM.CurrAssembly.CreateCompoOnJamb(Me, "") Then
' aggiorno la grafica
Map.refSceneManagerVM.RefreshBtn()
Me.VisibilitiReloadBtn = Visibility.Visible
Else
Me.VisibilitiReloadBtn = Visibility.Collapsed
End If
End If
End Sub
#End Region ' ReloadCompoRef
#Region "GoToHardware"
Public ReadOnly Property GoToHardwareCmd As ICommand
Get
If m_CmdGoToHardware Is Nothing Then
m_CmdGoToHardware = New Command(AddressOf GoToHardware)
End If
Return m_CmdGoToHardware
End Get
End Property
Public Sub GoToHardware()
' blocco la posssiblità di aggiornare la parte grafica
DoRefreshCompo = False
Dim sErrorMsg As String = String.Empty
If Not IsNothing(Map.refProjectManagerVM) Then
Map.refProjectManagerVM.GoToHardwarePage()
End If
If Not IsNothing(Map.refCompoPanelVM) And Not IsNothing(m_CompoType) Then
Map.refCompoPanelVM.CompoBtn(m_CompoType)
Dim bBrandExists As Boolean = False
If Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
For Each ItemBrand In m_CompoType.HardwareFolderList
If Trim(ItemBrand.ModelDirGraphic) = Trim(m_SelBrandPart) Then
Map.refHardwarePageVM.CurrHardware.SelBrand = ItemBrand
bBrandExists = True
Exit For
End If
Next
Dim bFileExists As Boolean = False
If bBrandExists Then
For Each ItemFile In Map.refHardwarePageVM.CurrHardware.SelBrand.ModelFileList
If Trim(ItemFile) = Trim(m_SelFile) Then
Map.refHardwarePageVM.CurrHardware.SelTemplate = ItemFile
bFileExists = True
Exit For
End If
Next
Else
sErrorMsg = String.Format(EgtMsg(50565), m_SelBrandPart)
End If
If bBrandExists AndAlso Not bFileExists Then
sErrorMsg = String.Format(EgtMsg(50566), m_SelFile)
End If
End If
End If
DoRefreshCompo = True
If Not IsNothing(Map.refSceneManagerVM) Then
Map.refSceneManagerVM.RefreshBtn()
End If
If Not String.IsNullOrEmpty(sErrorMsg) Then
MessageBox.Show(sErrorMsg, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End If
End Sub
#End Region ' GoToHardware
#End Region 'Commands
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 CompoParam
Implements INotifyPropertyChanged
' è utilizzato solo nell'HardwareManager
Public ReadOnly Property FontStyleParam As String
Get
If CurrCompo.EnableChapter And Not ErrorParameter Then
Return "Normal"
Else
Return "Italic"
End If
End Get
End Property
Public ReadOnly Property ColorParam As String
Get
' se sono nell'HardwareManager gestisco gli errori
If Not IsNothing(Map.refHardwarePageVM) AndAlso
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
If CurrCompo.EnableChapter And Not ErrorParameter Then
NotifyPropertyChanged("FontStyleParam")
Return "Black"
ElseIf CurrCompo.EnableChapter And ErrorParameter Then
NotifyPropertyChanged("FontStyleParam")
Return OptionModule.ColorErrorValue
Else
NotifyPropertyChanged("FontStyleParam")
Return OptionModule.ColorDisableChapter
End If
End If
If m_IsModifingRefCompoParam Then
Return OptionModule.ColorModifyingParamRef
'ElseIf m_MissingParameterInReading Then
' Return OptionModule.ColorMissingParameter
Else
Return OptionModule.ColorErrorValue
End If
End Get
End Property
Public ReadOnly Property ErrorParameter As Boolean
Get
If m_ErrorInReading Or m_MissingParameterInReading Or m_IsModifingRefCompoParam Then
Return True
'NotifyPropertyChanged("ColorParam")
Else
Return False
'NotifyPropertyChanged("ColorParam")
End If
End Get
End Property
' questo parametro deve essere usato solo nelle componeneti del telaio
Private m_IsModifingRefCompoParam As Boolean = False
Public Property IsModifingRefCompoParam As Boolean
Get
Return m_IsModifingRefCompoParam
End Get
Set(value As Boolean)
m_IsModifingRefCompoParam = value
NotifyPropertyChanged("ErrorParameter")
End Set
End Property
Private m_ErrorInReading As Boolean = False
Public Property ErrorInReading As Boolean
Get
Return m_ErrorInReading
End Get
Set(value As Boolean)
m_ErrorInReading = value
NotifyPropertyChanged("ErrorParameter")
End Set
End Property
Private m_MissingParameterInReading As Boolean = False
Public Property MissingParameterInReading As Boolean
Get
Return m_MissingParameterInReading
End Get
Set(value As Boolean)
m_MissingParameterInReading = value
NotifyPropertyChanged("ErrorParameter")
End Set
End Property
Private m_EnableCopy As Boolean = True
Public Property EnableCopy As Boolean
Get
Return m_EnableCopy
End Get
Set(value As Boolean)
m_EnableCopy = value
NotifyPropertyChanged("EnableCopy")
End Set
End Property
Private m_LayerName As String
Public Property LayerName As String
Get
Return m_LayerName
End Get
Set(value As String)
m_LayerName = value
End Set
End Property
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_DDFName As String
Public Property DDFName As String
Get
Return m_DDFName
End Get
Set(value As String)
m_DDFName = value
End Set
End Property
Private m_CurrCompo As Compo
Public Property CurrCompo As Compo
Get
Return m_CurrCompo
End Get
Set(value As Compo)
m_CurrCompo = value
End Set
End Property
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, Optional sLayerName As String = "")
m_DDFName = sDDFName
m_Name = sName
m_CurrCompo = CurrCompo
If String.IsNullOrEmpty(sLayerName) Then
m_LayerName = sDDFName
Else
m_LayerName = sLayerName
End If
End Sub
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 GhostParam
Inherits CompoParam
' Implements INotifyPropertyChanged
Private m_Value As String
Public Property Value As String
Get
Return m_Value
End Get
Set(value As String)
m_Value = value
End Set
End Property
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, sValue As String)
MyBase.New(sDDFName, sName, CurrCompo)
m_Value = sValue
End Sub
'Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
End Class
Public Class TextBoxParam
Inherits CompoParam
' Implements INotifyPropertyChanged
' è utilizzata nel processo di ricalcolo dei parametri sul telaio,
' per eviatre di ripetere la stessa domanda ad ogni digitazione
Private bContinueModify As Boolean = False
' queste due variabili sono di tipo Shared perchè ogni nuova componente deve sapere quale era la precedente selezionata
' questa informazione ha senso soltanto se abbiamo dei riferimenti sul telaio
Shared m_PrecCompoIdCode As String = "-1"
Shared m_PrecNameParam As String = String.Empty
' utilizzata per riconoscere se il valore della text deve essere convertito mm/inch o viceversa
Private m_bIsLen As Boolean = True
Public Property bIsLen As Boolean
Get
Return m_bIsLen
End Get
Set(value As Boolean)
m_bIsLen = value
End Set
End Property
' utilizzato negli Hardware
Private m_TypeVar As String
Public Property TypeVar As String
Get
Return m_TypeVar
End Get
Set(value As String)
m_TypeVar = value
End Set
End Property
' in questa variabile devo salvare il valore calcolato dal Matching.lua
Private m_OrigValue As String
Public Property OrigValue As String
Get
Return m_OrigValue
End Get
Set(value As String)
m_OrigValue = value
End Set
End Property
' questo parametro serve per le componenti sull'anta, nel caso in cui si decida di interrompere il ricalcolo (Cancel)
Private m_PrecValue As String
Public Property PrecValue As String
Get
Return m_PrecValue
End Get
Set(value As String)
m_PrecValue = value
End Set
End Property
Private m_IsReadOnly As Boolean = True
Public Property IsReadOnly As Boolean
Get
Return m_IsReadOnly
End Get
Set(value As Boolean)
m_IsReadOnly = value
End Set
End Property
Friend m_Value As String
Public Property Value As String
Get
Return m_Value
End Get
Set(value As String)
' prima di caricare un nuovo valore, salvo il precedente
m_PrecValue = m_Value
m_Value = value
NotifyPropertyChanged("ToolTipValue")
' per evitare di evideziare tutta la componente come errore
IsModifingRefCompoParam = False
'-----------------------------------------------------
' gestione diversificata errori per DoorCreator e HardwareManager
If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage AndAlso
Not IsNothing(Map.refHardwarePageVM) AndAlso Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
'If Not IsNumeric(ToolTipValue) Then
' ErrorInReading = False
'Else
' ErrorInReading = True
'End If
'NotifyPropertyChanged("ColorParam")
Else
If Not IsNumeric(ToolTipValue) Then
ErrorInReading = True
CurrCompo.ErrorValue = True
Else
ErrorInReading = False
CurrCompo.ErrorValue = False
End If
End If
MissingParameterInReading = False
SetModified()
If Not IsNothing(Map.refAssemblyManagerVM) Then Map.refAssemblyManagerVM.RefreshAssembly(CurrCompo)
NotifyPropertyChanged("ErrorParameter")
'--------------------------------------------------------------------------------------------
' significa che sto modificando una componente del telaio
If Not IsNothing(CurrCompo.refCompoDoor) AndAlso Trim(m_Value) <> Trim(m_OrigValue) Then
Dim dValue As Double
Dim dOrigValue As Double
If Not IsNothing(m_Value) AndAlso Not IsNothing(m_OrigValue) Then
StringToDouble(m_Value, dValue)
StringToDouble(m_OrigValue, dOrigValue)
If dValue <> dOrigValue Then
IsModifingRefCompoParam = True
Else
IsModifingRefCompoParam = False
End If
End If
NotifyPropertyChanged("ErrorParameter")
ElseIf Not IsNothing(CurrCompo.refCompoDoor) AndAlso Trim(m_Value) = Trim(m_OrigValue) Then
IsModifingRefCompoParam = False
NotifyPropertyChanged("ErrorParameter")
End If
If IsNothing(CurrCompo.refJambCompo) Then Return
' se fallisce il caricamento dei parametri esce
If Not LoadCompoParam(CurrCompo, Map.refPartPageVM.CurrPart.TypePart) Then Return
' 50168=No matching param
If Not UpdateParam() Then MessageBox.Show(EgtMsg(50168), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
ResetCompoParam()
' questi due parametri identificano univocamente il parametri modificato
m_PrecCompoIdCode = CurrCompo.IdCode
m_PrecNameParam = DDFName
'---------------------------------------------------------------------------------------------
End Set
End Property
Public Sub SetValue(sValue As String)
m_Value = sValue
NotifyPropertyChanged("Value")
NotifyPropertyChanged("ToolTipValue")
' verifica i valori della configurazione
If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage AndAlso
Not IsNothing(Map.refHardwarePageVM) AndAlso Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
'If Not IsNumeric(ToolTipValue) Then
' ErrorInReading = False
'Else
' ErrorInReading = True
'End If
'NotifyPropertyChanged("ColorParam")
Else
If TypeVar <> ConstGen.VAL_STRING And Not IsNumeric(ToolTipValue) Then
ErrorInReading = True
CurrCompo.ErrorValue = True
End If
NotifyPropertyChanged("ErrorParameter")
If Not String.IsNullOrEmpty(sValue) AndAlso sValue.Trim = "$" Then
EnableCopy = False
m_Value = ""
NotifyPropertyChanged("Value")
End If
End If
End Sub
Public ReadOnly Property ToolTipValue As String
Get
Dim dValue As Double = -1
If StringToDouble(Value, dValue) Then
Return DoubleToString(dValue, 4)
Else
'Invalid expression in {0}.
Return EgtMsg(50143)
End If
End Get
End Property
Private m_ComboValuelList As New List(Of String)
Public Property ComboValuelList As List(Of String)
Get
Return m_ComboValuelList
End Get
Set(value As List(Of String))
m_ComboValuelList = value
End Set
End Property
Private m_ComboBox As ComboBoxParam
Private m_Visibility As Visibility
Public Property Visibility As Visibility
Get
Return m_Visibility
End Get
Set(value As Visibility)
m_Visibility = value
End Set
End Property
' aggiorno il valore dal parametro in funzione della modifica del parametro sull'anta
Public Function UpdateParam() As Boolean
Dim CmpPar As CompoParam = Me
Dim IndexP As Integer = CurrCompo.CompoParamList.IndexOf(Me)
Dim CmpRefPar As CompoParam = CurrCompo.refJambCompo.CompoParamList(IndexP)
For IndexParam As Integer = 0 To CurrCompo.refJambCompo.CompoParamList.Count - 1
If TypeOf CmpRefPar Is TextBoxOnOffParam AndAlso CmpPar.DDFName = CmpRefPar.DDFName Then
Dim TBoxPar As TextBoxOnOffParam = DirectCast(CmpPar, TextBoxOnOffParam)
Dim TBoxRefPar As TextBoxOnOffParam = DirectCast(CmpRefPar, TextBoxOnOffParam)
If TBoxRefPar.IsModifingRefCompoParam Then
' 50551=The current parameters have been modified: , 50552=Do you want to overwrite?
Dim sMsg As String = EgtMsg(50551) & TBoxRefPar.Name
sMsg = sMsg & vbCrLf & EgtMsg(50552)
' se l'IdCode cambia rispetta al precedente significa che sto cambiando Compo
If bContinueModify AndAlso Trim(m_PrecCompoIdCode) = Trim(CurrCompo.IdCode) AndAlso
m_PrecNameParam = TBoxPar.DDFName Then
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
Return True
Else
bContinueModify = False
End If
Select Case MessageBox.Show(sMsg, EgtMsg(50144), MessageBoxButton.YesNoCancel, MessageBoxImage.Warning)
Case MessageBoxResult.No
bContinueModify = True
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
Return True
Case MessageBoxResult.Cancel
TBoxPar.SetValue(m_PrecValue & " ")
Return True
End Select
End If
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
TBoxRefPar.OrigValue = TBoxRefPar.m_Value
' ricalcolo il parametro, perdo le modifiche manuali
TBoxRefPar.IsModifingRefCompoParam = False
TBoxRefPar.SetIsActive(TBoxPar.IsActive)
Return True
ElseIf TypeOf CmpRefPar Is ComboBoxOnOffParam AndAlso CmpPar.DDFName = CmpRefPar.DDFName Then
Dim TBoxPar As ComboBoxOnOffParam = DirectCast(CmpPar, ComboBoxOnOffParam)
Dim TBoxRefPar As ComboBoxOnOffParam = DirectCast(CmpRefPar, ComboBoxOnOffParam)
' calco eventualmente il valore delle combobox che deve essere restituito
'If TBoxRefPar.IsModifingRefCompoParam Then
' Dim sMsg As String = "The current parameters have been modified: " & TBoxRefPar.Name
' sMsg = sMsg & vbCrLf & "Do you want to overwrite?"
' If bContinueModify AndAlso Trim(m_PrecCompoIdCode) = Trim(CurrCompo.IdCode) AndAlso
' m_PrecNameParam = TBoxPar.DDFName Then
' CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.SelItem, TBoxRefPar.OrigItem, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
' Return True
' Else
' bContinueModify = False
' End If
' Select Case MessageBox.Show(sMsg, "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
' Case MessageBoxResult.No
' bContinueModify = True
' CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.SelItem, TBoxRefPar.OrigItem, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
' Return True
' End Select
'End If
TBoxRefPar.SetIsActive(TBoxPar.IsActive)
Return True
ElseIf TypeOf CmpRefPar Is TextBoxParam AndAlso CmpPar.DDFName = CmpRefPar.DDFName Then
Dim TBoxPar As TextBoxParam = DirectCast(CmpPar, TextBoxParam)
Dim TBoxRefPar As TextBoxParam = DirectCast(CmpRefPar, TextBoxParam)
If TBoxRefPar.IsModifingRefCompoParam Then
' 50551=The current parameters have been modified: , 50552=Do you want to overwrite?
Dim sMsg As String = EgtMsg(50551) & TBoxRefPar.Name
sMsg = sMsg & vbCrLf & EgtMsg(50552)
If bContinueModify AndAlso Trim(m_PrecCompoIdCode) = Trim(CurrCompo.IdCode) AndAlso
m_PrecNameParam = TBoxPar.DDFName Then
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
Return True
Else
bContinueModify = False
End If
Select Case MessageBox.Show(sMsg, EgtMsg(50144), MessageBoxButton.YesNoCancel, MessageBoxImage.Warning)
Case MessageBoxResult.No
bContinueModify = True
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.OrigValue, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
Return True
Case MessageBoxResult.Cancel
TBoxPar.SetValue(m_PrecValue & " ")
Return True
End Select
End If
CalcCompoParamValue(TBoxPar.DDFName, TBoxPar.m_Value, TBoxRefPar.m_Value, TBoxRefPar.IsReadOnly, Map.refPartPageVM.CurrPart.TypePart, CurrCompo.ConfigurationParameters, CurrCompo.refJambCompo.ConfigurationParameters)
TBoxRefPar.OrigValue = TBoxRefPar.m_Value
' ricalcolo il parametro, perdo le modifiche manuali
TBoxRefPar.IsModifingRefCompoParam = False
Return True
ElseIf TypeOf CmpRefPar Is ComboBoxParam AndAlso CmpPar.DDFName = CmpRefPar.DDFName Then
DirectCast(CmpRefPar, ComboBoxParam).IsReadOnly = False
Return True
End If
Next
Return False
End Function
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String), Optional ByVal bIsActive As Boolean = true)
MyBase.New(sDDFName, sName, CurrCompo)
If bIsActive then
SetValue( sValue)
Else
ErrorInReading = False
MissingParameterInReading = False
m_Value = sValue
If sValue.Contains("$") then
m_Value = ""
EnableCopy = False
End If
End If
'm_Value = sValue
m_ComboBox = ComboBox
m_ComboValuelList = ComboValuelList
End Sub
' utilizzata per le text degli hardware che possono ricevere diversi tipi di valore
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String), TypeVar As String, Optional sLayerName As String = "")
MyBase.New(sDDFName, sName, CurrCompo, sLayerName)
m_Value = sValue
m_ComboBox = ComboBox
m_ComboValuelList = ComboValuelList
m_TypeVar = TypeVar
End Sub
'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 ComboBoxParam
Inherits CompoParam
' Implements INotifyPropertyChanged
Private m_IsReadOnly As Boolean = True
Public Property IsReadOnly As Boolean
Get
Return m_IsReadOnly
End Get
Set(value As Boolean)
m_IsReadOnly = value
End Set
End Property
' in questa variabile devo salvare il valore calcolato dal Matching.lua
Private m_OrigItem As String
Public Property OrigItem As String
Get
Return m_OrigItem
End Get
Set(value As String)
m_OrigItem = value
End Set
End Property
Private m_ItemList As New ObservableCollection(Of String)
Public Property ItemList As ObservableCollection(Of String)
Get
Return m_ItemList
End Get
Set(value As ObservableCollection(Of String))
m_ItemList = value
NotifyPropertyChanged("ItemList")
End Set
End Property
Private m_ItemListDDF As New ObservableCollection(Of String)
Public Property ItemListDDF As ObservableCollection(Of String)
Get
Return m_ItemListDDF
End Get
Set(value As ObservableCollection(Of String))
m_ItemListDDF = value
NotifyPropertyChanged("ItemListDDF")
End Set
End Property
Friend m_SelItem As String
Public Property SelItem As String
Get
Return m_SelItem
End Get
Set(value As String)
m_SelItem = value
SetModified()
' riconosco la ComboBox corrente
Dim IsGeometryList As Boolean = False
For Each ItemParam In CurrCompo.CompoParamList
If ItemParam.DDFName = DDFName Then
' se il tipo è LUA allora devo ricaricare la listeìa delle geometrie
If TypeOf ItemParam Is ComboBoxParamLua Then
IsGeometryList = True
Exit For
End If
End If
Next
' gestione diversificata errori per DoorCreator e HardwareManager
If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage AndAlso
Not IsNothing(Map.refHardwarePageVM) AndAlso Not IsNothing(Map.refHardwarePageVM.CurrHardware) AndAlso IsGeometryList Then
If Me.CurrCompo.TemplateDDFName <> MATCHING_FILE_TEMPLATE AndAlso Me.CurrCompo.TemplateDDFName <> MATCHING_FILE_TEMPLATE_DOOR Then
' se sono nell'HardwarePage ricarico la lista dei nomi geometrie
Dim CurrList As ObservableCollection(Of String) = Map.refHardwarePageVM.CurrHardware.GetCurrentListGeometry(CurrCompo.CompoType.DDFName, DDFName)
Dim bExistItem As Boolean = False
For IndexItem As Integer = 0 To CurrList.Count - 1
If CurrList(IndexItem) = m_SelItem Then
bExistItem = True
Exit For
End If
Next
If bExistItem Then
ErrorInReading = False
Else
ErrorInReading = True
End If
NotifyPropertyChanged("ColorParam")
End If
Else
If String.IsNullOrEmpty(m_SelItem) Then
ErrorInReading = True
CurrCompo.ErrorValue = True
Else
ErrorInReading = False
CurrCompo.ErrorValue = False
End If
MissingParameterInReading = False
If ErrorInReading = True Then
If Not IsNothing(Map.refAssemblyManagerVM) Then Map.refAssemblyManagerVM.RefreshAssembly(CurrCompo)
End If
End If
NotifyPropertyChanged("ErrorParameter")
' ErrorInReading = False
' CurrCompo.ErrorValue = False
Dim CmpPar As CompoParam = Me
Dim IndexP As Integer = CurrCompo.CompoParamList.IndexOf(Me)
' se il nome della combobox è side ed esiste un riferimento
If CmpPar.DDFName.ToLower = K_SIDE.ToLower AndAlso Map.refMainWindowVM.SelectedPage <> MainWindowVM.ListPageEnum.nHardwarePage Then
' se esiste una componente allora deve essere cancellata per essere nuovamente riposizionata
Dim sSide As String = String.Empty
If Not IsNothing(CurrCompo.refJambCompo) Then Map.refPartPageVM.CurrPart.RemoveCompo(CurrCompo, True)
CurrCompo.LoadDefaultFromLua = False
CurrCompo.SetTemplateSelItem(CurrCompo.TemplateSelItem)
If TypeOf CmpPar Is ComboBoxParam Then
Dim IndexItemDDF As Integer = DirectCast(CmpPar, ComboBoxParam).ItemList.IndexOf(m_SelItem)
If IndexItemDDF > -1 AndAlso
IndexItemDDF <= DirectCast(CmpPar, ComboBoxParam).ItemListDDF(IndexItemDDF).Count - 1 Then
sSide = DirectCast(CmpPar, ComboBoxParam).ItemListDDF(IndexItemDDF)
End If
End If
Map.refAssemblyPageVM.CurrAssembly.CreateCompoOnJamb(CurrCompo, Trim(sSide))
ElseIf CmpPar.DDFName.ToLower = K_SIDE.ToLower AndAlso Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage AndAlso
Not IsNothing(Map.refHardwarePageVM.GenericPart) AndAlso Map.refHardwarePageVM.GenericPart.TypePart.Contains("F") Then
Dim sSide As String = String.Empty
Dim IndexItemDDF As Integer = m_ItemList.IndexOf(m_SelItem)
If IndexItemDDF > -1 AndAlso IndexItemDDF <= m_ItemListDDF(IndexItemDDF).Count - 1 Then
sSide = m_ItemListDDF(IndexItemDDF)
End If
Select Case sSide
Case "bottom"
Map.refHardwarePageVM.GenericPart.TypePart = PART_FRAME_BOTTOM
Case "top"
Map.refHardwarePageVM.GenericPart.TypePart = PART_FRAME_TOP
Case Else
Map.refHardwarePageVM.GenericPart.TypePart = PART_FRAME_LEFT
End Select
End If
' significa che sto modificando una componente del telaio
If Not IsNothing(CurrCompo.refCompoDoor) Then
For Each ItemParam In CurrCompo.refCompoDoor.CompoParamList
If ItemParam.DDFName = Me.DDFName AndAlso TypeOf ItemParam Is ComboBoxParam Then
m_OrigItem = DirectCast(ItemParam, ComboBoxParam).SelItem
Exit For
End If
Next
If Trim(m_SelItem) = Trim(m_OrigItem) Then
IsModifingRefCompoParam = False
Else
IsModifingRefCompoParam = True
End If
NotifyPropertyChanged("ErrorParameter")
End If
' verifico di essere nella configurazione HardwareManager e che la Compo chiamata si chiama "Match File"
If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage AndAlso
(CmpPar.CurrCompo.TemplateDDFName = MATCHING_FILE_TEMPLATE OrElse CmpPar.CurrCompo.TemplateDDFName = MATCHING_FILE_TEMPLATE_DOOR) 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
' recupero l'inidirizzo
Map.refHardwarePageVM.CurrHardware.SelectBrandMatching(Me)
End Select
End If
Map.refSceneManagerVM.RefreshBtn()
End Set
End Property
Friend Sub SetSelItem(value As String)
m_SelItem = value
If String.IsNullOrEmpty(m_SelItem) Then
ErrorInReading = True
CurrCompo.ErrorValue = True
EnableCopy = False
End If
NotifyPropertyChanged("ErrorParameter")
' verifico di essere nella configurazione HardwareManager e che la Compo chiamata si chiama "Match File" MATCHING_FILE_TEMPLATE_DOOR
If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage AndAlso
(Me.CurrCompo.TemplateDDFName = MATCHING_FILE_TEMPLATE OrElse Me.CurrCompo.TemplateDDFName = MATCHING_FILE_TEMPLATE_DOOR) Then
' leggo quale è il nome del parametro che sto caricando
Select Case Me.DDFName
Case ConstCompo.MATCHING_INI
' Sto selezionando un elemento dalla lista "Automatic, None, .."
Dim BrandListFrame As ObservableCollection(Of CompoBrandDir) = Map.refHardwarePageVM.CurrHardware.SelectMatching(Me, Me.CurrCompo)
Map.refHardwarePageVM.CurrHardware.SelectFileMatching(Me, BrandListFrame)
Case ConstCompo.BRAND_INI
Map.refHardwarePageVM.CurrHardware.SelectBrandMatching(Me)
End Select
End If
NotifyPropertyChanged("SelItem")
End Sub
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, ref_ItemList As ObservableCollection(Of String), ref_ItemListDDF As ObservableCollection(Of String), sSelItem As String, Optional sLayerName As String = "")
MyBase.New(sDDFName, sName, CurrCompo, sLayerName)
ItemList = ref_ItemList
ItemListDDF = ref_ItemListDDF
SetSelItem(sSelItem)
End Sub
'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 TextBoxOnOffParam
Inherits TextBoxParam
Private m_IsActive As Boolean = True
Public Property IsActive As Boolean
Get
Return m_IsActive
End Get
Set(value As Boolean)
m_IsActive = value
SetModified()
If m_IsActive then
SetValue ( m_Value)
Else
ErrorInReading = False
CurrCompo.MissingParameter = False
CurrCompo.ErrorValue = False
End If
Map.refSceneManagerVM.RefreshBtn()
End Set
End Property
Public Sub SetIsActive(IsActive As Boolean)
m_IsActive = IsActive
'NotifyPropertyChanged("IsActive")
End Sub
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String), Optional bIsActive As Boolean = True)
MyBase.New(sDDFName, sName, CurrCompo, sValue, ComboBox, ComboValuelList, bIsActive)
m_IsActive = bIsActive
End Sub
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String), Optional TypeVar As String = "", Optional sLayerName As String = "", Optional bIsActive As Boolean = True)
MyBase.New(sDDFName, sName, CurrCompo, sValue, ComboBox, ComboValuelList, TypeVar, sLayerName)
m_IsActive = bIsActive
End Sub
End Class
Public Class TextBoxNgeParam
Inherits TextBoxParam
Private m_IsActive As Boolean = False
Public Property IsActive As Boolean
Get
Return m_IsActive
End Get
Set(value As Boolean)
m_IsActive = value
SetModified()
Map.refSceneManagerVM.RefreshBtn()
End Set
End Property
Public Sub SetIsActive(IsActive As Boolean)
m_IsActive = IsActive
'NotifyPropertyChanged("IsActive")
End Sub
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String), Optional sLayerName As String = "")
MyBase.New(sDDFName, sName, CurrCompo, sValue, ComboBox, ComboValuelList, sLayerName)
End Sub
End Class
Public Class TextBoxLuaParam
Inherits TextBoxParam
Private m_IsActive As Boolean = False
Public Property IsActive As Boolean
Get
Return m_IsActive
End Get
Set(value As Boolean)
m_IsActive = value
SetModified()
Map.refSceneManagerVM.RefreshBtn()
End Set
End Property
Public Sub SetIsActive(IsActive As Boolean)
m_IsActive = IsActive
'NotifyPropertyChanged("IsActive")
End Sub
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String), Optional sLayerName As String = "")
MyBase.New(sDDFName, sName, CurrCompo, sValue, ComboBox, ComboValuelList, sLayerName)
End Sub
End Class
Public Class TextBoxDGCParam
Inherits TextBoxParam
Private m_ConstList As List(Of String)
Public Property ConstList As List(Of String)
Get
Return m_ConstList
End Get
Set(value As List(Of String))
m_ConstList = value
End Set
End Property
Private m_SelConst As String
Public Property SelConst As String
Get
Return m_SelConst
End Get
Set(value As String)
m_SelConst = value
SetModified()
End Set
End Property
Public Sub SetConst(SelConst As String)
m_SelConst = SelConst
NotifyPropertyChanged("SelConst")
End Sub
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String), ConstList As List(Of String), TypeVar As String, Optional sLayerName As String = "")
MyBase.New(sDDFName, sName, CurrCompo, sValue, ComboBox, ComboValuelList, TypeVar, sLayerName)
m_ConstList = ConstList
m_SelConst = m_ConstList(0)
End Sub
End Class
Public Class TextBoxThicknessParam
Inherits TextBoxParam
Private m_ConstList As List(Of ItemConstThickness)
Public Property ConstList As List(Of ItemConstThickness)
Get
Return m_ConstList
End Get
Set(value As List(Of ItemConstThickness))
m_ConstList = value
End Set
End Property
Private m_SelConst As ItemConstThickness
Public Property SelConst As ItemConstThickness
Get
Return m_SelConst
End Get
Set(value As ItemConstThickness)
m_SelConst = value
SetModified()
Map.refSceneManagerVM.RefreshBtn()
If m_SelConst.dValue = 0 Then
IsEnableMeasure = True
Else
IsEnableMeasure = False
End If
End Set
End Property
Public Sub SetConst(SelConst As ItemConstThickness)
m_SelConst = SelConst
If m_SelConst.dValue = 0 Then
IsEnableMeasure = True
Else
IsEnableMeasure = False
End If
NotifyPropertyChanged("SelConst")
End Sub
Private m_IsEnableMeasure As Boolean = True
Public Property IsEnableMeasure As Boolean
Get
Return m_IsEnableMeasure
End Get
Set(value As Boolean)
m_IsEnableMeasure = value
NotifyPropertyChanged("IsEnableMeasure")
End Set
End Property
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, sValue As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String), ConstList As List(Of ItemConstThickness), TypeVar As String, Optional sLayerName As String = "")
MyBase.New(sDDFName, sName, CurrCompo, sValue, ComboBox, ComboValuelList, TypeVar, sLayerName)
m_ConstList = ConstList
m_SelConst = m_ConstList(2)
End Sub
End Class
Public Class CheckBoxParam
Inherits CompoParam
' Implements INotifyPropertyChanged
Private m_IsChecked As Boolean = False
Public Property IsChecked As Boolean
Get
Return m_IsChecked
End Get
Set(value As Boolean)
m_IsChecked = value
SetModified()
Map.refSceneManagerVM.RefreshBtn()
End Set
End Property
Public Sub SetIsChecked(IsChecked As Boolean)
m_IsChecked = IsChecked
NotifyPropertyChanged("IsChecked")
End Sub
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, IsChecked As Boolean, Optional sLayerName As String = "")
MyBase.New(sDDFName, sName, CurrCompo, sLayerName)
m_IsChecked = IsChecked
End Sub
'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 ComboBoxOnOffParam
Inherits ComboBoxParam
Private m_IsActive As Boolean = True
Public Property IsActive As Boolean
Get
Return m_IsActive
End Get
Set(value As Boolean)
m_IsActive = value
SetModified()
If m_IsActive then
SetSelItem(m_SelItem)
Else
ErrorInReading = False
CurrCompo.MissingParameter = False
CurrCompo.ErrorValue = False
End If
Map.refSceneManagerVM.RefreshBtn()
End Set
End Property
Public Sub SetIsActive(IsActive As Boolean)
m_IsActive = IsActive
'If m_IsActive then
' ErrorInReading = True
' CurrCompo.ErrorValue = True
'End If
NotifyPropertyChanged("ErrorParameter")
If String.IsNullOrEmpty(m_SelItem) then
EnableCopy = False
End If
'NotifyPropertyChanged("IsActive")
End Sub
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 bActiveBox As Boolean = True)
MyBase.New(sDDFName, sName, CurrCompo, ItemList, ItemListDDF, sSelItem, sLayerName)
SetIsActive( bActiveBox)
End Sub
End Class
Public Class ComboBoxParamLua
Inherits ComboBoxParam
' serve solo per distinguere le liste che sono caricate da file GeometryNameList.ini
' riceve il nome del parametro associato alla geometria di lavorazione
Private Property m_refParam As String
Public Property refParam As String
Get
Return m_refParam
End Get
Set(value As String)
m_refParam = value
End Set
End Property
Private m_NameWorking As String
Public Property NameWorking As String
Get
Return m_NameWorking
End Get
Set(value As String)
m_NameWorking = value
End Set
End Property
Private m_TypeWorking As String
Public Property TypeWorking As String
Get
Return m_TypeWorking
End Get
Set(value As String)
m_TypeWorking = value
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
End Sub
End Class
Public Class ItemConstThickness
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_dValue As Double
Public Property dValue As Double
Get
Return m_dValue
End Get
Set(value As Double)
m_dValue = value
End Set
End Property
Sub New(Message As String, dVal As Double)
m_Name = Message
m_dValue = dVal
End Sub
End Class
Public Class ActivateParam
Inherits CompoParam
'Implements INotifyPropertyChanged
Private m_IsActivated As Boolean = False
Public Property IsActivated As Boolean
Get
Return m_IsActivated
End Get
Set(value As Boolean)
m_IsChecked = value
SetModified()
Map.refSceneManagerVM.RefreshBtn()
End Set
End Property
Public Sub SetIsActivated(IsActivate As Boolean)
m_IsActivated = IsActivate
NotifyPropertyChanged("IsChecked")
End Sub
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, IsActivate As Boolean, Optional sLayerName As String = "")
MyBase.New(sDDFName, sName, CurrCompo, sLayerName)
m_IsActivated = IsActivate
End Sub
'Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
'Public Sub NotifyPropertyChanged(propName As String)
' RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
'End Sub
End Class