EgtDOORCreator 1.9j5 :

- eliminazione file CurrHardware.lua,
- settaggio delle variabili H,T,W.
This commit is contained in:
Nicola Pievani
2018-10-25 13:12:36 +00:00
parent 642bb47ce0
commit 3d9efec9d2
5 changed files with 49 additions and 242 deletions
+1 -16
View File
@@ -1,11 +1,5 @@
''' <summary>
''' A command whose sole purpose is to
''' relay its functionality to other
''' objects by invoking delegates. The
''' default return value for the CanExecute
''' method is 'true'.
''' </summary>
Public Class Command
Implements ICommand
@@ -18,19 +12,10 @@ Public Class Command
#Region "Constructors"
''' <summary>
''' Creates a new command that can always execute.
''' </summary>
''' <param name="execute">The execution logic.</param>
Public Sub New(ByVal execute As Action(Of Object))
Me.New(execute, Nothing)
End Sub
''' <summary>
''' Creates a new command.
''' </summary>
''' <param name="execute">The execution logic.</param>
''' <param name="canExecute">The execution status logic.</param>
Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object))
If execute Is Nothing Then
Throw New ArgumentNullException("execute")
+20 -202
View File
@@ -227,7 +227,12 @@ Public Class Part
End Property
Public Sub SetHeight(sHeight As String)
m_Height = sHeight
Dim dHeight As Double
If StringToDouble(sHeight, dHeight) Then
EgtLuaSetGlobNumVar("H", dHeight)
End If
NotifyPropertyChanged("Height")
NotifyPropertyChanged("ToolTipEvaluatedHeight")
If Not Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
End If
@@ -265,7 +270,12 @@ Public Class Part
End Property
Public Sub SetWidth(sWidth As String)
m_Width = sWidth
Dim dWidth As Double
If StringToDouble(sWidth, dWidth) Then
EgtLuaSetGlobNumVar("W", dWidth)
End If
NotifyPropertyChanged("Width")
NotifyPropertyChanged("ToolTipEvaluatedWidth")
If Not Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
End If
@@ -303,7 +313,15 @@ Public Class Part
End Property
Public Sub SetThickness(sThickness As String)
m_Thickness = sThickness
Dim dThickness As Double
If StringToDouble(sThickness, dThickness) Then
EgtLuaSetGlobNumVar("T", dThickness)
End If
NotifyPropertyChanged("Thickness")
NotifyPropertyChanged("ToolTipEvaluatedThickness")
If Not Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
End If
End Sub
Public ReadOnly Property ToolTipEvaluatedThickness As String
Get
@@ -986,206 +1004,6 @@ Public Class Part
End Sub
#Region "Questa sezione dovrà essere eliminta!"
''Gestione ComboBox e TextBox di ogni compo della pulsantiera letta da Compo.ini (Assembly)
'Public Function AddRefCompo(CurrCompoType As CompoType, FrameCompoFile As String) As Compo
' ' creo la stringa che contiene la lista degli errori
' Dim ErrorList As String = String.Empty
' ' creo il nuovo compo
' Dim NewCompo As New Compo(CurrCompoType)
' ' Leggo il file ini del componente per vedere se c'è il template: se c'è
' If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME) <> 0 Then
' ' leggo nomi
' Dim Name As String = String.Empty
' Dim DDFName As String = String.Empty
' IniFile.GetPrivateProfileCompoName(S_TEMPLATE, K_NAME, DDFName, Name, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME)
' '-----------------------------------------------------------------------------------------------------------------------------------
' NewCompo.TemplateDDFName = DDFName
' NewCompo.TemplateName = Name
' LoadBrandFileList(NewCompo, True)
' '-----------------------------------------------------------------------------------------------------------------------------------
' Else
' ' nascondo il template
' NewCompo.TemplateVisibility = Visibility.Collapsed
' ' leggo il nome del compo dal file config.ini
' Dim sTemplateName As String = String.Empty
' EgtUILib.GetPrivateProfileString(S_TEMPLATE, K_COMPO, "", sTemplateName, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME)
' If String.IsNullOrWhiteSpace(sTemplateName) Then
' ErrorList &= String.Format(EgtMsg(50122), K_COMPO, NewCompo.TemplateName)
' NewCompo = Nothing
' ElseIf Not File.Exists(CurrCompoType.Path & "\" & sTemplateName & ".lua") Then
' ErrorList &= String.Format(EgtMsg(50122), K_COMPO, NewCompo.TemplateName)
' NewCompo = Nothing
' Else
' NewCompo.TemplateSelItem = sTemplateName
' End If
' End If
' ' raggruppo tutte le componenti che hanno lo stesso nome vicine
' If Not IsNothing(NewCompo) Then
' ' se trova già una componente allora l'inserimento avvien nel ciclo for
' Dim bInsert = False
' Dim CompoIndex = 0
' For CompoIndex = 0 To m_CompoList.Count - 1
' ' inserisco la nuova componente
' If NewCompo.CompoType.DDFName = m_CompoList(CompoIndex).CompoType.DDFName Then
' ' cerco l'ultima componente con lo stesso nome
' Dim Lastindex As Integer = 0
' While CompoIndex + Lastindex < m_CompoList.Count AndAlso NewCompo.CompoType.DDFName = m_CompoList(CompoIndex + Lastindex).CompoType.DDFName
' Lastindex += 1
' End While
' CompoList.Insert(CompoIndex + Lastindex, NewCompo)
' bInsert = True
' Exit For
' End If
' Next
' If Not bInsert Then
' CompoList.Add(NewCompo)
' End If
' End If
' Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
' Return NewCompo
'End Function
'' ha lo scopo di generare una componente sul jamb
'Private Sub BuiltReferenceCompo(NewCompo As Compo)
' ' questa parte viene ignorata se l'oggetto chiamante è un Frame
' If Not IsNothing(Me.m_TypePart) AndAlso Not Me.m_TypePart.Contains(ConstGen.PART_FRAME) Then
' If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly.LeftJamb) Then
' ' costruisco un riferimnto in locale dell'assemblato
' Dim CurrAssembly As Assembly = Map.refAssemblyPageVM.CurrAssembly
' ' il nome del file associato alla componente
' Dim FrameCompoFile As String = String.Empty
' Dim FrameCompoFileConfig As String = String.Empty
' Dim nDoorNbr As Integer = 1
' Int32.TryParse(Map.refAssemblyPageVM.CurrAssembly.DoorNumber, nDoorNbr)
' ' se il file Matching.lua manca nel direttorio allora esco
' If CalcCompoMatching(NewCompo.CompoType.Path, nDoorNbr, NewCompo.TemplateSelItem, FrameCompoFile) AndAlso
' Not String.IsNullOrEmpty(FrameCompoFile) Then
' '------------------------------------------------------------------------------------------------------------------------------------------
' If Not SearchFileConfig(FrameCompoFile, FrameCompoFileConfig) Then
' ' 50144 =Warning
' ' 50166 =Jamb compo does not exist
' MessageBox.Show(EgtMsg(50166), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
' Else
' CreateRefCompo(NewCompo.CompoType, NewCompo, CurrAssembly, FrameCompoFileConfig, FrameCompoFile, Me)
' End If
' End If
' End If
' End If
'End Sub
'' crea la componente di riferimento
'Friend Shared Sub CreateRefCompo(ByRef CurrCompoType As CompoType, ByRef NewCompo As Compo, ByRef CurrAssembly As Assembly, FrameCompoFileConfig As String, FrameCompoFile As String, CurrDoor As Part)
' ' disabilito la costruzione del riferimento
' Assembly.BuiltReffCompo = False
' ' definisco un riferimento ad una variabile che sarà usata nel jamb
' Dim CompoTypeJamb As CompoType
' ' dato il direttorio dove si trova la componente devo ora cercare il file Config.ini per la lettura dei parametri della componente
' Dim FrameCompoNameDDF As String = String.Empty
' Dim FrameCompoName As String = String.Empty
' Dim FrameFolderName As String = FOLDERDIR
' Dim Side As String = String.Empty
' Dim CurrCompoPath As String = FrameCompoFileConfig
' If File.Exists(CurrCompoPath) Then
' ' Name=hinges/50074
' GetPrivateProfileCompoName(ConstCompo.S_COMPO, ConstCompo.K_NAME, FrameCompoNameDDF, FrameCompoName, CurrCompoPath)
' ' FolderName = 50052
' GetPrivateProfileFolderName(S_TEMPLATE, K_FOLDER_NAME, FrameFolderName, CurrCompoPath)
' ' Side = Hinge
' GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, Side, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME)
' ' se non è stata trovata nessuna voce nel file di configurazione ( riferita alla posizione side)
' If String.IsNullOrEmpty(Side) Then
' ' controllo nell'elenco dei parametri se esiste un parametro di tipo Side
' For IndexParam As Integer = 0 To NewCompo.CompoParamList.Count - 1
' If NewCompo.CompoParamList(IndexParam).DDFName.ToLower = K_SIDE.ToLower Then
' Side = DirectCast(NewCompo.CompoParamList(IndexParam), ComboBoxParam).SelItem
' Exit For
' End If
' Next
' End If
' ' ricontrollo che la stringa non sia vuota
' If Not String.IsNullOrEmpty(Side) Then
' Dim FrameCompoDirectory As String
' FrameCompoDirectory = FrameCompoFileConfig.Remove(FrameCompoFileConfig.LastIndexOf("\"))
' CompoTypeJamb = New CompoType(FrameCompoName, FrameCompoNameDDF, FrameCompoDirectory, Side, FrameFolderName)
' ' assegno alla componente sull'anta la sua posizione
' NewCompo.CompoType.SetJambSide(Side)
' Else
' ' se non trovo nessun riferimento per la posizione allora esco
' Return
' End If
' Else
' ' se non trovo nulla nel direttorio indicato
' Return
' End If
' '------------------------------------------------------------------------------------------------------------------------------------------
' Select Case CurrAssembly.DoorNumber
' Case "1"
' ' questo select case serve per gestire la posizione degli hardware sui Jamb
' Select Case CurrCompoType.JambSide.ToLower
' Case SIDE_HINGE
' If CurrAssembly.LeftJamb.Swing.Contains(ConstGen.LOCK) Then
' NewCompo.refJambCompo = CurrAssembly.LeftJamb.AddRefCompo(CompoTypeJamb, FrameCompoFile)
' NewCompo.refJambCompo.IsReadOnly = True
' Else
' NewCompo.refJambCompo = CurrAssembly.RightJamb.AddRefCompo(CompoTypeJamb, FrameCompoFile)
' NewCompo.refJambCompo.IsReadOnly = True
' End If
' Case SIDE_LOCK
' If CurrAssembly.LeftJamb.Swing.Contains(ConstGen.LOCK) Then
' NewCompo.refJambCompo = CurrAssembly.RightJamb.AddRefCompo(CompoTypeJamb, FrameCompoFile)
' NewCompo.refJambCompo.IsReadOnly = True
' Else
' NewCompo.refJambCompo = CurrAssembly.LeftJamb.AddRefCompo(CompoTypeJamb, FrameCompoFile)
' NewCompo.refJambCompo.IsReadOnly = True
' End If
' Case SIDE_TOP
' NewCompo.refJambCompo = CurrAssembly.TopJamb.AddRefCompo(CompoTypeJamb, FrameCompoFile)
' NewCompo.refJambCompo.IsReadOnly = True
' Case SIDE_BOTTOM
' NewCompo.refJambCompo = CurrAssembly.BottomJamb.AddRefCompo(CompoTypeJamb, FrameCompoFile)
' NewCompo.refJambCompo.IsReadOnly = True
' End Select
' Case "2"
' Select Case CurrCompoType.JambSide.ToLower
' Case SIDE_HINGE
' If CurrDoor.TypePart = ConstGen.PART_DO_ & "1" Then
' NewCompo.refJambCompo = CurrAssembly.LeftJamb.AddRefCompo(CompoTypeJamb, FrameCompoFile)
' NewCompo.refJambCompo.IsReadOnly = True
' Else
' NewCompo.refJambCompo = CurrAssembly.RightJamb.AddRefCompo(CompoTypeJamb, FrameCompoFile)
' NewCompo.refJambCompo.IsReadOnly = True
' End If
' Case SIDE_LOCK
' ' significa che le componenrti stanno solo sulle porte
' If CurrDoor.TypePart = ConstGen.PART_DO_ & "1" And Not CurrDoor.Swing.Contains(ConstGen.INACTIVE) Then
' NewCompo.refJambCompo = CurrAssembly.GetArrayPartDoor(1).Door.AddRefCompo(CompoTypeJamb, FrameCompoFile)
' NewCompo.refJambCompo.IsReadOnly = True
' ElseIf CurrDoor.TypePart = ConstGen.PART_DO_ & "2" And Not CurrDoor.Swing.Contains(ConstGen.INACTIVE) Then
' NewCompo.refJambCompo = CurrAssembly.GetArrayPartDoor(0).Door.AddRefCompo(CompoTypeJamb, FrameCompoFile)
' NewCompo.refJambCompo.IsReadOnly = True
' End If
' Case SIDE_TOP
' NewCompo.refJambCompo = CurrAssembly.TopJamb.AddRefCompo(CompoTypeJamb, FrameCompoFile)
' NewCompo.refJambCompo.IsReadOnly = True
' Case SIDE_BOTTOM
' NewCompo.refJambCompo = CurrAssembly.BottomJamb.AddRefCompo(CompoTypeJamb, FrameCompoFile)
' NewCompo.refJambCompo.IsReadOnly = True
' End Select
' End Select
' ' riabilito la costruzion del riferimnto
' Assembly.BuiltReffCompo = True
'End Sub
#End Region
#End Region 'AddCompo
#Region "RemoveCompo"
@@ -1568,13 +1386,13 @@ Public Class Part
If String.IsNullOrWhiteSpace(Height) Then
If Not SearchKey(sLine, K_HEIGHT) Then Return -1
' altrimenti
m_Height = OptionModule.m_Height
SetHeight(OptionModule.m_Height)
Part.FirstReadingEdge = True
' 50141 =Invalid expression in {0}.
' 50159 = Missing parameter in ddf!
MessageBox.Show(String.Format(EgtMsg(50141), ConstIni.K_HEIGHT_INI) & EgtMsg(50159), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Else
m_Height = Height
SetHeight(Height)
End If
Index = NextIndex(Index)
' Thickness
+17 -10
View File
@@ -7,7 +7,8 @@ Imports EgtWPFLib5
Public Class Hardware
Implements INotifyPropertyChanged
Friend Shared FirstSelect As Boolean = True
Friend Shared DoRefresh As Boolean = True
Friend Shared FirstSelection As Boolean = True
Dim bTypeListExist As Boolean = False
Dim m_GroupChapterName As New ObservableCollection(Of String)
Dim ErrorReading As String = String.Empty
@@ -53,6 +54,7 @@ Public Class Hardware
End Get
Set(value As CompoBrandDir)
If SaveControl() = SaveResult.nCancel Then Return
DeleteTempFile()
If Not IsNothing(value) AndAlso Directory.Exists(value.ModelDir) Then
m_SelBrand = value
ElseIf Not IsNothing(value) AndAlso Not Directory.Exists(value.ModelDir) Then
@@ -83,9 +85,8 @@ Public Class Hardware
SelTemplate = String.Empty
End If
Else
SelTemplate = String.Empty
SelTemplate = String.Empty
End If
FirstSelect = True
NotifyPropertyChanged("SelBrand")
End Set
End Property
@@ -135,10 +136,11 @@ Public Class Hardware
End If
NotifyPropertyChanged("VisibilityType")
End If
FirstSelection = True
ReadChapterTemplate() ' Rileggo i parametri del SetTemplate
ReadTemplate(m_SelTemplate) ' Carico i dati del template
Map.refSceneManagerVM.RefreshBtn()
End If
Map.refSceneManagerVM.RefreshBtn() ' Creo un file temporaneo per gestire la grafica
NotifyPropertyChanged("SelTemplate")
NotifyPropertyChanged("TemplateList")
ShowErrorMsg()
@@ -1026,6 +1028,7 @@ Public Class Hardware
#Region "Salvataggio, Duplica, Nuovo, Aggiorna"
Public Function Duplicate(sSelBrand As String, sTemplate As String) As Boolean
DoRefresh = False
If IsNothing(sTemplate) Then
' Missing name of the new template!
MessageBox.Show(EgtMsg(50174), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Exclamation)
@@ -1081,13 +1084,14 @@ Public Class Hardware
End If
Next
' carico le variabili temporanee e aggiorno la grafica (lista dei file e Brand selezionato)
SelBrand = m_HardwareGeneral.HardwareFolderList(IndexModel)
m_SelBrand = m_HardwareGeneral.HardwareFolderList(IndexModel)
TemplateList = Temp_TemplateList
NotifyPropertyChanged("TemplateList")
NotifyPropertyChanged("SelBrand")
' copio il file
Try
File.Copy(OldDirPath, CurrDirPath, True)
m_SelTemplate = sTemplate
Catch ex As System.IO.IOException
MessageBox.Show("Error in copying: " & ex.Message)
' interrompo la copia e la creazione
@@ -1101,10 +1105,12 @@ Public Class Hardware
If m_TemplateList(IndexTempList) = sTemplate Then SelTemplate = m_TemplateList(IndexTempList)
Next
SetLayerName(sTemplate)
DoRefresh = True
Return True
End Function
Public Function NewHardware(sSelBrand As String, sTemplate As String, sType As TypeHardware) As Boolean
DoRefresh = False
' ricostruico il percorso del file nuovo
Dim ModelDir As String = String.Empty
ModelDir = String.Empty
@@ -1189,13 +1195,12 @@ Public Class Hardware
Map.refProjectManagerHardwareVM.IsModified = False
RefreshTemplateListEgtDOORCreator()
TemplateList.Add(sTemplate)
'TemplateList.Add(sTemplate)
For IndexTempList As Integer = 0 To m_TemplateList.Count - 1
' aggiorno la grafica con il valore selzionato tra i template
If m_TemplateList(IndexTempList) = sTemplate Then SelTemplate = m_TemplateList(IndexTempList)
Next
DoRefresh = True
Return True
End Function
@@ -1573,6 +1578,7 @@ Public Class Hardware
End Function
Public Function DeleteHardware() As Boolean
DoRefresh = False
DeleteGeometry()
Dim CurrDirPath As String = CurrPath()
BackupDeletingFile(CurrDirPath)
@@ -1596,6 +1602,7 @@ Public Class Hardware
Catch ex As Exception
End Try
End If
DoRefresh = True
RefreshTemplateListEgtDOORCreator()
NotifyPropertyChanged("TemplateList")
Return True
@@ -1607,8 +1614,8 @@ Public Class Hardware
For Each Param In Compo.CompoParamList
If Param.DDFName.Contains(".CGF") And TypeOf Param Is TextBoxNgeParam Then
Dim Text As TextBoxNgeParam = DirectCast(Param, TextBoxNgeParam)
If Not IsNothing(Text.Value) Then
sGeometryName = Path.GetDirectoryName(Me.CurrPath) & "/" & Text.Value
If Not String.IsNullOrWhiteSpace(Text.Value) Then
sGeometryName = Path.GetDirectoryName(Me.CurrPath) & "\" & Text.Value
BackupDeletingFile(sGeometryName)
If File.Exists(sGeometryName) Then
Try
+2 -2
View File
@@ -72,5 +72,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.9.10.4")>
<Assembly: AssemblyFileVersion("1.9.10.4")>
<Assembly: AssemblyVersion("1.9.10.5")>
<Assembly: AssemblyFileVersion("1.9.10.5")>
+9 -12
View File
@@ -268,10 +268,6 @@ Public Class SceneManagerVM
End Get
End Property
''' <summary>
''' Execute the refresh. This method is invoked by the RefreshBtnCommand.
''' </summary>
'''
Friend Shared nComposeAssembly As Integer = 1
Public Sub RefreshBtn()
' definisco e rimuovo file temporaneo di assemblato
@@ -304,6 +300,7 @@ Public Class SceneManagerVM
EgtDraw()
ShowGraphicError()
ElseIf Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
If Not Hardware.DoRefresh Then Return
If Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
Map.refHardwarePageVM.CurrHardware.RefreshTempHardware()
End If
@@ -330,20 +327,20 @@ Public Class SceneManagerVM
End If
Next
End If
If Hardware.FirstSelect Then
If Hardware.FirstSelection Then
Select Case sSide.ToLower
Case SIDE_HINGE
EgtSetView(VT.ISO_SE)
EgtSetView(VT.ISO_SE, False)
Case SIDE_LOCK
EgtSetView(VT.ISO_SW)
EgtSetView(VT.ISO_SW, False)
Case SIDE_TOP
EgtSetView(VT.ISO_NW)
EgtSetView(VT.ISO_NW, False)
Case SIDE_BOTTOM
EgtSetView(VT.ISO_SW)
EgtSetView(VT.ISO_SW, False)
End Select
Hardware.FirstSelect = False
Hardware.FirstSelection = False
End If
EgtZoomObject(nCurrObject)
EgtZoomObject(nCurrObject, True)
ShowGraphicError()
Return
End If
@@ -351,7 +348,7 @@ Public Class SceneManagerVM
Next
Next
End If
ExecDoors(m_ProjectScene, sTempFile)
ExecDoors(m_ProjectScene, sTempFile, False)
ShowGraphicError()
End If
End Sub