EgtDOORCreator 1.9b2 :

-aggiunta dell'HardwareManager,
-aggiunta della pagina di stampa.
This commit is contained in:
Nicola Pievani
2018-02-14 17:55:48 +00:00
parent 3c2b662cda
commit cbfdc473c2
47 changed files with 4329 additions and 303 deletions
+11 -9
View File
@@ -1706,13 +1706,14 @@ Public Class Assembly
SetRabbetJamb(Map.refAssemblyPageVM.CurrAssembly.RightJamb, sThicknessHead, sOverlapHinge, sLightUp)
End Select
End Sub
Private Sub SetRabbetJamb(ByRef Jamb As Part, sThicknessHead As String, sOverlap As String, sLightUp As String)
Dim CompoListIndex As Integer = CompoPanelVM.CompoTypeList.Count - 1
Dim CompoListIndex As Integer = Map.refCompoPanelVM.CompoTypeList.Count - 1
Dim bRabbet As Boolean = False
Dim IndexCompo As Integer
If Jamb.CompoList.Count > 0 Then
For IndexCompo = 0 To Jamb.CompoList.Count - 1
If Jamb.CompoList(IndexCompo).CompoType.DDFName = CompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then
If Jamb.CompoList(IndexCompo).CompoType.DDFName = Map.refCompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then
If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(0) Then
bRabbet = True
Exit For
@@ -1724,15 +1725,16 @@ Public Class Assembly
SetTopRabbetParam(sThicknessHead, sOverlap, Jamb, IndexCompo, sLightUp)
Else
' lo aggiungo e lo modifico
Jamb.AddNewCompo(CompoPanelVM.CompoTypeList(CompoListIndex))
Jamb.AddNewCompo(Map.refCompoPanelVM.CompoTypeList(CompoListIndex))
SetTopRabbetParam(sThicknessHead, sOverlap, Jamb, Jamb.CompoList.Count - 1, sLightUp)
End If
Else
' lo aggiungo e lo modifico
Jamb.AddNewCompo(CompoPanelVM.CompoTypeList(CompoListIndex))
Jamb.AddNewCompo(Map.refCompoPanelVM.CompoTypeList(CompoListIndex))
SetTopRabbetParam(sThicknessHead, sOverlap, Jamb, 0, sLightUp)
End If
End Sub
Private Sub SetTopRabbetParam(sThicknessHead As String, sOverlapTop As String, ByRef Jamb As Part, IndexCompo As Integer, sLightUp As String)
Dim CurrCompoParam As CompoParam = Jamb.CompoList(IndexCompo).CompoParamList(1)
If TypeOf CurrCompoParam Is TextBoxParam Then
@@ -1867,13 +1869,13 @@ Public Class Assembly
'Dim IndexHinge As Integer = 2
'Dim IndexBottom As Integer = 1
Dim CompoListIndex As Integer = CompoPanelVM.CompoTypeList.Count - 1
Dim CompoListIndex As Integer = Map.refCompoPanelVM.CompoTypeList.Count - 1
Dim bRabbet As Boolean = False
Dim IndexCompo As Integer
If m_Exterior Then
If Jamb.CompoList.Count > 0 Then
For IndexCompo = 0 To Jamb.CompoList.Count - 1
If Jamb.CompoList(IndexCompo).CompoType.DDFName = CompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then
If Jamb.CompoList(IndexCompo).CompoType.DDFName = Map.refCompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then
If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(nIndexSide) Then
bRabbet = True
Exit For
@@ -1884,20 +1886,20 @@ Public Class Assembly
SetHingeRabbetParam(sThicknessDoor, sDeltaT, sOverLap, Jamb, Jamb.CompoList(IndexCompo), nIndexSide)
Else
' lo aggiungo e lo modifico
Dim Local_Compo As Compo = Jamb.AddNewCompo(CompoPanelVM.CompoTypeList(CompoListIndex))
Dim Local_Compo As Compo = Jamb.AddNewCompo(Map.refCompoPanelVM.CompoTypeList(CompoListIndex))
DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).ItemList(nIndexSide)
SetHingeRabbetParam(sThicknessDoor, sDeltaT, sOverLap, Jamb, Local_Compo, nIndexSide)
End If
Else
' lo aggiungo e lo modifico
Dim Local_Compo As Compo = Jamb.AddNewCompo(CompoPanelVM.CompoTypeList(CompoListIndex))
Dim Local_Compo As Compo = Jamb.AddNewCompo(Map.refCompoPanelVM.CompoTypeList(CompoListIndex))
DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Local_Compo.CompoParamList(0), ComboBoxParam).ItemList(nIndexSide)
SetHingeRabbetParam(sThicknessDoor, sDeltaT, sOverLap, Jamb, Local_Compo, nIndexSide)
End If
'
Else
For IndexCompo = 0 To Jamb.CompoList.Count - 1
If Jamb.CompoList(IndexCompo).CompoType.DDFName = CompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then
If Jamb.CompoList(IndexCompo).CompoType.DDFName = Map.refCompoPanelVM.CompoTypeList(CompoListIndex).DDFName Then
If DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).SelItem = DirectCast(Jamb.CompoList(IndexCompo).CompoParamList(0), ComboBoxParam).ItemList(nIndexSide) Then
bRabbet = True
Exit For
+4
View File
@@ -61,10 +61,12 @@ Public Class AssemblyManagerVM
NewAssName.SelAssembly.GetArrayPartDoor(0).Door.SwingTypeList = OptionModule.m_SwingTypeList
DdfFile.WriteDDFPart(NewAssName.SelAssembly.GetArrayPartDoor(0).Door, sTempFile, False, False)
ExecDoors(Map.refSceneManagerVM.ProjectScene, sTempFile)
EgtZoom(ZM.ALL)
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage
Else
DdfFile.WriteDDFAssembly(NewAssName.SelAssembly, sTempFile, False)
ExecDoors(Map.refSceneManagerVM.ProjectScene, sTempFile)
EgtZoom(ZM.ALL)
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage
End If
Return
@@ -108,10 +110,12 @@ Public Class AssemblyManagerVM
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then
DdfFile.WriteDDFPart(OpenedAssName.SelAssembly.GetArrayPartDoor(0).Door, sTempFile, True, False)
ExecDoors(Map.refSceneManagerVM.ProjectScene, sTempFile)
EgtZoom(ZM.ALL)
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage
Else
DdfFile.WriteDDFAssembly(OpenedAssName.SelAssembly, sTempFile, True)
ExecDoors(Map.refSceneManagerVM.ProjectScene, sTempFile)
EgtZoom(ZM.ALL)
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage
End If
Return True
+9
View File
@@ -22,11 +22,20 @@ Public Class AssemblyName
End Get
Set(value As Boolean)
m_IsModified = value
If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
If m_IsModified Then
Map.refMainWindowVM.ProjectNameMsg = "HarwareManager *"
Else
Map.refMainWindowVM.ProjectNameMsg = "HarwareManager"
End If
Return
End If
If m_IsModified Then
If Not m_GraphicName.Contains("*") Then m_GraphicName &= "*"
Else
m_GraphicName = Path.GetFileNameWithoutExtension(m_Name)
End If
NotifyPropertyChanged("GraphicName")
End Set
End Property
+36 -1
View File
@@ -131,10 +131,45 @@ Module CompoMatch
Return True
End Function
Friend Function ResetCompoParam() As Boolean
Friend Function ResetHMD() As Boolean
EgtLuaResetGlobVar("STU")
Return True
End Function
Friend Function LoadTableGeometry() As Boolean
EgtLuaCreateGlobTable("HMD")
Dim sLuaPath As String = IniFile.m_CompoDir & "\TabellaLua.lua"
' Verifico esistenza file Matching nel direttorio passato
If Not File.Exists(sLuaPath) Then
EgtOutLog("Matching error: missing file (" & sLuaPath & ")")
Return False
End If
' Parsing
If Not EgtLuaExecFile(sLuaPath) Then
EgtOutLog("Matching error: executing file (" & sLuaPath & ")")
Return False
End If
Return True
End Function
Friend Function ReserchInTable(sNameHardware As String, sNameParamLua As String, ByRef sNameGeometry As String) As Boolean
' Assegno dati parametro
EgtLuaSetGlobStringVar("HMD.HardwareName", sNameHardware)
EgtLuaSetGlobStringVar("HMD.Parameter", sNameParamLua)
If Not EgtLuaCallFunction("HMD.RicercaNellaTabella") Then
EgtOutLog("Error in HMD.RicercaNellaTabella")
Return False
End If
' Recupero stato di visualizzazione
EgtLuaGetGlobStringVar("HMD.GeometryName", sNameGeometry)
Return True
End Function
Friend Function ResetCompoParam() As Boolean
EgtLuaResetGlobVar("HMD")
Return True
End Function
End Module
+58
View File
@@ -0,0 +1,58 @@
<UserControl x:Class="CompoPanelHardwareV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtDOORCreator="clr-namespace:EgtDOORCreator">
<UserControl.InputBindings>
<KeyBinding Key="Enter" Command="{Binding RefreshCmd}"/>
</UserControl.InputBindings>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="16*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ItemsControl ItemsSource="{Binding CompoTypeList}" Focusable="True"
Visibility="{Binding IsVisible}">
<ItemsControl.InputBindings>
<KeyBinding Key="Enter" Command="{Binding RefreshCmd}"/>
</ItemsControl.InputBindings>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="1"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton GroupName="DoorGroup"
Style="{StaticResource {x:Type ToggleButton}}"
CommandParameter="{Binding}"
Command="{Binding DataContext.CompoBtnCommand,
RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
IsChecked="{Binding IsSelectedBtn}">
<RadioButton.Content>
<TextBlock Text="{Binding Name}"/>
</RadioButton.Content>
</RadioButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Grid.Row="1"
Name="GoToAssembly"
Command="{Binding DataContext.GoToAssemblyBtnCommand,
RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
CommandParameter="{Binding}"
Visibility="{Binding GoBackVisibility}"
MaxHeight="40"
Focusable="False">
<Image Source="/Resources/Refresh/BackArrow.png" Stretch="Uniform"/>
</Button>
</Grid>
</UserControl>
+3
View File
@@ -0,0 +1,3 @@
Public Class CompoPanelHardware
End Class
+54 -17
View File
@@ -6,14 +6,16 @@ Imports System.IO
Public Class CompoPanelVM
Implements INotifyPropertyChanged
Private m_PageName As String = String.Empty
Public ReadOnly Property GoToAssembly As String
Get
Return "GoToAssembly"
End Get
End Property
Private Shared m_CompoTypeList As New ObservableCollection(Of CompoType)
Public Shared ReadOnly Property CompoTypeList As ObservableCollection(Of CompoType)
Private m_CompoTypeList As New ObservableCollection(Of CompoType)
Public ReadOnly Property CompoTypeList As ObservableCollection(Of CompoType)
Get
Return m_CompoTypeList
End Get
@@ -47,8 +49,11 @@ Public Class CompoPanelVM
' definizione comando
Private m_EnterRefreshCmd As ICommand
Sub New()
Map.SetRefCompoPanelVM(Me)
Sub New(Page As String)
m_PageName = Page
'Map.SetRefCompoPanelVM(Me)
'Map.SetRefCompoPaneHardwarelVM(Me)
If m_CompoTypeList.Count > 0 Then Return ' se la lista è già caricata esco (Lista di tipo shared)
Dim IndexCompoOrder = 0
' Lettura file ini per generare bottoni
Dim Index As Integer = 1
@@ -72,6 +77,7 @@ Public Class CompoPanelVM
GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, Side, CurrCompoPath)
If CompoPanelList(IndexCompoOrder) = CompoNameDDF Then
m_CompoTypeList.Add(New CompoType(CompoName, CompoNameDDF, CompoArray(Index), Side))
' aggiungere il caricamento delle liste
Exit For
End If
End If
@@ -103,19 +109,43 @@ Public Class CompoPanelVM
'''
Public Sub CompoBtn(param As Object)
Dim m_CurrCompoType As CompoType = DirectCast(param, CompoType)
If Not IsNothing(Map.refPartPageVM.CurrPart) Then
Dim NewCompo As Compo = Map.refPartPageVM.CurrPart.AddNewCompo(m_CurrCompoType)
' appena aggiungo una componente nuova calcolo le sue componenti correttamente modificate
If Not IsNothing(NewCompo.refJambCompo) Then
If Not LoadCompoParam(NewCompo, Map.refPartPageVM.CurrPart.TypePart) Then Return
Map.refAssemblyPageVM.CurrAssembly.UpDateCurrCompoJamb(NewCompo)
ResetCompoParam()
' distinguo il modo di caricare il i valori a secondo della pagina aperta
If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
' devo controllare se devo salvare le modifiche fatte
If Not IsNothing(Map.refHardwarePageVM) Then ' se la pagina è aperta
If Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then ' se un hardware esiste
If Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nCancel Then Return ' controllo se devo salvare le modifiche
End If
' selezione il nuovo Hardware
Dim m_CurrCompoType As CompoType = DirectCast(param, CompoType)
For IndexCompoType As Integer = 0 To Map.refCompoPanelHardwareVM.CompoTypeList.Count - 1
If m_CurrCompoType.Name <> Map.refCompoPanelHardwareVM.CompoTypeList(IndexCompoType).Name Then
Map.refCompoPanelHardwareVM.CompoTypeList(IndexCompoType).IsSelectedBtn = False
End If
Next
' ogni volta che clicco il bottone definisco un nuovo Hardware
Map.refHardwarePageVM.CurrHardware = New Hardware
Map.refHardwarePageVM.VisibilityGeneral = Visibility.Visible
Map.refHardwarePageVM.CurrHardware.LoadTemplate(m_CurrCompoType)
End If
'------------------------------------------------------------------------------------------------------------------------------
Else ' se non sono nella configurazione Hardware
Dim m_CurrCompoType As CompoType = DirectCast(param, CompoType)
m_CurrCompoType.LoadListTemplate()
If Not IsNothing(Map.refPartPageVM.CurrPart) Then
Dim NewCompo As Compo = Map.refPartPageVM.CurrPart.AddNewCompo(m_CurrCompoType)
' appena aggiungo una componente nuova calcolo le sue componenti correttamente modificate
If Not IsNothing(NewCompo.refJambCompo) Then
If Not LoadCompoParam(NewCompo, Map.refPartPageVM.CurrPart.TypePart) Then Return
Map.refAssemblyPageVM.CurrAssembly.UpDateCurrCompoJamb(NewCompo)
ResetCompoParam()
End If
Map.refSceneManagerVM.RefreshBtn()
Else
MessageBox.Show(EgtMsg(50108), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Exclamation)
End If
Map.refSceneManagerVM.RefreshBtn()
Else
MessageBox.Show(EgtMsg(50108), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Exclamation)
End If
End Sub
#End Region ' CompoBtnCommand
@@ -140,8 +170,15 @@ Public Class CompoPanelVM
'''
Public Sub GoToAssemblyBtn(param As Object)
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage
Map.refSceneManagerVM.RefreshBtn()
If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage
Map.refSceneManagerVM.RefreshBtn()
Else
Map.refCompoPanelVM.GoBackVisibility = Visibility.Collapsed
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage
Map.refSceneManagerVM.RefreshBtn()
End If
End Sub
#End Region ' GoToAssemblyBtnCommand
+43 -1
View File
@@ -1,4 +1,22 @@
Public Class CompoType
Imports System.IO
Imports System.Collections.ObjectModel
Imports EgtWPFLib5
Public Class CompoType
Inherits VMBase
Public Brand As New ObservableCollection(Of CompoBrandDir)
Private m_IsSelectedBtn As Boolean = False
Public Property IsSelectedBtn As Boolean
Get
Return m_IsSelectedBtn
End Get
Set(value As Boolean)
m_IsSelectedBtn = value
NotifyPropertyChanged("IsSelectedBtn")
End Set
End Property
Private m_Name As String
Public ReadOnly Property Name As String
@@ -40,11 +58,35 @@
m_JambSide = JambSide
End Sub
' 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
Public Function LoadListTemplate() As Boolean
Brand.Clear()
GetDirectoryCompoModel(m_Path, Brand)
If Brand.Count > 0 Then
For IndexModel As Integer = 0 To Brand.Count - 1
m_BrandListPart.Add(Brand(IndexModel).ModelDirGraphic)
Next
End If
Return True
End Function
Sub New(sName As String, sDDFName As String, sPath As String, sJambSide As String)
m_Name = sName
m_DDFName = sDDFName
m_Path = sPath
m_JambSide = sJambSide
LoadListTemplate()
End Sub
End Class
+4
View File
@@ -58,6 +58,7 @@ Module ConstCompo
Public Const S_POSITIONSIDE As String = "PositionSide"
Public Const K_SIDE As String = "Side"
Public Const S_GR_PARAM_DEFAULT = "Graphic parameters"
Public Const S_GR_PARAM_HARDWARE = "Parameters"
Public Const K_PARAM As String = "Param"
' Alcune stringhe notevoli dei file DDF
@@ -76,6 +77,9 @@ Module ConstCompo
Public Const LUA_EXTENSION As String = ".lua"
Public Const NGE_EXTENSION As String = ".nge"
' Layer
Public Const DIM_HINGE As String = "DIM_HINGE"
Public Const DIM_DOOR As String = "DIM_DOOR"
' Nome file di matching tra componenti su ante e telaio
Public Const MATCHING_FILE_NAME As String = "Matching.lua"
+1
View File
@@ -43,6 +43,7 @@ Module ConstGen
Public Const TEMPLATE_DIR As String = "Template"
' File ddf utilizzato per il disegno corrente (porta, assemblato, singola parte)
Public Const TEMP_FILE As String = "CurrPart.ddf"
Public Const TEMP_FILE_HARDWARE As String = "CurrHardware.lua"
' File con gli errori della parte di disegno (lua)
Public Const TEMP_PART_TXT As String = "CurrPart.txt"
End Module
+1
View File
@@ -28,6 +28,7 @@ Module ConstIni
Public Const K_RUNAS As String = "RunAs"
Public Const K_DISPOSITION As String = "Disposition"
Public Const K_SMARTHELP As String = "SmartHelp"
Public Const K_DISABLEHM As String = "DisableHM"
Public Const S_LANGUAGES As String = "Languages"
Public Const K_LANGUAGE As String = "Language"
+14
View File
@@ -0,0 +1,14 @@
Public Class SplitConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Dim dValue As Double = CDbl(value)
Dim dParam As Double = CDbl(parameter)
Return dValue / dParam
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException
End Function
End Class
+4 -2
View File
@@ -1,8 +1,10 @@
Public Class TemplateListConverter
Imports System.Collections.ObjectModel
Public Class TemplateListConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Dim TemplateList As List(Of String) = DirectCast(value, List(Of String))
Dim TemplateList As ObservableCollection(Of String) = DirectCast(value, ObservableCollection(Of String))
For Index = TemplateList.Count - 1 To 0 Step -1
Dim Template As String = TemplateList(Index)
If Not Map.refPartPageVM.CurrPart.TypePart.Contains("F") Then
+255
View File
@@ -268,6 +268,261 @@ Friend Module DdfFile
End If
End Sub
' la funzione è quasi identica alla precedente per piccole differenze (evito di richiamare dei riferimenti all'assemblato)
Friend Sub WriteDDFPartForTestHardware(Part As Part, sPath As String, bIsDDF As Boolean, bIsForAssembly As Boolean)
DDFIsCorrect = False
' pulisco lista prima di iniziare a scrivere
Dim DdfFileContent As New List(Of String)
' quindi significa che non è mai stato caricato il valore
DdfFileContent.Add("#EGTDOORCREATOR")
If Not IsNothing(Part.TypePart) Then
DdfFileContent.Add("#" & PrintTitleDDFPart(Part.TypePart))
End If
DdfFileContent.Add("")
DdfFileContent.Add("produce: " & If(Part.IsActive, "true", "false"))
'Genero una lista di stringhe
DdfFileContent.Add("")
If IsNothing(Part.Measure) Then Part.Measure = ConvertMmUnitsToString(OptionModule.m_bIsMmUnit)
DdfFileContent.Add(ConstCompo.S_MEASURES & ": " & Part.Measure)
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then
Part.Code = "TestDoorHardware"
DdfFileContent.Add(ConstCompo.S_CODE & ": " & Part.Code)
DdfFileContent.Add("")
ElseIf Not IsNothing(Part.TypePart) And OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
Part.Code = " " & PrintTitleDDFPart(Part.TypePart)
DdfFileContent.Add(ConstCompo.S_CODE & ": " & Part.Code)
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
ElseIf IsNothing(Part.TypePart) And OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
DdfFileContent.Add(ConstCompo.S_CODE & ": " & "1111")
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
End If
DdfFileContent.Add(ConstCompo.S_ORDER & ":")
' Probabilmente da cambiare
If Not IsNothing(Part.Customer) Then
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_CUSTOMER & ": " & Part.Customer)
Else
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_CUSTOMER & ": ")
End If
If Not IsNothing(Part.Elevation) Then
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_ELEVATION & ": " & Part.Elevation)
Else
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_ELEVATION & ": ")
End If
If Not IsNothing(Part.Project) Then
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_PROJECT & ": " & Part.Project)
Else
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_PROJECT & ": ")
End If
If Not IsNothing(Part.PO) Then
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_PO & ": " & Part.PO)
Else
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_PO & ": ")
End If
If Not IsNothing(Part.Line) Then
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_LINE & ": " & Part.Line)
Else
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_LINE & ": ")
End If
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
DdfFileContent.Add(ConstCompo.S_DATE & ":" & " " & System.DateTime.Now.ToString("dd/MM/yyyy"))
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
' è specificato il tipo significa che abbiamo un assemblato
DdfFileContent.Add("piece: " & Part.TypePart)
DdfFileContent.Add("")
''-------------------------------------------------------------------------------------------------------------------------
'' non ho considerato di fare componento da inserire sui jamb
'' posizionamento porte
'If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
' If Not IsNothing(Part.TypePart) Then
' ' il posizionamento della prima porta sta nell'origine
' If Part.TypePart = "DO_1" Then
' DdfFileContent.Add("position: ")
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "x: " & "0")
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "y: " & "0")
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "z: " & "0")
' ElseIf Part.TypePart = "DO_2" Then
' ' si trova traslata verso destra dello spessore DO_1 sommato a LightLock"
' Dim x_DO_1 As Double
' Dim dLightLock As Double
' StringToDouble(Map.refAssemblyPageVM.CurrAssembly.GetArrayPartDoor(0).Door.Width, x_DO_1)
' StringToDouble(Map.refAssemblyPageVM.CurrAssembly.LightLock, dLightLock)
' Dim x As String = DoubleToString(x_DO_1 + dLightLock, 4)
' DdfFileContent.Add("position: ")
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "x: " & x)
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "y: " & "0")
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "z: " & "0")
' ' Jamb Sinistro serratura
' ElseIf Part.TypePart.Contains("FL_") Then
' Dim x As String = PositionJamb_X(Part)
' Dim y As String = PositionJamb_Y(Part)
' Dim z As String = PositionJamb_Z(Part)
' DdfFileContent.Add("position: ")
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "x: " & x)
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "y: " & y)
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "z: " & z)
' ElseIf Part.TypePart.Contains("FR_") Then
' DdfFileContent.Add("position: ")
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "x: " & PositionJamb_X(Part))
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "y: " & PositionJamb_Y(Part))
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "z: " & PositionJamb_Z(Part))
' ElseIf Part.TypePart.Contains("FT_") Then
' DdfFileContent.Add("position: ")
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "x: " & PositionJamb_X(Part))
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "y: " & PositionJamb_Y(Part))
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "z: " & PositionJamb_Z(Part))
' ElseIf Part.TypePart.Contains("FB_") Then
' DdfFileContent.Add("position: ")
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "x: " & PositionJamb_X(Part))
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "y: " & PositionJamb_Y(Part))
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & "z: " & PositionJamb_Z(Part))
' End If
' DdfFileContent.Add("")
' End If
'End If
''-------------------------------------------------------------------------------------------------------------------------
Dim dVal As Double = 0
DdfFileContent.Add(ConstCompo.S_SIZE & ":")
If Not StringToDouble(Part.Width, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_WIDTH), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_WIDTH & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_WIDTH & ": " & Part.Width)
End If
End If
If Not StringToDouble(Part.Height, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_HEIGHT), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_HEIGHT & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_HEIGHT & ": " & Part.Height)
End If
End If
If Not StringToDouble(Part.Thickness, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_THICKNESS), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_THICKNESS & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_THICKNESS & ": " & Part.Thickness)
End If
End If
'' aggiungo il peso della porta
'If Part.IsCheckedWeight = Visibility.Visible Then
' If Not StringToDouble(Part.Weight, dVal) Then
' MessageBox.Show(String.Format(EgtMsg(50141), S_WEIGHT), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
' Return
' Else
' If bIsDDF Then
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.S_WEIGHT & ": " & DoubleToString(dVal, 5))
' Else
' DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.S_WEIGHT & ": " & Part.Weight)
' End If
' End If
' DdfFileContent.Add("")
' DdfFileContent.Add(ConstCompo.S_WEIGHT & ": " & Part.Weight)
'End If
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
DdfFileContent.Add("" & ConstCompo.S_SWING & ": " & Part.Swing)
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
'----------------------------------------------------------------------------------------------------------------------------------------------------
' aggiungo il secure nullo al DDF
If Part.TypePart.Contains("DO_") Then
DdfFileContent.Add("" & ConstCompo.S_SECURE & ": " & SetSecure(Part.Swing, Part.DispositionItem.Name, Part.Secure))
' aggiungo una riga vuota per separare la lista successiva
Else
DdfFileContent.Add("" & ConstCompo.S_SECURE & ": " & "DN")
End If
DdfFileContent.Add("")
'----------------------------------------------------------------------------------------------------------------------------------------------------
DdfFileContent.Add("" & ConstCompo.S_PROFILES & ":")
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_LOCKEDGE & ": " & SetBevel(Part.TypePart, Part.LockEdgeType.Name, Part.DispositionItem.Name, Part.Swing))
DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.LockEdgeMachining))
If Not StringToDouble(Part.LockEdgeOverMaterial, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_LOCKEDGEOVERMATERIAL_INI), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & Part.LockEdgeOverMaterial)
End If
End If
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_HINGEEDGE & ": " & SetBevel(Part.TypePart, Part.HingeEdgeType.Name, Part.DispositionItem.Name, Part.Swing))
DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.HingeEdgeMachining))
If Not StringToDouble(Part.HingeEdgeOverMaterial, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_HINGEDGEOVERMATERIAL_INI), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & Part.HingeEdgeOverMaterial)
End If
End If
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_TOP & ": " & SetBevel(Part.TypePart, Part.TopType.Name, Part.DispositionItem.Name, Part.Swing))
DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.TopMachining))
If Not StringToDouble(Part.TopOverMaterial, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_TOPOVERMATERIAL_INI), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & Part.TopOverMaterial)
End If
End If
DdfFileContent.Add(ConstCompo.DDF_SPACE3 & ConstCompo.K_BOTTOM & ": " & SetBevel(Part.TypePart, Part.BottomType.Name, Part.DispositionItem.Name, Part.Swing))
DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Part.BottomMachining))
If Not StringToDouble(Part.BottomOverMaterial, dVal) Then
MessageBox.Show(String.Format(EgtMsg(50141), K_BOTTOMOVERMATERIAL_INI), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Return
Else
If bIsDDF Then
DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & DoubleToString(dVal, 5))
Else
DdfFileContent.Add(ConstCompo.DDF_SPACE5 & ConstCompo.K_OVERMATERIAL & ": " & Part.BottomOverMaterial)
End If
End If
' Riordino e stampo le compo
SearchCompo(DdfFileContent, Part, bIsDDF)
If Not Directory.Exists(Path.GetDirectoryName(sPath)) Then
Directory.CreateDirectory(Path.GetDirectoryName(sPath))
End If
DdfFileContent.Add(" ")
DdfFileContent.Add("# End Part")
' se sono arrivato fin qui significa che tutto è andato a buon fine (posso quindisalvare il file corrente)
DDFIsCorrect = ParamInCompoIsCorrect
'-----------------------------------------------------------------------------------------------------------------------------------
'Stampa su file
If bIsForAssembly Then
File.AppendAllLines(sPath, DdfFileContent, Text.Encoding.UTF8)
Else
File.WriteAllLines(sPath, DdfFileContent, Text.Encoding.UTF8)
End If
End Sub
#Region "Funzioni per il posizionamento"
Private Function PositionJamb_Y(CurrPart As Part) As String
Dim y As String
+577 -93
View File
@@ -6,24 +6,8 @@ Imports EgtUILib
Public Class Compo
Implements INotifyPropertyChanged
Friend TempFileDDF As String = IniFile.m_sTempDir & "\" & TEMP_FILE
'Friend m_rfCurrDoor As Part
' definizione della funzione delegato: riceve il valore di modifica della compo e della general
'Delegate Function CompareIsModify(rIsModifyCompo As Boolean, rIsModifyDoor As Boolean) As Boolean
'' aggiorno la variabile globale di cambiamento: verifico che sia il template che una combo/text sono state modificate
'Function IsModify() As Boolean
' If m_IsModifiedTemplateSelItem Then
' Return True
' End If
' For IndexCompoParamList = 0 To Me.CompoParamList.Count - 1
' If Me.CompoParamList(IndexCompoParamList).m_IsModifyCompoParam Then
' m_rfCurrDoor.m_IsModifyDoor = True
' Return True
' End If
' Next
' Return False
'End Function
'Public Brand As New ObservableCollection(Of CompoBrandDir)
' creo la stringa che contiene la lista degli errori
Dim ErrorList As String = String.Empty
@@ -68,6 +52,77 @@ Public Class Compo
#Region "Template ComboBox"
' 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
' 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
If m_BrandListPart(IndexModelList) = m_SelBrandPart Then
m_FileList = CompoType.Brand(IndexModelList).ModelFileList
Exit For
End If
Next
NotifyPropertyChanged("FileList")
Dim SelItemindex As Integer = 0
While Path.HasExtension(m_FileList(SelItemindex)) And SelItemindex < m_FileList.Count - 1
SelItemindex += 1
End While
SelFile = m_FileList(SelItemindex)
End Set
End Property
Public Sub SetSelBrand(sSelBrand As String)
m_SelBrandPart = sSelBrand
NotifyPropertyChanged("SelBrandPart")
End Sub
' 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
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)
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 & "\"
Dim CurrItem As String = ModelDir & m_SelFile
' passo il nome
TemplateSelItem = CurrItem
'Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
'Map.refSceneManagerVM.RefreshBtn()
NotifyPropertyChanged("SelFile")
End Set
End Property
' nome grafica (potrebbe essere shape o template)
Private m_TemplateName As String
Public Property TemplateName As String
Get
@@ -78,6 +133,7 @@ Public Class Compo
End Set
End Property
' nome DDF (potrebbe essere shape o template)
Private m_TemplateDDFName As String
Public Property TemplateDDFName As String
Get
@@ -88,17 +144,25 @@ Public Class Compo
End Set
End Property
Private m_TemplateItemList As New List(Of String)
Public Property TemplateItemList As List(Of String)
' il messaggio associato al brand
Public ReadOnly Property BrandMsg As String
Get
Return "Brand"
End Get
End Property
' lista dei File Template --> usato nella funzione
Private m_TemplateItemList As New ObservableCollection(Of String)
Public Property TemplateItemList As ObservableCollection(Of String)
Get
Return m_TemplateItemList
End Get
Set(value As List(Of String))
Set(value As ObservableCollection(Of String))
m_TemplateItemList = value
End Set
End Property
Friend m_IsModifiedTemplateSelItem As Boolean = False
' Template selezionato
Private m_TemplateSelItem As String
Public Property TemplateSelItem As String
Get
@@ -319,8 +383,6 @@ Public Class Compo
End If
End Sub
' a differenza delle funzioni sopra queste ricevono come parametro l'oggetto compo che deve essere modificato
' il prossimo passo sarà eliminare le funzioni sopra scritte per lasciare solo queste
#Region "SettemplateREFCOMPO"
Friend Sub SetTemplateSelItemRefCompo(value As String, CurrRefCompo As Compo)
Dim CurrConfig As String = CurrRefCompo.CompoType.Path & "\" & CONFIGINI_FILE_NAME
@@ -489,7 +551,7 @@ Public Class Compo
End If
End Function
Private Function ReadParam(sReadLine As String, ByRef NewCompoParam As CompoParam, ByRef sErrorList As String) As Boolean
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
sErrorList = ConcatErrorString(sErrorList, "Empty Line")
@@ -664,63 +726,392 @@ Public Class Compo
Return False
End Function
' converto questo vettore {"TextBox", "NomeDDF/Nome"} in {"TextBox", "NomeDDF", "Nome"}
Private Sub ConvertTextBoxString(ByRef Items() As String)
Dim Arrays(Items.Count) As String
Dim IndexArray As Integer = 0
Dim IndexItems As Integer = 0
For IndexItems = 0 To Items.Count - 1
If Not String.IsNullOrEmpty(RegexFunction.ParamExpression(Items(IndexItems))) Then
Arrays(IndexArray) = Trim(RegexFunction.ParamExpression(Items(IndexItems)))
IndexArray += 1
ElseIf Items(IndexItems).Split("/"c).Count = 1 Then
Arrays(IndexArray) = Trim(Items(IndexItems))
IndexArray += 1
ElseIf Items(IndexItems).Split("/"c).Count = 2 Then
Arrays(IndexArray) = Trim(Items(IndexItems).Split("/"c)(0))
IndexArray += 1
If IndexArray < Arrays.Count - 1 Then
Arrays(IndexArray) = Trim(Items(IndexItems).Split("/"c)(1))
IndexArray += 1
Public Function ReadParamHardware(sReadLine As String, ByRef NewCompoParam As CompoParam, ByRef sErrorList As String) As Boolean
' Se linea vuota, esco con errore
If String.IsNullOrWhiteSpace(sReadLine) Then
sErrorList = ConcatErrorString(sErrorList, "Empty Line")
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 "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
End If
Next
If IndexArray = IndexItems + 1 Then
System.Array.Resize(Items, IndexArray)
Items = Arrays
'Else
' Items = Arrays
End If
End Sub
' converto questo vettore {"ComboBox", "NomeDDF/Nome"} in {"ComboBox", "NomeDDF", "Nome"}
Private Sub ConvertComboBoxString(ByRef Items() As String)
Dim bCovert As Boolean = False
Dim Arrays(Items.Count) As String
Dim IndexArray As Integer = 0
Dim IndexItems As Integer = 0
For IndexItems = 0 To Items.Count - 1
If Items(IndexItems).Split("/"c).Count = 1 Then
Arrays(IndexArray) = Trim(Items(IndexItems))
IndexArray += 1
ElseIf Items(IndexItems).Split("/"c).Count = 2 Then
Arrays(IndexArray) = Trim(Items(IndexItems).Split("/"c)(0))
Arrays(IndexArray + 1) = Trim(Items(IndexItems).Split("/"c)(1))
IndexArray += 2
For Index = IndexItems + 1 To Items.Count - 1
Arrays(Index + 1) = Trim(Items(Index))
' 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 sComboItemList() As String = sItems(2).Split(","c)
Dim ComboItemList As New List(Of String)
Dim DDFComboItemList As New List(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
bCovert = True
Exit For
End If
Next
If bCovert Then
System.Array.Resize(Items, Items.Count)
Items = Arrays
'Else
' Items = Arrays
End If
End Sub
' Creo il parametro
NewCompoParam = New ComboBoxParam(sDDFName, sName, Me, ComboItemList, DDFComboItemList, ComboItemList(0))
Return True
Case "ComboBoxLua"
' NomeDDF e Nome del combo "ComboBoxLua; LG/geometry name; key1/L"
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/NomePara,etro, ...."
Dim sNameGeometry As String = String.Empty
If sItems.Count < 3 Then
If Not CompoMatch.ReserchInTable(Me.CompoType.DDFName, "", sNameGeometry) 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
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
' 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
End If
' Ricavo i diversi item
If String.IsNullOrEmpty(sNameGeometry) 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 sComboItemList() As String = sNameGeometry.Split(","c)
Dim ComboItemList As New List(Of String)
Dim LuaComboItemList As New List(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 ComboBoxParam(sLuaName, sName, Me, ComboItemList, LuaComboItemList, ComboItemList(0))
Return True
Case "ComboBoxOnOff"
' 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 sComboItemList() As String = sItems(2).Split(","c)
Dim ComboItemList As New List(Of String)
Dim DDFComboItemList As New List(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))
Return True
Case "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 = "mm"
End If
' a seconda del tipo Eseguo il controllo della variabile
Dim sDefaultValue As String = "0.0"
Select Case sTypeValue
Case "double"
If StringToDouble(sValue, dDefaultValue) Then
sDefaultValue = DoubleToString(dDefaultValue, 5)
Else
Return False
End If
Case "inch"
' ricevo un valore in Inches
If OptionModule.m_SelectedMeasureUnit = "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 "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 "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
NewCompoParam = New TextBoxParam(sLuaName, sName, Me, sDefaultValue, Nothing, Nothing, sTypeValue)
Return True
Case "TextBoxOnOff"
' 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)
' 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
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)
Return True
Else
NewCompoParam = New TextBoxOnOffParam(sDDFName, sName, Me, "0.000", Nothing, Nothing)
' Errore nell'espressione {0}. {1} non associa nulla.
sErrorList = ConcatErrorString(sErrorList, String.Format(EgtMsg(50147), NewCompoParam.Name, sItems(2)))
Return True
End If
Case "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)
' 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 = "mm"
End If
' il tipo di parametro che posso accettare è mm o inch
Dim sDefaultValue As String = "0.0"
Select Case sTypeValue
Case "inch"
' ricevo un valore in Inches
If OptionModule.m_SelectedMeasureUnit = "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 "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
If sItems.Count < 4 Then
' significa che si comporta come fosse una semplice TextBox
NewCompoParam = New TextBoxParam(sLuaName, sName, Me, sDefaultValue, Nothing, Nothing, sTypeValue)
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)
Return True
Case "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)
Return True
End Select
Return False
End Function
Private m_TemplateVisibility As Visibility
Public Property TemplateVisibility As Visibility
@@ -747,9 +1138,8 @@ Public Class Compo
' Definizione comando
Private m_CmdDelete As ICommand
Sub New(CompoType As CompoType, MyDoor As Part)
Sub New(CompoType As CompoType)
m_CompoType = CompoType
m_rfCurrDoor = MyDoor
End Sub
#Region "COMMANDS"
@@ -791,8 +1181,7 @@ Public Class Compo
End Class
Public Class CompoParam
Friend Shared m_rfSetTitle As Action
Private m_Name As String
Public Property Name As String
Get
@@ -834,6 +1223,18 @@ Public Class TextBoxParam
Inherits CompoParam
Implements INotifyPropertyChanged
' 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
Private m_IsReadOnly As Boolean = True
Public Property IsReadOnly As Boolean
Get
@@ -865,6 +1266,7 @@ Public Class TextBoxParam
Public Sub SetValue(sValue As String)
m_Value = sValue
NotifyPropertyChanged("ToolTipValue")
NotifyPropertyChanged("Value")
End Sub
Public ReadOnly Property ToolTipValue As String
@@ -930,6 +1332,15 @@ Public Class TextBoxParam
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)
MyBase.New(sDDFName, sName, CurrCompo)
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))
@@ -939,6 +1350,7 @@ End Class
Public Class ComboBoxParam
Inherits CompoParam
Implements INotifyPropertyChanged
Private m_IsReadOnly As Boolean = True
Public Property IsReadOnly As Boolean
@@ -979,20 +1391,20 @@ Public Class ComboBoxParam
m_SelItem = value
' controllo che la chiamata avvenga da una componente sulla porta?
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
Dim CmpPar As CompoParam = Me
Dim IndexP As Integer = CurrCompo.CompoParamList.IndexOf(Me)
' se il nome della combobox è side allora ed esiset un riferimento
If CmpPar.DDFName.ToLower = "side" And Not IsNothing(CurrCompo.refJambCompo) Then
' riposiziono la componente dopo averla eliminata dal jamb su cui si trova
Map.refPartPageVM.CurrPart.RemoveRefCompo(CurrCompo.refJambCompo)
CurrCompo.SetTemplateSelItem(CurrCompo.TemplateSelItem)
End If
Dim CmpPar As CompoParam = Me
Dim IndexP As Integer = CurrCompo.CompoParamList.IndexOf(Me)
' se il nome della combobox è side allora ed esiset un riferimento
If CmpPar.DDFName.ToLower = "side" And Not IsNothing(CurrCompo.refJambCompo) Then
' riposiziono la componente dopo averla eliminata dal jamb su cui si trova
Map.refPartPageVM.CurrPart.RemoveRefCompo(CurrCompo.refJambCompo)
CurrCompo.SetTemplateSelItem(CurrCompo.TemplateSelItem)
End If
Map.refSceneManagerVM.RefreshBtn()
End Set
End Property
Friend Sub SetSelItem(value As String)
m_SelItem = value
NotifyPropertyChanged("SelItem")
End Sub
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, ItemList As List(Of String), ItemListDDF As List(Of String), sSelItem As String)
@@ -1002,6 +1414,10 @@ Public Class ComboBoxParam
m_SelItem = 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
@@ -1028,6 +1444,74 @@ Public Class TextBoxOnOffParam
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
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
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)
MyBase.New(sDDFName, sName, CurrCompo, sValue, ComboBox, ComboValuelList, TypeVar)
m_ConstList = ConstList
m_SelConst = m_ConstList(0)
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
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
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)
MyBase.New(sDDFName, sName, CurrCompo)
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
@@ -1050,4 +1534,4 @@ Public Class ComboBoxOnOffParam
Sub New(sDDFName As String, sName As String, CurrCompo As Compo, ItemList As List(Of String), ItemListDDF As List(Of String), sSelItem As String)
MyBase.New(sDDFName, sName, CurrCompo, ItemList, ItemListDDF, sSelItem)
End Sub
End Class
End Class
+149 -52
View File
@@ -40,7 +40,7 @@ Public Class Part
m_IsActive = bIsActive
NotifyPropertyChanged("IsActive")
End Sub
' lista delle disposizioni da mostrare a video
Friend Shared m_DispositionList As New ObservableCollection(Of EdgeType)
Public ReadOnly Property DispositionList As ObservableCollection(Of EdgeType)
@@ -318,7 +318,7 @@ Public Class Part
Map.refAssemblyPageVM.CurrAssembly.SetVarAssembly()
'SetVarSize()
UpdateToolTip()
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
End Set
End Property
Public Sub SetThickness(sThickness As String)
@@ -334,7 +334,7 @@ Public Class Part
End If
Return m_Weight
End Get
Set(value As String)
Set(value As String)
m_Weight = value
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
NotifyPropertyChanged("ToolTipEvaluatedWeight")
@@ -719,6 +719,51 @@ Public Class Part
End Set
End Property
' utilizzata nell'Hardware
Friend Function AddNewHardware(HardwareGeneral As CompoType, TempHardwFile As String) As Boolean
' disabilito la costruzione del riferimento
Assembly.BuiltReffCompo = False
' creo la stringa che contiene la lista degli errori
Dim ErrorList As String = String.Empty
' creo il nuovo compo
Dim NewCompo As New Compo(HardwareGeneral)
' Leggo il file ini del componente per vedere se c'è il template: se c'è
If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME) <> 0 Then
' leggo nomi
Dim Name As String = String.Empty
Dim DDFName As String = String.Empty
IniFile.GetPrivateProfileCompoName(S_TEMPLATE, K_NAME, DDFName, Name, HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME)
'Dim TemplateList As New ObservableCollection(Of String)
'GetDirectoryCompoFiles(HardwareGeneral.Path, TemplateList)
' aggiungo il template come parametro
NewCompo.TemplateDDFName = DDFName
NewCompo.TemplateName = Name
'NewCompo.TemplateItemList = TemplateList
NewCompo.SetTemplateSelItem(TempHardwFile)
' se non c'è il template
Else
' nascondo il template
NewCompo.TemplateVisibility = Visibility.Collapsed
' leggo il nome del compo dal file config.ini
Dim sTemplateName As String = String.Empty
EgtUILib.GetPrivateProfileString(S_TEMPLATE, K_COMPO, "", sTemplateName, HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME)
If String.IsNullOrWhiteSpace(sTemplateName) Then
ErrorList &= String.Format(EgtMsg(50122), K_COMPO, NewCompo.TemplateName)
NewCompo = Nothing
ElseIf Not File.Exists(HardwareGeneral.Path & "\" & sTemplateName & ".lua") Then
ErrorList &= String.Format(EgtMsg(50122), K_COMPO, NewCompo.TemplateName)
NewCompo = Nothing
Else
NewCompo.TemplateSelItem = sTemplateName
End If
End If
If Not IsNothing(NewCompo) Then
CompoList.Add(NewCompo)
Return True
End If
Return False
End Function
'Gestione ComboBox e TextBox di ogni compo della pulsantiera letta da Compo.ini
Friend Function AddNewCompo(CurrCompoType As CompoType) As Compo
' disabilito la costruzione del riferimento
@@ -726,33 +771,19 @@ Public Class Part
' 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, Me)
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)
Dim TemplateList As New List(Of String)
GetDirectoryCompoFiles(CurrCompoType.Path, TemplateList)
' aggiungo il template come parametro
'-----------------------------------------------------------------------------------------------------------------------------------
NewCompo.TemplateDDFName = DDFName
NewCompo.TemplateName = Name
NewCompo.TemplateItemList = TemplateList
If Not SetItemTemplate(NewCompo.CompoType.DDFName) = String.Empty Then
NewCompo.SetTemplateSelItem(SetItemTemplate(NewCompo.CompoType.DDFName))
Else
' se esiste un lista di template
If NewCompo.TemplateItemList.Count > 0 Then
Dim SelItemindex As Integer = 0
' cerco il primo elemento della lista che abbia estensione lua
While Path.HasExtension(NewCompo.TemplateItemList(SelItemindex)) And SelItemindex < NewCompo.TemplateItemList.Count - 1
SelItemindex += 1
End While
' inizializzo la combobox template
NewCompo.SetTemplateSelItem(NewCompo.TemplateItemList(SelItemindex))
End If
End If
LoadBrandFileList(NewCompo)
'-----------------------------------------------------------------------------------------------------------------------------------
' se non c'è il template
Else
' nascondo il template
@@ -773,7 +804,7 @@ Public Class Part
' raggruppo tutte le componenti che hanno lo stesso nome vicine
If Not IsNothing(NewCompo) Then
'-----------------------------------------------------------------------------------------------------------------------------------------------
' questa parte viene ignorata se l'oggetto chiamante è un Frame o una Porta Inattiva
' questa parte viene ignorata se l'oggetto chiamante è un Frame
If Not IsNothing(Me.m_TypePart) AndAlso Not Me.m_TypePart.Contains("F") Then
If Not IsNothing(Map.refAssemblyPageVM.CurrAssembly.LeftJamb) Then
' costruisco un riferimnto in locale dell'assemblato
@@ -921,20 +952,20 @@ Public Class Part
' 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, Me)
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)
Dim TemplateList As New List(Of String)
GetDirectoryCompoFiles(CurrCompoType.Path, TemplateList)
' aggiungo il template come parametro
'-----------------------------------------------------------------------------------------------------------------------------------
NewCompo.TemplateDDFName = DDFName
NewCompo.TemplateName = Name
NewCompo.TemplateItemList = TemplateList
NewCompo.SetTemplateSelItemRefCompo(FrameCompoFile, NewCompo)
LoadBrandFileList(NewCompo)
'-----------------------------------------------------------------------------------------------------------------------------------
Else
' nascondo il template
NewCompo.TemplateVisibility = Visibility.Collapsed
@@ -1032,6 +1063,28 @@ Public Class Part
End If
End Sub
Private Function LoadBrandFileList(ByRef NewCompo As Compo) As Boolean
Dim CurrCompoType As CompoType = NewCompo.CompoType
If CurrCompoType.Brand.Count > 0 Then
For IndexModel As Integer = 0 To CurrCompoType.Brand.Count - 1
NewCompo.BrandListPart.Add(CurrCompoType.Brand(IndexModel).ModelDirGraphic)
Next
' prendo il primo direttorio
For IndexFile As Integer = 0 To CurrCompoType.Brand(0).ModelFileList.Count - 1
NewCompo.FileList.Add(CurrCompoType.Brand(0).ModelFileList(IndexFile))
Next
NewCompo.SetSelBrand(NewCompo.BrandListPart(0)) ' Carico il primo modello della lista
Dim SelItemindex As Integer = 0
While Path.HasExtension(NewCompo.FileList(SelItemindex)) And SelItemindex < NewCompo.FileList.Count - 1
SelItemindex += 1
End While
NewCompo.SelFile = NewCompo.FileList(SelItemindex)
Else
Return False
End If
Return True
End Function
' aggiorna il ToolTip delle TextBox
Private Sub UpdateToolTip()
For CompoIndex = 0 To m_CompoList.Count - 1
@@ -1049,6 +1102,8 @@ Public Class Part
Private FileContent As String()
' Genero una nuova porta da usare nella lettura di un DDF
Shared Sub ReadDDFPartDoor(ArrayFile() As String, ByRef LineIndex As Integer, ByRef ReadDoor As Part)
' passo alla pagina vuota in attesa del caricamneto della prossima
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
' Inizializzazioni
ReadDoor.FileContent = ArrayFile
ReadDoor.m_TypePart = "DO_1"
@@ -1162,8 +1217,15 @@ Public Class Part
End Select
End While
If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage
Else
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage
End If
' Aggiorno
If Not IsNothing(ReadDoor) Then
' se la porta esiste allora mostro i suoi parametri
Map.refPartPageVM.CurrPart = ReadDoor
'Map.refOptionsVM.RefreshEdgeTypeList()
' Sarebbe buona norma inserire qui la stringa con i messaggi di errore e avvertimento (dopo aver caricato i bevel corretti)
@@ -1761,9 +1823,9 @@ Public Class Part
Private Function GetCompo(Index As Integer, CompoNameDDF As String, ByRef sErrorInfo As String) As Integer
' Controllo esistenza del componente
Dim CompoListIndex As Integer = -1
For CmpInd = 0 To CompoPanelVM.CompoTypeList.Count() - 1
For CmpInd = 0 To Map.refCompoPanelVM.CompoTypeList.Count() - 1
' eseguo il confronto con il nome dei componenti che è stato caricato dal file Default.ini
If CompoPanelVM.CompoTypeList(CmpInd).DDFName = CompoNameDDF Then
If Map.refCompoPanelVM.CompoTypeList(CmpInd).DDFName = CompoNameDDF Then
CompoListIndex = CmpInd
Exit For
End If
@@ -1796,24 +1858,49 @@ Public Class Part
Exit While
End If
' Creo il componente
Dim m_CurrCompo = New Compo(CompoPanelVM.CompoTypeList(CompoListIndex), Me)
Dim m_CurrCompo = New Compo(Map.refCompoPanelVM.CompoTypeList(CompoListIndex))
Dim CurrCompoType As CompoType = m_CurrCompo.CompoType
' Se previsto template o shape da configurazione
Dim CurrCompoTypePath As String = CompoPanelVM.CompoTypeList(CompoListIndex).Path
Dim CurrCompoTypePath As String = Map.refCompoPanelVM.CompoTypeList(CompoListIndex).Path
If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME) <> 0 Then
' leggo se template o shape
Dim Name As String = String.Empty
Dim DDFName As String = String.Empty
IniFile.GetPrivateProfileCompoName(S_TEMPLATE, K_NAME, DDFName, Name, CurrCompoTypePath & "\" & CONFIGINI_FILE_NAME)
'-----------------------------------------------------------------------------------------------------------------------------------
m_CurrCompo.TemplateDDFName = DDFName
m_CurrCompo.TemplateName = Name
' creo la lista dei possibili template del componente
Dim TemplateList As New List(Of String)
GetDirectoryCompoFiles(CurrCompoTypePath, TemplateList)
m_CurrCompo.TemplateItemList = TemplateList
LoadBrandFileList(m_CurrCompo)
'-----------------------------------------------------------------------------------------------------------------------------------
' Se c'è "- " iniziale
If sKey.StartsWith("- ") Then
' leggo il template effettivamente utilizzato
Dim sTemplate As String = GetValueWithoutKey(sLine)
Dim BrandDir As String = String.Empty
Dim sFile As String = String.Empty
Dim sItems() As String = sTemplate.Split("\"c)
If sItems.Count < 2 Then
sFile = Trim(sItems(0))
m_CurrCompo.SelBrandPart = m_CurrCompo.BrandListPart.Last ' quando aggiorno la marca aggiorno la lista dei file associati
For IndexFile As Integer = 0 To m_CurrCompo.FileList.Count - 1
If sFile = m_CurrCompo.FileList(IndexFile) Then m_CurrCompo.SelFile = m_CurrCompo.FileList(IndexFile) : Exit For
Next
End If
If sItems.Count >= 2 Then
BrandDir = Trim(sItems(0))
sFile = Trim(sItems(1))
For IndexSplit As Integer = 2 To sItems.Count - 2
sFile &= "\" & sItems(IndexSplit)
Next
For IndexBrand As Integer = 0 To m_CurrCompo.BrandListPart.Count - 1
If BrandDir = m_CurrCompo.BrandListPart(IndexBrand) Then m_CurrCompo.SelBrandPart = m_CurrCompo.BrandListPart(IndexBrand) : Exit For
Next
For IndexFile As Integer = 0 To m_CurrCompo.FileList.Count - 1
If sFile = m_CurrCompo.FileList(IndexFile) Then m_CurrCompo.SelFile = m_CurrCompo.FileList(IndexFile) : Exit For
Next
End If
m_CurrCompo.SetTemplateSelItem(sTemplate)
' se il template non compare nella lista
If String.IsNullOrWhiteSpace(m_CurrCompo.TemplateSelItem) Then
@@ -2110,21 +2197,6 @@ Public Class Part
End If
End Sub
' per mantenere la configuarbilità con la precedente versione devo riaggiornare le liste dei
'Private Sub EdgeTypeCpntrol(ByRef CurrEdgeType As EdgeType)
' If CurrEdgeType.Name = "BU" And OptionModule.m_sDisposition = "BD" Then
' Try
' CurrEdgeType = EdgeTypeList.First(Function(x) x.Name = "BD")
' Catch ex As Exception
' End Try
' ElseIf CurrEdgeType.Name = "BD" And OptionModule.m_sDisposition = "BU" Then
' Try
' CurrEdgeType = EdgeTypeList.First(Function(x) x.Name = "BU")
' Catch ex As Exception
' End Try
' End If
'End Sub
#End Region ' Lettura ddf
' Genero una nuova porta da usare nella lettura di un DDF
@@ -2132,6 +2204,31 @@ Public Class Part
'CompoParam.m_rfSetTitle = AddressOf SetTitle
End Sub
' utilizzata per generare la porta dell'Hardware
Sub New(Hardware As String)
Me.m_Width = OptionModule.m_Width
Me.m_Height = OptionModule.m_Height
Me.m_Thickness = OptionModule.m_Thickness
Me.m_Swing = OptionModule.m_Swing
Me.m_IsActive = True
Me.m_Measure = ConvertMmUnitsToString(OptionModule.m_bIsMmUnit)
Me.m_Weight = OptionModule.m_Weight
Me.SetLockEdgeType(New EdgeType("SQ", Visibility.Visible))
Me.SetHingeEdgeType(New EdgeType("SQ", Visibility.Visible))
Me.SetTopType(New EdgeType("SQ", Visibility.Visible))
Me.SetBottomType(New EdgeType("SQ", Visibility.Visible))
Me.m_LockEdgeMachining = OptionModule.m_LockEdgeMachining
Me.m_HingeEdgeMachining = OptionModule.m_HingeEdgeMachining
Me.m_TopMachining = OptionModule.m_TopMachining
Me.m_BottomMachining = OptionModule.m_BottomMachining
Me.m_LockEdgeOverMaterial = OptionModule.m_LockEdgeOverMaterial
Me.m_HingeEdgeOverMaterial = OptionModule.m_HingeEdgeOverMaterial
Me.m_TopOverMaterial = OptionModule.m_TopOverMaterial
Me.m_BottomOverMaterial = OptionModule.m_BottomOverMaterial
Me.SetDispositionItem(OptionModule.m_Disposition)
Me.TypePart = "DO_1"
End Sub
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
+22 -11
View File
@@ -5,7 +5,7 @@
xmlns:EgtDOORCreator="clr-namespace:EgtDOORCreator">
<UserControl.Resources>
<local:SplitConverter x:Key="SplitConverter"/>
<EgtDOORCreator:SplitConverter x:Key="SplitConverter"/>
<local:DoorVisibilityConverter x:Key="DoorVisibilityConverter"/>
<local:TemplateListConverter x:Key="TemplateListConverter"/>
<EgtDOORCreator:TrueToFalse x:Key="TrueToFalse"/>
@@ -260,16 +260,26 @@
</GroupBox.Header>
<StackPanel >
<UniformGrid Columns="2" Visibility="{Binding TemplateVisibility}">
<TextBlock Text="{Binding TemplateName}"
<!--Brand-->
<TextBlock Text="{Binding BrandMsg}"
Style="{StaticResource DoorParamsTxBl}"/>
<ComboBox ItemsSource="{Binding TemplateItemList,
Converter={StaticResource TemplateListConverter}}"
Margin="0,0,0,2"
SelectedItem="{Binding TemplateSelItem}"
Style="{StaticResource DoorParamsCmBx}"
IsEnabled="{Binding IsReadOnly}"/>
</UniformGrid>
<!--Lista dei parametri-->
<ComboBox ItemsSource="{Binding BrandListPart,
Converter={StaticResource TemplateListConverter}}"
Margin="0,0,0,2"
SelectedItem="{Binding SelBrandPart}"
Style="{StaticResource DoorParamsCmBx}"
IsEnabled="{Binding IsReadOnly}"/>
<!--File-->
<TextBlock Text="{Binding TemplateName}"
Style="{StaticResource DoorParamsTxBl}"/>
<ComboBox ItemsSource="{Binding FileList,
Converter={StaticResource TemplateListConverter}}"
Margin="0,0,0,2"
SelectedItem="{Binding SelFile}"
Style="{StaticResource DoorParamsCmBx}"
IsEnabled="{Binding IsReadOnly}"/>
</UniformGrid>
<!--Lista dei parametri-->
<ItemsControl ItemsSource="{Binding CompoParamList}">
<ItemsControl.Resources>
<DataTemplate DataType="{x:Type local:ComboBoxParam}">
@@ -369,6 +379,7 @@
</ItemsControl>
</Grid>
<EgtDOORCreator:CompoPanelV Grid.Column="0" DataContext="{StaticResource CompoPanelVM}"/>
<ContentControl Grid.Column="0" Grid.Row="0" Content="{Binding CompoPanelControl}"/>
<!--<EgtDOORCreator:CompoPanelV Grid.Column="0" DataContext="{Binding CompoPanelPartVM}"/>-->
</Grid>
</UserControl>
+10
View File
@@ -43,8 +43,18 @@ Public Class PartPageVM
End Get
End Property
Private m_CompoPanelPart As CompoPanelV
Public ReadOnly Property CompoPanelControl As ContentControl
Get
Return m_CompoPanelPart
End Get
End Property
Sub New()
Map.SetRefDoorParametersVM(Me)
If IsNothing(Map.refCompoPanelVM) Then Map.SetRefCompoPanelVM(New CompoPanelVM("PartPage"))
If IsNothing(m_CompoPanelPart) Then m_CompoPanelPart = New CompoPanelV
m_CompoPanelPart.DataContext = Map.refCompoPanelVM
End Sub
#Region "Messages"
+20 -1
View File
@@ -29,7 +29,26 @@ Public Module Doors
Map.refSceneManagerVM.ComposeAssembly(SceneManagerVM.nComposeAssembly)
End If
' Aggiorno la visualizzazione
If bDraw Then EgtZoom(ZM.ALL)
If bDraw Then EgtDraw()
' Cursore standard
scene.Cursor = System.Windows.Forms.Cursors.Default
Return bOk
End Function
Function ExecDoorsPrinter(ByRef scene As Scene, sFilePath As String, Optional bDraw As Boolean = True) As Boolean
' Cursore attesa
scene.Cursor = System.Windows.Forms.Cursors.WaitCursor
' Scrivo il nome del file aperto in una variabile globale per averlo in caso di errore
IniFile.m_DDFFilePath = sFilePath
' Creazione porta
Dim bOk As Boolean = CreateDoors(sFilePath, False, False)
'' se attiva modalità assemblato, calcolo posizioni dei Part
'If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
' Map.refSceneManagerVM.ComposeAssembly(SceneManagerVM.nComposeAssembly)
'End If
' Aggiorno la visualizzazione
If bDraw Then EgtDraw()
EgtZoom(ZM.ALL)
' Cursore standard
scene.Cursor = System.Windows.Forms.Cursors.Default
Return bOk
+49 -3
View File
@@ -87,6 +87,7 @@
<HintPath>..\..\EgtProg\EgtDOORCreator\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -113,6 +114,9 @@
<Compile Include="Assembly\PartDoor.vb" />
<Compile Include="Command\Command.vb" />
<Compile Include="CompoMatch.vb" />
<Compile Include="CompoPanel\CompoPanelHardwareV.xaml.vb">
<DependentUpon>CompoPanelHardwareV.xaml</DependentUpon>
</Compile>
<Compile Include="CompoPanel\CompoType.vb" />
<Compile Include="Constants\ConstCompo.vb" />
<Compile Include="Constants\ConstGen.vb" />
@@ -121,6 +125,7 @@
<Compile Include="Converter\BooleanToVisibility.vb" />
<Compile Include="Converter\Path.vb" />
<Compile Include="Converter\ProjectVisibility.vb" />
<Compile Include="Converter\SplitConverter.vb" />
<Compile Include="Converter\TemplateListConverter.vb" />
<Compile Include="Converter\TrueToFalse.vb" />
<Compile Include="DdfFile.vb" />
@@ -144,12 +149,24 @@
<DependentUpon>AssemblyPageV.xaml</DependentUpon>
</Compile>
<Compile Include="Assembly\AssemblyPageVM.vb" />
<Compile Include="HardwareManager\Hardware.vb" />
<Compile Include="HardwareManager\HardwarePageVM.vb" />
<Compile Include="HardwareManager\HardwarePageV.xaml.vb">
<DependentUpon>HardwarePageV.xaml</DependentUpon>
</Compile>
<Compile Include="Launcher\LauncherModule.vb" />
<Compile Include="Launcher\LauncherV.xaml.vb">
<DependentUpon>LauncherV.xaml</DependentUpon>
</Compile>
<Compile Include="Launcher\LauncherVM.vb" />
<Compile Include="PrintSceneHostV\PrintSceneHostV.xaml.vb">
<DependentUpon>PrintSceneHostV.xaml</DependentUpon>
</Compile>
<Compile Include="Map.vb" />
<Compile Include="NewHardware\NewHardwareV.xaml.vb">
<DependentUpon>NewHardwareV.xaml</DependentUpon>
</Compile>
<Compile Include="NewHardware\NewHardwareVM.vb" />
<Compile Include="OptionsWindow\OptionModule.vb" />
<Compile Include="OptionsWindow\OptionsV.xaml.vb">
<DependentUpon>OptionsV.xaml</DependentUpon>
@@ -159,7 +176,15 @@
<DependentUpon>OrderV.xaml</DependentUpon>
</Compile>
<Compile Include="Order\OrderVM.vb" />
<Compile Include="Print\PrintWndV.xaml.vb">
<DependentUpon>PrintWndV.xaml</DependentUpon>
</Compile>
<Compile Include="Print\PrintWndVM.vb" />
<Compile Include="ProjectManager\Project.vb" />
<Compile Include="ProjectManager\ProjectManagerHardwareV.xaml.vb">
<DependentUpon>ProjectManagerHardwareV.xaml</DependentUpon>
</Compile>
<Compile Include="ProjectManager\ProjectManagerHardwareVM.vb" />
<Compile Include="ProjectManager\ProjectManagerV.xaml.vb">
<DependentUpon>ProjectManagerV.xaml</DependentUpon>
</Compile>
@@ -202,6 +227,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="CompoPanel\CompoPanelHardwareV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="DoorParameters\PartPageV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -218,6 +247,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="HardwareManager\HardwarePageV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Launcher\LauncherV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -243,6 +276,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="PrintSceneHostV\PrintSceneHostV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="NewHardware\NewHardwareV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OptionsWindow\OptionsV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -251,6 +292,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Print\PrintWndV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ProjectManager\ProjectManagerHardwareV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ProjectManager\ProjectManagerV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -447,9 +496,6 @@
<ItemGroup>
<Resource Include="Resources\TopCommandBar\CopyDDF.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="HardwareManager\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtDOORCreator\EgtDOORCreatorR32.exe
+3 -2
View File
@@ -6,13 +6,14 @@
<EgtDOORCreator:MainWindowVM x:Key="MainWindowVM"/>
<EgtDOORCreator:ProjectManagerVM x:Key="ProjectManagerVM"/>
<EgtDOORCreator:ProjectManagerHardwareVM x:Key="ProjectManagerHardwareVM"/>
<EgtDOORCreator:AssemblyManagerVM x:Key="AssemblyManagerVM"/>
<EgtDOORCreator:PartPageVM x:Key="PartPageVM"/>
<EgtDOORCreator:CompoPanelVM x:Key="CompoPanelVM"/>
<!--<EgtDOORCreator:CompoPanelVM x:Key="CompoPanelVM"/>-->
<EgtDOORCreator:SceneManagerVM x:Key="SceneManagerVM"/>
<EgtDOORCreator:StatusBarVM x:Key="StatusBarVM"/>
<EgtDOORCreator:AssemblyPageVM x:Key="AssemblyPageVM"/>
<EgtDOORCreator:HardwarePageVM x:Key="HardwarePageVM"/>
<!--Colori predefiniti-->
<SolidColorBrush x:Key="EgaltechBlue1" Color="#FF4D84C4" />
+2 -1
View File
@@ -13,7 +13,8 @@
' Per evitare richieste di approvare esecuzione javascript :
' - impostare possibilità di eseguire script in locale da Windows
' - si cambia il riferimento al disco C: nel modo seguente
' Prova della lettura di un file chm (Help)
'System.Windows.Forms.Help.ShowHelp(Nothing, "c:\EgtData\EgtDOORCreator\Help\Prova\HelpNDoc tutorial.chm")
Dim sHelpDir As String = String.Empty
If OptionModule.m_SmartHelp Then sHelpDir = IniFile.m_sHelpDir Else sHelpDir = IniFile.m_sHelpDir.Replace("C:", "file://127.0.0.1/c$")
DoorBrowser.Navigate(New Uri(sHelpDir & "\" & m_Language & "\" & GuideVM.m_AddressGuide & ".html"))
+915
View File
@@ -0,0 +1,915 @@
Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class Hardware
Implements INotifyPropertyChanged
Dim bTypeListExist As Boolean = False
Dim ModelList As New ObservableCollection(Of CompoBrandDir)
' i parametetri sono suddivisi in sottocapitolli (gruppi di parametri)
Private m_GroupChapters As New ObservableCollection(Of Compo)
Public Property GroupChapters As ObservableCollection(Of Compo)
Get
Return m_GroupChapters
End Get
Set(value As ObservableCollection(Of Compo))
m_GroupChapters = value
End Set
End Property
#Region "BRAND"
Private m_BrandList As New ObservableCollection(Of String)
Public Property BrandList As ObservableCollection(Of String)
Get
Return m_BrandList
End Get
Set(value As ObservableCollection(Of String))
m_BrandList = value
End Set
End Property
Private m_SelBrand As String
Public Property SelBrand As String
Get
Return m_SelBrand
End Get
Set(value As String)
m_SelBrand = value
SetModeltemplate()
End Set
End Property
#End Region ' Brand
#Region "TEMPLATE"
Private m_HardwareGeneral As CompoType
Public Property HardwareGeneral As CompoType
Get
Return m_HardwareGeneral
End Get
Set(value As CompoType)
m_HardwareGeneral = value
End Set
End Property
Private m_TemplateList As New ObservableCollection(Of String)
Public Property TemplateList As ObservableCollection(Of String)
Get
Return m_TemplateList
End Get
Set(value As ObservableCollection(Of String))
m_TemplateList = value
NotifyPropertyChanged("TemplateList")
End Set
End Property
Private m_SelTemplate As String
' questa proprietà non è usata nel momento in cui generiamo un nuovo Hardware
Public Property SelTemplate As String
Get
Return m_SelTemplate
End Get
Set(value As String)
If SaveControl() = SaveResult.nCancel Then Return
m_SelTemplate = value
If bTypeListExist Then ' False-> errore nel caricamento della lista o non esiste, True-> la lista è stata caricata correttamente
SetTypeFromTemplate(m_SelTemplate)
NotifyPropertyChanged("VisibilityType")
End If
ClearGroupChapters() ' Prima di procedere ripulisco la pagina dai vacchi paramatri
ReadChapterTemplate() ' Rileggo i parametri del SetTemplate
ReadTemplate(m_SelTemplate) ' Carico i dati del template
Map.refSceneManagerVM.RefreshBtn() ' Creo un file temporaneo per gestire la grafica
NotifyPropertyChanged("SelTemplate")
NotifyPropertyChanged("TemplateList")
End Set
End Property
Private m_VisibilityTemplate As Visibility = Visibility.Visible
Public Property VisibilityTemplate As Visibility
Get
Return m_VisibilityTemplate
End Get
Set(value As Visibility)
m_VisibilityTemplate = value
End Set
End Property
Private m_VisibilityTextTemplate As Visibility = Visibility.Collapsed
' in caso di nuovo Hardware incollo sopra alla combobox la textbox (non Collasso/Nascondo la combobox!)
Public Property VisibilityTextTemplate As Visibility
Get
If Not m_VisibilityTemplate = Visibility.Visible Then Return Visibility.Collapsed
Return m_VisibilityTextTemplate
End Get
Set(value As Visibility)
m_VisibilityTextTemplate = value
NotifyPropertyChanged("VisibilityTextTemplate")
End Set
End Property
Private m_TemplateName As String = String.Empty
Public Property TemplateName As String
Get
Return m_TemplateName
End Get
Set(value As String)
m_TemplateName = value
' al momento del slavatggio il nome del file è quello contenuto in m_SelTemplate
m_SelTemplate = m_TemplateName
NotifyPropertyChanged("TemplateName")
End Set
End Property
#End Region ' Name-Template
#Region "TYPELIST"
Private m_TypeList As New List(Of TypeHardware)
Public Property TypeList As List(Of TypeHardware)
Get
Return m_TypeList
End Get
Set(value As List(Of TypeHardware))
m_TypeList = value
NotifyPropertyChanged("TypeList")
End Set
End Property
' per mostrare in grafica la lista
Private m_TypeListName As New List(Of String)
Public ReadOnly Property TypeListName As List(Of String)
Get
Return m_TypeListName
End Get
End Property
' se non dovessere esistere un tipo, al momento del salvataggio cerca il file con nome Template ed estensione .Templ
Private m_SelType As String = "Template"
Public Property SelType As String
Get
Return m_SelType
End Get
Set(value As String)
m_SelType = value
' se la text è visibile non passo mai dal SelTemplate quindi sposto qui il caricamento dei dati
If VisibilityTextTemplate = Visibility.Visible Then
ClearGroupChapters()
ReadChapterTemplate()
End If
NotifyPropertyChanged("SelType")
End Set
End Property
Private m_VisibilityType As Visibility = Visibility.Collapsed
Public Property VisibilityType As Visibility
Get
Return m_VisibilityType
End Get
Set(value As Visibility)
m_VisibilityType = value
NotifyPropertyChanged("VisibilityType")
End Set
End Property
' se non viene modificata il tipo non può essere modificato
Private m_IsEnableType As Boolean = False
Public Property IsEnableType As Boolean
Get
If Not VisibilityType = Visibility.Visible Then Return False
Return m_IsEnableType
End Get
Set(value As Boolean)
m_IsEnableType = value
NotifyPropertyChanged("IsEnableType")
End Set
End Property
#End Region ' TypeList
#Region "GENERAL FUNCTION"
#Region "Caricamento"
' Carica il nome della Componente, La lista dei template, La lista dei tipi
Public Sub LoadTemplate(ByRef CurrCompoType As CompoType)
Dim ErrorList As String = String.Empty
' carico il general dell'hardware
m_HardwareGeneral = CurrCompoType
NotifyPropertyChanged("HardwareGeneral")
If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME) <> 0 Then
GetDirectoryCompoModel(CurrCompoType.Path, ModelList)
If ModelList.Count > 0 Then
For IndexModel As Integer = 0 To ModelList.Count - 1
BrandList.Add(ModelList(IndexModel).ModelDirGraphic)
Next
' prendo il primo direttorio
For IndexFile As Integer = 0 To ModelList(0).ModelFileList.Count - 1
TemplateList.Add(ModelList(0).ModelFileList(IndexFile))
Next
bTypeListExist = LoadType() ' carico la lista dei Type
m_SelBrand = m_BrandList(0) ' Carico il primo modello della lista
NotifyPropertyChanged("SelBrand")
Dim SelItemindex As Integer = 0
While Path.HasExtension(m_TemplateList(SelItemindex)) And SelItemindex < m_TemplateList.Count - 1
SelItemindex += 1
End While
SelTemplate = m_TemplateList(SelItemindex)
End If
Else ' se non c'è il template
VisibilityTemplate = Visibility.Collapsed
NotifyPropertyChanged("VisibilityTemplate")
End If
End Sub
Public Sub SetModeltemplate()
For IndexModelList As Integer = 0 To m_BrandList.Count - 1
If m_BrandList(IndexModelList) = m_SelBrand Then
m_TemplateList = ModelList(IndexModelList).ModelFileList
Exit For
End If
Next
Dim SelItemindex As Integer = 0
While Path.HasExtension(m_TemplateList(SelItemindex)) And SelItemindex < m_TemplateList.Count - 1
SelItemindex += 1
End While
' se la text non è visbilie allora seleziono il primo della lista
If Not m_VisibilityTextTemplate = Visibility.Visible Then SelTemplate = m_TemplateList(SelItemindex)
End Sub
' carico la lista dei tipi --> devo stampare gli errori
Private Function LoadType() As Boolean
Dim ErrorMsg As String = String.Empty
' costruisco la Path del template da leggere
IniFile.m_StdTemplate = m_HardwareGeneral.Path & "\StdTemplate.ini"
If Not File.Exists(IniFile.m_StdTemplate) Then Return False
Dim List As New List(Of String) ' lista temporanea "1/Mort"
If IniFile.StdTemplateGetPrivateProfileList("Hardware", "Type", List) Then
m_VisibilityType = Visibility.Visible ' rendo visibile la lista
' leggo nomi
Dim ArrayNameSplit(1) As String
For IndexListType As Integer = 0 To List.Count - 1
ArrayNameSplit = List(IndexListType).Split("/"c)
If IsNumeric(ArrayNameSplit(0)) Then
m_TypeList.Add(New TypeHardware(ArrayNameSplit(1), ArrayNameSplit(0)))
m_TypeListName.Add(ArrayNameSplit(1))
Else
ErrorMsg = "In file StdTempate.ini is missing numeric param in [Type]"
TypeList.Add(New TypeHardware("Error!", "0"))
Return False ' interrompo la lettura
End If
Next
NotifyPropertyChanged("TypeList")
NotifyPropertyChanged("TypeListName")
Else
m_VisibilityType = Visibility.Collapsed
Return False ' se la lista è vuota restituisco falso
End If
Return True
End Function
' setta il valore del template --> devo stampare gli errori
Private Function SetTypeFromTemplate(value As String) As Boolean
' carico di Default il valore 1
For IndexListType As Integer = 0 To TypeList.Count - 1
If TypeList(IndexListType).NameINI = "1" Then
m_SelType = TypeListName(IndexListType)
NotifyPropertyChanged("SelType")
Exit For
End If
Next
' inizio la lettura del file lua selezionato
Dim CurrConfig As String = m_HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME
Dim ModelDir As String = String.Empty
If m_SelBrand <> RegexFunction.ModelTemplate(m_HardwareGeneral.Path) Then ModelDir = m_SelBrand & "\"
Dim CurrItemPath As String = m_HardwareGeneral.Path & "\" & ModelDir & value
Dim ErrorMsg As String = String.Empty
' se il file ha estensione nge
If Path.HasExtension(CurrItemPath) AndAlso Path.GetExtension(CurrItemPath).ToLower = NGE_EXTENSION Then
If Not File.Exists(CurrItemPath) Then ErrorMsg = "File does not exist" : Return False ' controllo che esiste il file altrimenti esco
' m_TemplateSelItem = value
' ' creo la stringa che contiene la lista degli errori
' Dim ParamIndex As Integer = 1
Dim ConfigDefault As String = String.Empty ' configurazione del template
' Dim NewCompoParam As CompoParam = Nothing
EgtUILib.GetPrivateProfileString(S_NGECONFIG, K_DEFAULT, "", ConfigDefault, CurrConfig)
For IndexTypeList As Integer = 0 To TypeList.Count - 1
If TypeList(IndexTypeList).NameINI = ConfigDefault Then Exit For Else ErrorMsg = "Definition type is not correct: " & ConfigDefault : Return False
Next
' ' ricerco la parola chiave Param nella stringa nel file Config.ini
' ReadParamConfig(NewCompoParam, ErrorList, ParamIndex, ConfigDefault)
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
' controllo che esiste il file altrimenti esco
If Not File.Exists(CurrItemPath) Then ErrorMsg = "File does not exist" : Return False
' m_TemplateSelItem = value
' carico un vettore con le stringhe del file corrente
Dim ReadCurrCompo() As String = File.ReadAllLines(CurrItemPath)
Dim EndOfFile As Boolean = False
' leggo il vettore di stringhe del file corrente
For LineIndex = 0 To ReadCurrCompo.Count - 1
' copio il valore della riga
Dim CurrCompoFileLine As String = ReadCurrCompo(LineIndex)
' cerco il titolo [Graphic parameters]: se lo trovo
If RegexFunction.IsGraphicParametersTitle(CurrCompoFileLine) Then
' mi preparo per leggere la prima riga dopo il titolo
Dim ParamIndex As Integer = 1
' 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
ErrorMsg = "In file " & CurrItemPath & " param 'Default' must be numeric."
Return False ' valore letto non è numerico
Else
For IndexListType As Integer = 0 To TypeList.Count - 1
If TypeList(IndexListType).NameINI = ConfigDefault Then
m_SelType = TypeListName(IndexListType)
NotifyPropertyChanged("SelType")
Exit For
End If
Next
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 = m_CompoParamList.Count - 1 To ParamIndex - 1 Step -1
' m_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
' ReadParamConfig(NewCompoParam, ErrorList, ParamIndex, "")
' Exit For
' End If
Next
End If
'If Not String.IsNullOrWhiteSpace(ErrorList) Then EgtOutLog(ErrorList)
''----------------------------------------------------------------------------------------------------------------------------------------------
'If Assembly.BuiltReffCompo Then
' Dim FrameCompoFile As String = String.Empty
' Dim FrameCompoFileConfig As String = String.Empty
' Dim nDoorNbr As Integer = 1
' Int32.TryParse(Map.refAssemblyPageVM.CurrAssembly.DoorNumber, nDoorNbr)
' If CalcCompoMatching(Me.CompoType.Path, nDoorNbr, Me.TemplateSelItem, FrameCompoFile) AndAlso
' Not String.IsNullOrEmpty(FrameCompoFile) Then
' If Not SearchFileConfig(FrameCompoFile, FrameCompoFileConfig) Then
' MessageBox.Show("Jamb compo does not exist", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
' If Not IsNothing(Me.refJambCompo) Then
' Map.refPartPageVM.CurrPart.RemoveRefCompo(Me.refJambCompo)
' Me.refJambCompo = Nothing
' Return
' End If
' Else
' Dim FrameCompoNameDDF As String = String.Empty
' Dim FrameCompoName As String = String.Empty
' Dim Side As String = String.Empty
' Dim CurrCompoPath As String = FrameCompoFileConfig
' ' sostituisco il vecchio CompoType con quello corretto
' If File.Exists(CurrCompoPath) Then
' GetPrivateProfileCompoName(ConstCompo.S_COMPO, ConstCompo.K_NAME, FrameCompoNameDDF, FrameCompoName, CurrCompoPath)
' GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, Side, Me.CompoType.Path & "\" & CONFIGINI_FILE_NAME)
' If String.IsNullOrEmpty(Side) Then
' ' controllo nell'elenco dei parametri se esiste un parametro di tipo Side
' For IndexParam As Integer = 0 To Me.CompoParamList.Count - 1
' If Me.CompoParamList(IndexParam).DDFName.ToLower = "side" Then
' Side = DirectCast(Me.CompoParamList(IndexParam), ComboBoxParam).SelItem
' Exit For
' End If
' Next
' End If
' '-------------------------------------------------------------------------------------------------------------------------------
' If IsNothing(Me.refJambCompo) Then
' Part.CreateRefCompo(Me.CompoType, Me, Map.refAssemblyPageVM.CurrAssembly, FrameCompoFileConfig, FrameCompoFile, Map.refPartPageVM.CurrPart)
' If CompoMatch.LoadCompoParam(Me, Map.refPartPageVM.CurrPart.TypePart) Then Map.refAssemblyPageVM.CurrAssembly.UpDateCurrCompoJamb(Me)
' For IndexParam As Integer = 0 To Me.refJambCompo.CompoParamList.Count - 1
' If Me.refJambCompo.CompoParamList(IndexParam).DDFName.ToLower = "side" Then
' ' assegno alla componente del frame la stessa posizione definita sull'anta
' DirectCast(Me.refJambCompo.CompoParamList(IndexParam), ComboBoxParam).SetSelItem(Me.CompoType.JambSide)
' Exit For
' End If
' Next
' Return
' End If
' '-------------------------------------------------------------------------------------------------------------------------------
' Me.refJambCompo.CompoType.SetDDFName(FrameCompoNameDDF)
' Me.refJambCompo.CompoType.SetName(FrameCompoName)
' Dim FrameCompoDirectory As String
' FrameCompoDirectory = FrameCompoFileConfig.Remove(FrameCompoFileConfig.LastIndexOf("\"))
' Me.refJambCompo.CompoType.SetPath(FrameCompoDirectory)
' Me.refJambCompo.CompoType.SetJambSide(Side)
' End If
' End If
' ' Carico il nome
' FrameCompoFile = FrameCompoFile.Substring(FrameCompoFileConfig.LastIndexOf("\") + 1)
' Me.refJambCompo.SetTemplateSelItemRefCompo(FrameCompoFile, Me.refJambCompo)
' LoadCompoParam(Me, Map.refPartPageVM.CurrPart.TypePart)
' Map.refAssemblyPageVM.CurrAssembly.UpDateCurrCompoJamb(Me)
' ResetCompoParam()
' Else
' If Not IsNothing(Me.refJambCompo) Then
' Map.refPartPageVM.CurrPart.RemoveRefCompo(Me.refJambCompo)
' Me.refJambCompo = Nothing
' End If
' End If
'End If
Return True
End Function
' ricerca il nome dei capitoli associati e chiama la lettura dei parametri
Public Sub ReadChapterTemplate()
Dim ErrorList As String = String.Empty
Dim sParam As String = String.Empty ' la stringa che contiene tutte le informazioni della componente
Dim ParamIndex As Integer = 1
Dim ChapterIndex As Integer = 1 ' numero del capitolo
Dim IndexChapter As String = "1"
For IndexTypeList As Integer = 0 To m_TypeList.Count - 1
If m_TypeList(IndexTypeList).Name = SelType Then
IndexChapter = m_TypeList(IndexTypeList).NameINI
Exit For
End If
Next
Dim S_CHAPTER As String = S_GR_PARAM_HARDWARE & IndexChapter & "." ' il nome del capitolo da leggere "ParametersN."
While EgtUILib.GetPrivateProfileString(S_CHAPTER & ChapterIndex, K_PARAM & ParamIndex, "", sParam, IniFile.m_StdTemplate) > 0 ' Verifico che esista il capitolo nuovo "Type-ChapterIndex"
Dim Chapter As New Compo(m_HardwareGeneral)
Dim Name As String = String.Empty
Dim LuaName As String = String.Empty
If StdTemplateGetPrivateProfileChapterName(S_CHAPTER & ChapterIndex, "Name", LuaName, Name) Then
Chapter.TemplateName = Name
End If
While EgtUILib.GetPrivateProfileString(S_CHAPTER & ChapterIndex, K_PARAM & ParamIndex, "", sParam, IniFile.m_StdTemplate) > 0 ' Verifico che esista il parametro nuovo "Param-ParamIndex"
If Not String.IsNullOrWhiteSpace(sParam) Then
Dim NewParam As New CompoParam(m_HardwareGeneral.DDFName, m_HardwareGeneral.Name, Chapter)
' leggo il tipo di parametro, se la lettura va a buon fine la carico
If Chapter.ReadParamHardware(sParam, NewParam, ErrorList) Then Chapter.CompoParamList.Add(NewParam)
End If
ParamIndex += 1
End While ' termina lettura del capitolo
GroupChapters.Add(Chapter)
ParamIndex = 1
ChapterIndex += 1
End While ' termina lettura della configurazione
If Not String.IsNullOrEmpty(ErrorList) Then
MessageBox.Show(ErrorList, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
End If
End Sub
' elimina le liste di parametri precedenti ad ogni selezione
Public Sub ClearGroupChapters()
If Not IsNothing(GroupChapters) Then
GroupChapters.Clear()
End If
NotifyPropertyChanged("GroupChapters")
End Sub
Friend Function ReadTemplate(sFile As String) As Boolean
' inizio la lettura del file lua selezionato
Dim FileContent() As String
Dim ModelDir As String = String.Empty
If m_SelBrand <> RegexFunction.ModelTemplate(m_HardwareGeneral.Path) Then ModelDir = m_SelBrand & "\"
Dim CurrItemPath As String = m_HardwareGeneral.Path & "\" & ModelDir & sFile
If Not Path.HasExtension(CurrItemPath) Then CurrItemPath &= LUA_EXTENSION
Dim ErrorMsg As String = String.Empty
' se il file ha estensione o se ha estensione nge: esco
If Path.GetExtension(CurrItemPath).ToLower = NGE_EXTENSION Then
ErrorMsg = "File has nge extension."
Return False
End If
If Not File.Exists(CurrItemPath) Then ErrorMsg = "File does not exist" : Return False ' controllo che esiste il file altrimenti esco
FileContent = File.ReadAllLines(CurrItemPath)
' se il file esiste ma è vuoto
If FileContent.Count = 0 Then
MessageBox.Show(EgtMsg(50107), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End If
For IndexLine As Integer = 0 To FileContent.Count - 1
Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
Dim sLine() As String = CurrLine.Split("="c)
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
FindParamTemplateInConfigList(Trim(sLine(0)), Trim(sLine(1)))
Next
Return True
End Function
Private Function FindParamTemplateInConfigList(sParam As String, sValue As String) As Boolean
For IndexGroupChapters As Integer = 0 To m_GroupChapters.Count - 1
For IndexChapter As Integer = 0 To m_GroupChapters(IndexGroupChapters).CompoParamList.Count - 1
If m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter).DDFName = sParam Then
' ho trovato una corrispondenza tra il valore de file ini e quello lua in lettura
If TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxDGCParam Then
Dim Text As TextBoxDGCParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxDGCParam)
Dim sItems() As String = sValue.Split("+"c)
Dim sLen As String = Trim(Utility.GetMeasure(sItems(0)))
Dim dVal As Double = 0.0
Text.SetValue(sLen)
Text.SetConst(Text.ConstList(0))
If sItems.Count >= 2 Then
For IndexConst As Integer = 0 To Text.ConstList.Count - 1
If Text.ConstList(IndexConst) = Trim(sItems(1)) Then Text.SetConst(Text.ConstList(IndexConst)) : Exit For
Next
End If
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxParam Then
Dim Text As TextBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxParam)
' controllo il tipo di dato che si aspetta
Select Case Text.TypeVar
Case "inch"
Dim sLen As String = Trim(Utility.GetMeasure(sValue))
Text.SetValue(sLen)
Case "mm"
Dim sLen As String = Trim(Utility.GetMeasure(sValue))
Text.SetValue(sLen)
Case "double"
Dim dVal As Double = 0.0
If StringToDouble(sValue, dVal) Then Text.SetValue(sValue) Else Text.SetValue("0.000")
Case "string"
Text.SetValue(Trim(Utility.DeleteSuperScript(sValue)))
End Select
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is CheckBoxParam Then
Dim Text As CheckBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), CheckBoxParam)
Text.SetIsChecked(Utility.ConvertCheckBox(sValue))
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is ComboBoxParam Then
Dim Text As ComboBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), ComboBoxParam)
Text.SetSelItem(Text.ItemList(0))
For IndexCombo As Integer = 0 To Text.ItemListDDF.Count - 1
If Trim(Text.ItemListDDF(IndexCombo)) = Trim(Utility.DeleteSuperScript(sValue)) Then Text.SetSelItem(Text.ItemList(IndexCombo))
Next
End If
Return True
End If
Next
Next
Return False
End Function
#End Region ' Caricamneto
#Region "Salvataggio, Duplica, Aggiorna"
Public Function Duplicate(sSelBrand As String, sTemplate As String) As Boolean
If IsNothing(m_SelTemplate) Then
MessageBox.Show("Impossible to duplicate Hardware if there is no Hardware selected!", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Exclamation)
Return False
End If
If IsNothing(sTemplate) Then
MessageBox.Show("Missing name of the new template!", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Exclamation)
Return False
End If
' ricostruico il percorso del file da dupicare
Dim ModelDir As String = String.Empty
If m_SelBrand <> RegexFunction.ModelTemplate(m_HardwareGeneral.Path) Then ModelDir = m_SelBrand & "\"
Dim OldDirPath As String = m_HardwareGeneral.Path & "\" & ModelDir & m_SelTemplate & LUA_EXTENSION
' ricostruisco il nuovo file da creare
ModelDir = String.Empty
If sSelBrand <> RegexFunction.ModelTemplate(m_HardwareGeneral.Path) Then ModelDir = sSelBrand & "\"
Dim CurrDirPath As String = m_HardwareGeneral.Path & "\" & ModelDir & sTemplate & LUA_EXTENSION
Dim IndexModel As Integer
Dim TemSelBrand As String = String.Empty
' carico la lista dei file presenti nel direttorio selezionato
Dim Temp_TemplateList As New ObservableCollection(Of String)
For IndexModel = 0 To ModelList.Count - 1
If ModelList(IndexModel).ModelDirGraphic = sSelBrand Then
TemSelBrand = ModelList(IndexModel).ModelDirGraphic
Temp_TemplateList = ModelList(IndexModel).ModelFileList
Exit For
End If
Next
' controllo se il nome è già presente nel direttorio selezionato
Dim bNameExist As Boolean = False
Dim IndexHardwList As Integer
For IndexHardwList = 0 To m_TemplateList.Count - 1
If m_TemplateList(IndexHardwList) = sTemplate Then
' se il nome è nella lista allora esco dal ciclo e rendo falsa la variabile bNameExist
bNameExist = True
Exit For
End If
bNameExist = False
Next
' se il nome esite già nel direttorio selezionato
If bNameExist Then
Select Case MessageBox.Show("The file: " & sTemplate & " already exist in directory " & sSelBrand & " . Do you want to overwrite it?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
' decido di sovrescrivere il file esistente
Case MessageBoxResult.Yes
If File.Exists(CurrDirPath) Then
Try
' elimino il file
File.Delete(CurrDirPath)
Catch ex As FileNotFoundException
' non è un problema
Catch ex As Exception
' non è un problema
End Try
End If
Case Else
' deicido di non sovrescrivere interrompo
Return False
End Select
End If
' elimino ilnome dalla lista dei file (alla fine il nome verrà aggiunto ancora)
For IndexTempList As Integer = 0 To m_TemplateList.Count - 1
If m_TemplateList(IndexTempList) = sTemplate Then
TemplateList.RemoveAt(IndexTempList)
Exit For
End If
Next
' carico le variabili temporanee e aggiorno la grafica (lista dei file e Brand selezionato)
SelBrand = TemSelBrand
TemplateList = Temp_TemplateList
NotifyPropertyChanged("TemplateList")
NotifyPropertyChanged("SelBrand")
' copio il file
Try
File.Copy(OldDirPath, CurrDirPath, True)
Catch ex As System.IO.IOException
MessageBox.Show("Error in copying: " & ex.Message)
' interrompo la copia e la creazione del nuovo file
File.Delete(CurrDirPath)
Return False
End Try
' aggiungo il nome alla lista
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
RefreshTemplateListEgtDOORCreator()
Return True
End Function
' crea il file temporaneao per aggiornare la parte grafica
Public Function RefreshTempHardware() As Boolean
Dim ErrorMsg As String = String.Empty
' costruisco la Path del template da leggere
Dim TemplFile = m_HardwareGeneral.Path & "\" & m_SelType & ".templ "
If Not File.Exists(TemplFile) Then Return False
Dim FileContent() As String = File.ReadAllLines(TemplFile)
' inizio la lettura riga per riga
For IndexLine As Integer = 0 To FileContent.Count - 1
Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
Dim sLine() As String = CurrLine.Split("="c)
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For ' significa che non è un parametro
Dim sValue As String = Trim(sLine(1))
Dim sTemplValue As String = Trim(sLine(1))
If Not ConvertValueForLua(sValue) Then Continue For
FileContent(IndexLine) = FileContent(IndexLine).Replace(sTemplValue, sValue)
Next
' costruisco il nome del percorso del file corrente
Dim sTempFileHardw As String = m_HardwareGeneral.Path & "\" & TEMP_FILE_HARDWARE
' salvo il file
File.WriteAllLines(sTempFileHardw, FileContent)
' aggiungo la componente
Map.refHardwarePageVM.Door.CompoList.Clear()
Map.refHardwarePageVM.Door.AddNewHardware(m_HardwareGeneral, Path.GetFileNameWithoutExtension(TEMP_FILE_HARDWARE))
'Map.refSceneManagerVM.RefreshBtn()
Return True
End Function
Public Function Save() As Boolean
Dim ErrorMsg As String = String.Empty
' costruisco la Path del template da leggere
Dim TemplFile = m_HardwareGeneral.Path & "\" & m_SelType & ".templ "
If Not File.Exists(TemplFile) Then Return False
Dim FileContent() As String = File.ReadAllLines(TemplFile)
' inizio la lettura riga per riga
For IndexLine As Integer = 0 To FileContent.Count - 1
Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
Dim sLine() As String = CurrLine.Split("="c)
If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For ' significa che non è un parametro
Dim sValue As String = Trim(sLine(1))
Dim sTemplValue As String = Trim(sLine(1))
If Not ConvertValueForLua(sValue) Then Continue For
FileContent(IndexLine) = FileContent(IndexLine).Replace(sTemplValue, sValue)
Next
' costruisco il nome del percorso del file corrente
Dim CurrConfig As String = m_HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME
Dim ModelDir As String = String.Empty
If m_SelBrand <> RegexFunction.ModelTemplate(m_HardwareGeneral.Path) Then ModelDir = m_SelBrand & "\"
Dim CurrItemPath As String = m_HardwareGeneral.Path & "\" & ModelDir & m_SelTemplate & LUA_EXTENSION
' devo controllare che il file con questo nome non esiste (solo nel caso di TextTemplate visibile)
If VisibilityTextTemplate = Visibility.Visible Then
Dim bNameExist As Boolean = False
Dim IndexHardwList As Integer
For IndexHardwList = 0 To m_TemplateList.Count - 1
If m_TemplateList(IndexHardwList) = m_SelTemplate Then
' se il nome è nella lista allora esco dal ciclo e rendo falsa la variabile bNameExist
bNameExist = True
Exit For
End If
bNameExist = False
Next
' se il nome esite già nel direttorio selezionato
If bNameExist Then
Select Case MessageBox.Show("The file: " & m_SelTemplate & " already exist in directory " & m_SelBrand & " . Do you want to overwrite it?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
' decido di sovrescrivere il file esistente
Case MessageBoxResult.Yes
' salvo il file
File.WriteAllLines(CurrItemPath, FileContent)
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False
Return True
Case Else
' deicido di non sovrescrivere interrompo
Return False
End Select
End If
End If
' salvo il file
File.WriteAllLines(CurrItemPath, FileContent)
RefreshTemplateListEgtDOORCreator()
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False
Return True
End Function
Private Function RefreshTemplateListEgtDOORCreator() As Boolean
For IndexHardw As Integer = 0 To Map.refCompoPanelVM.CompoTypeList.Count - 1
If m_HardwareGeneral.DDFName = Map.refCompoPanelVM.CompoTypeList(IndexHardw).DDFName Then
Map.refCompoPanelVM.CompoTypeList(IndexHardw).LoadListTemplate()
Return True
Exit For
End If
Next
Return False
End Function
Public Function ConvertValueForLua(ByRef sValue As String) As Boolean
Dim NameParam = Utility.FindNameParam(sValue)
If String.IsNullOrEmpty(NameParam) Then Return False
For IndexGroupChapters As Integer = 0 To m_GroupChapters.Count - 1
For IndexChapter As Integer = 0 To m_GroupChapters(IndexGroupChapters).CompoParamList.Count - 1
If m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter).DDFName = NameParam Then
If TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxDGCParam Then
Dim Text As TextBoxDGCParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxDGCParam)
sValue = String.Empty
Select Case Text.TypeVar
Case "inch"
If OptionModule.m_SelectedMeasureUnit = "Inches" Then
sValue = Text.TypeVar & "( " & Text.Value & ")"
Else
sValue = Text.Value
If MmToInches(sValue) Then sValue = Text.TypeVar & "( " & sValue & ")"
End If
Case "mm"
If OptionModule.m_SelectedMeasureUnit = "Inches" Then
sValue = Text.Value
InchesToMm(sValue)
Else
sValue = Text.Value
End If
End Select
sValue &= " + " & Text.SelConst
Return True
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxParam Then
Dim Text As TextBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxParam)
sValue = String.Empty
' controllo il tipo di dato che si aspetta
Select Case Text.TypeVar
Case "inch"
If OptionModule.m_SelectedMeasureUnit = "Inches" Then
sValue = Text.TypeVar & "( " & Text.Value & ")"
Else
sValue = Text.Value
If MmToInches(sValue) Then sValue = Text.TypeVar & "( " & sValue & ")"
End If
Case "mm"
If OptionModule.m_SelectedMeasureUnit = "Inches" Then
sValue = Text.Value
InchesToMm(sValue)
Else
sValue = Text.Value
End If
Case "double"
sValue = Text.Value
Case "string"
sValue = "'" & Text.Value & "'"
End Select
Return True
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is CheckBoxParam Then
Dim Text As CheckBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), CheckBoxParam)
sValue = String.Empty
If Text.IsChecked = True Then sValue = " true" Else sValue = " false"
Return True
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is ComboBoxParam Then
'-- attenzione a quando abbiamo da stampare delle stringhe! e non dei valori numerici
Dim Text As ComboBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), ComboBoxParam)
sValue = String.Empty
For Index As Integer = 0 To Text.ItemList.Count - 1
If Text.SelItem = Text.ItemList(Index) Then sValue = Text.ItemListDDF(Index) : Return True
Next
sValue = Text.SelItem
Return True
End If
End If
Next
Next
Return True
End Function
' lista delle riposte della funzione SaveControl
Enum SaveResult As Integer
nYes
nNo
nCancel
End Enum
' restituisce il messaggio della selezione
Public Function SaveControl() As SaveResult
If Not Map.refMainWindowVM.ProjectNameMsg.Contains("*") Then Return SaveResult.nNo
Select Case MessageBox.Show("Do you want to save the current changes?", "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
Case MessageBoxResult.Yes ' decido di salvare
Save()
Return SaveResult.nYes
Case MessageBoxResult.No ' decido di non salvare
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False
Return SaveResult.nNo
Case Else ' altrimenti interrompi sempre
Return SaveResult.nCancel
End Select
End Function
#End Region ' Salvataggio, Duplica, Aggiorna
Public Sub New()
' ogni nuovo hardware che creao devo avere la lista di componenti vuota
Me.ClearGroupChapters()
End Sub
#End Region ' Genaral Function
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
End Class
Public Class TypeHardware
Inherits VMBase
Private m_Name As String
Public Property Name As String
Get
Return m_Name
End Get
Set(value As String)
m_Name = value
End Set
End Property
Private m_NameINI As String
Public Property NameINI As String
Get
Return m_NameINI
End Get
Set(value As String)
m_NameINI = value
End Set
End Property
Sub New(Name As String, NameINI As String)
m_Name = Name
m_NameINI = NameINI
NotifyPropertyChanged("Name")
NotifyPropertyChanged("NameINI")
End Sub
End Class
+280
View File
@@ -0,0 +1,280 @@
<UserControl x:Class="HardwarePageV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:EgtDOORCreator"
xmlns:EgtDOORCreator="clr-namespace:EgtDOORCreator">
<UserControl.Resources>
<EgtDOORCreator:SplitConverter x:Key="SplitConverter"/>
<local:DoorVisibilityConverter x:Key="DoorVisibilityConverter"/>
<local:TemplateListConverter x:Key="TemplateListConverter"/>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<!-- Colonna dedicata alla lista dei bottoni -->
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid.InputBindings>
<KeyBinding Key="Enter" Command="{Binding DataContext.RefreshCmd,RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
<KeyBinding Key="F1" Command="{Binding DataContext.GuideCmd,RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
</Grid.InputBindings>
<!-- La griglia che gestirà i parametri hardaware -->
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<!-- Deicata al general dell'hardware-->
<RowDefinition Height="Auto"/>
<!-- dedicata alla lista dei parametri dell'hardware-->
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<!-- Genaral Hardware-->
<GroupBox Grid.Row="0" Grid.Column="0" Visibility="{Binding VisibilityGeneral}">
<GroupBox.Header>
<StackPanel Orientation="Horizontal">
<!-- titolo del general-->
<TextBlock Text="{Binding GeneralMsg}" Width="Auto"/>
</StackPanel>
</GroupBox.Header>
<!-- Griglia per gestire la disposizione nel General-->
<Grid>
<!-- 3 colonne uguali -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<!-- 1 riga -->
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<!-- Nome della prima sottocartella dopo "Hinges"-->
<TextBlock Grid.Row="0" Grid.Column="0" Margin="2,0,0,2"
Text="{Binding BrandMsg}"
Style="{StaticResource DoorParamsTxBl}"/>
<ComboBox Grid.Row="0" Grid.Column="1" Margin="0.4,2,39.6,3.2"
ItemsSource="{Binding CurrHardware.BrandList}"
SelectedItem="{Binding CurrHardware.SelBrand}"
Style="{StaticResource DoorParamsCmBx}" Height="Auto"/>
<!-- Nome del template "StdCon" -->
<TextBlock Grid.Row="1" Grid.Column="0" Margin="2,0,0,2"
Text="{Binding TemplateMsg}"
Visibility="{Binding CurrHardware.VisibilityTemplate}"
Style="{StaticResource DoorParamsTxBl}"/>
<ComboBox Grid.Row="1" Grid.Column="1" Margin="0.4,2,39.6,3.2"
ItemsSource="{Binding CurrHardware.TemplateList}"
SelectedItem="{Binding CurrHardware.SelTemplate}"
Visibility="{Binding CurrHardware.VisibilityTemplate}"
Style="{StaticResource DoorParamsCmBx}" Height="Auto"/>
<TextBox Grid.Row="1" Grid.Column="1" Margin="0.4,2,39.6,3.2"
Text="{Binding CurrHardware.TemplateName}"
Visibility="{Binding CurrHardware.VisibilityTextTemplate}"
Style="{StaticResource DoorParamsTxBx}"/>
<!-- tipologia di template "Mort/Con" -->
<TextBlock Grid.Row="2" Grid.Column="0" Margin="2,0,0,2"
Text="{Binding TypeMsg}"
Style="{StaticResource DoorParamsTxBl}"
Visibility="{Binding CurrHardware.VisibilityType}"/>
<ComboBox Grid.Row="2" Grid.Column="1" Margin="0.4,2,39.6,3.2"
ItemsSource="{Binding CurrHardware.TypeListName}"
SelectedItem="{Binding CurrHardware.SelType}"
Style="{StaticResource DoorParamsCmBx}" Height="Auto"
IsEnabled="{Binding CurrHardware.IsEnableType}"
Visibility="{Binding CurrHardware.VisibilityType}"/>
<!-- Griglia per gestire la disposizione nel General-->
</Grid>
</GroupBox>
<!-- Gestione delle liste di parametri dell'hardware -->
<ItemsControl Grid.Row="1" Grid.Column="1"
Name="HardwareParamsItemsControl"
ItemsSource="{Binding CurrHardware.GroupChapters}"
Style="{StaticResource DoorParamsItemsControlStyle}">
<!--<ItemsControl.InputBindings>
<KeyBinding Key="Enter" Command="{Binding RefreshCmd}"/>
</ItemsControl.InputBindings>-->
<ItemsControl.ItemTemplate>
<DataTemplate>
<!-- Titolo della lista dei parametri -->
<Expander Width="{Binding ActualWidth,ElementName=HardwareParamsItemsControl,
Converter={StaticResource SplitConverter},ConverterParameter=2}">
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding TemplateName}" Width="Auto"/>
</StackPanel>
</Expander.Header>
<!-- Racchiudo i parametri dentro un GroupBox -->
<GroupBox >
<StackPanel >
<!-- Gestione della lista di parametri dell'hardware -->
<ItemsControl ItemsSource="{Binding CompoParamList}">
<!-- Gestione degli oggetti da caricare nella lista -->
<ItemsControl.Resources>
<!-- Gestione della ComboBoxParam -->
<DataTemplate DataType="{x:Type local:ComboBoxParam}">
<UniformGrid Columns="2">
<TextBlock Text="{Binding Name}"
Margin="0,2,0,2"
Style="{StaticResource DoorParamsTxBl}">
<TextBlock.ToolTip>
<Image Source="c:\Users\Nicola\Desktop\GuideDocuments\ImgIsometrciConcealedHing2.png"/>
</TextBlock.ToolTip>
</TextBlock>
<ComboBox ItemsSource="{Binding ItemList}" Margin="0,2,0,2"
SelectedItem="{Binding SelItem}"
Style="{StaticResource DoorParamsCmBx}"
IsEnabled="{Binding IsRaedOnly}"/>
</UniformGrid>
</DataTemplate>
<!-- Gestione della ComboBoxParamOnOff -->
<DataTemplate DataType="{x:Type local:ComboBoxOnOffParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<CheckBox Name="ChBxBox" IsChecked="{Binding IsActive}"
Style="{StaticResource DoorParamsChBx}"
VerticalAlignment="Top"/>
<TextBlock Text="{Binding Name}" Grid.Column="1"
Style="{StaticResource DoorParamsTxBl}"
Margin="0,2,0,2"/>
</Grid>
<ComboBox ItemsSource="{Binding ItemList}" Grid.Column="2"
Margin="0,2,0,2"
SelectedItem="{Binding SelItem}"
Style="{StaticResource DoorParamsCmBx}"
IsEnabled="{Binding IsChecked, ElementName=ChBxBox}"/>
</Grid>
</DataTemplate>
<!-- Gestione della TextBoxParam -->
<DataTemplate DataType="{x:Type local:TextBoxParam}">
<UniformGrid Columns="2">
<!--<UniformGrid.InputBindings>
<KeyBinding Key="Enter" Command="{Binding DataContext.RefreshCmd,RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
FocusManager.FocusedElement="{Binding ElementName=Stk}"/>
</UniformGrid.InputBindings>-->
<TextBlock Text="{Binding Name}"
Margin="0,2,0,2"
Style="{StaticResource DoorParamsTxBl}"/>
<TextBox Text="{Binding Value,UpdateSourceTrigger=PropertyChanged}"
Name="TxTData"
Style="{StaticResource DoorParamsTxBx}"
Margin="0,2,0,2"
ToolTip="{Binding ToolTipValue}"/>
</UniformGrid>
</DataTemplate>
<!-- Gestione della TextBoxDGCParam -->
<DataTemplate DataType="{x:Type local:TextBoxDGCParam}">
<Grid>
<!-- 3 colonne uguali -->
<Grid.ColumnDefinitions>
<!-- Nome Parametro-->
<ColumnDefinition Width="10*"/>
<!-- Valore Parametro-->
<ColumnDefinition Width="5*"/>
<!-- Simbolo di somma-->
<ColumnDefinition Width="0.6*"/>
<!-- Combo delle costanti-->
<ColumnDefinition Width="4.1*"/>
</Grid.ColumnDefinitions>
<!-- 1 riga -->
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding Name}"
Margin="0,2,0,2"
Style="{StaticResource DoorParamsTxBl}"/>
<TextBox Grid.Column="1"
Text="{Binding Value,UpdateSourceTrigger=PropertyChanged}"
Name="TxTData"
Style="{StaticResource DoorParamsTxBx}"
Margin="-3,2,0,2"
ToolTip="{Binding ToolTipValue}"/>
<TextBlock Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="+"
Margin="0,2,0,2"/>
<ComboBox ItemsSource="{Binding ConstList}" Grid.Column="3"
Margin="0,2,0,2"
SelectedItem="{Binding SelConst}"
Style="{StaticResource DoorParamsCmBx}"/>
</Grid>
</DataTemplate>
<!-- Gestione della CheckBoxParam -->
<DataTemplate DataType="{x:Type local:CheckBoxParam}">
<UniformGrid Columns="2">
<!--<UniformGrid.InputBindings>
<KeyBinding Key="Enter" Command="{Binding DataContext.RefreshCmd,RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
FocusManager.FocusedElement="{Binding ElementName=Stk}"/>
</UniformGrid.InputBindings>-->
<TextBlock Text="{Binding Name}"
Margin="0,2,0,2"
Style="{StaticResource DoorParamsTxBl}"/>
<CheckBox IsChecked="{Binding IsChecked,UpdateSourceTrigger=PropertyChanged}"
Name="TxTData"
Style="{StaticResource DoorParamsChBx}"
HorizontalContentAlignment="Left"
Margin="0,2,0,2"
ToolTip="{Binding ToolTipValue}"/>
</UniformGrid>
</DataTemplate>
<!-- Gestione della TextBoxParamOnOffParam -->
<DataTemplate DataType="{x:Type local:TextBoxOnOffParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<CheckBox Name="ChBx" IsChecked="{Binding IsActive}"
Style="{StaticResource DoorParamsChBx}"
VerticalAlignment="Top"/>
<TextBlock Text="{Binding Name}" Grid.Column="1"
Style="{StaticResource DoorParamsTxBl}"
Margin="0,2,0,2"/>
</Grid>
<TextBox Text="{Binding Value,UpdateSourceTrigger=PropertyChanged}" Grid.Column="2"
Style="{StaticResource DoorParamsTxBx}"
IsEnabled="{Binding IsChecked, ElementName=ChBx}"
Margin="0,2,0,2"
ToolTip="{Binding ToolTipValue,UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</DataTemplate>
</ItemsControl.Resources>
<!-- Fine gestione oggetti lsta -->
</ItemsControl>
</StackPanel>
</GroupBox>
</Expander>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- Fine griglia che gestirà i parametri hardaware -->
</Grid>
<!-- Elenco pulsanti Hardware -->
<ContentControl Grid.Column="0" Grid.Row="0" Content="{Binding CompoPanelControl}"/>
<!--<EgtDOORCreator:CompoPanelV Grid.Column="0" DataContext="{Binding CompoPanelHardware}"/>-->
</Grid>
</UserControl>
+3
View File
@@ -0,0 +1,3 @@
Public Class HardwarePageV
End Class
+142
View File
@@ -0,0 +1,142 @@
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.IO
Imports EgtUILib
Imports System.Text.RegularExpressions
Imports EgtWPFLib5
Public Class HardwarePageVM
Inherits VMBase
Private m_Door As Part
Public Property Door As Part
Get
Return m_Door
End Get
Set(value As Part)
m_Door = value
NotifyPropertyChanged("Door")
End Set
End Property
Private m_CurrHardware As Hardware
Public Property CurrHardware As Hardware
Get
Return m_CurrHardware
End Get
Set(value As Hardware)
m_CurrHardware = value
NotifyPropertyChanged("CurrHardware")
End Set
End Property
' l'elenco dei bottoni
Private m_CompoPanelPart As ContentControl
Public Property CompoPanelControl As ContentControl
Get
Return m_CompoPanelPart
End Get
Set(value As ContentControl)
m_CompoPanelPart = value
End Set
End Property
' mostra la visibilità del general della pagina
Private m_VisibilityGeneral As Visibility = Visibility.Collapsed
Public Property VisibilityGeneral As Visibility
Get
Return m_VisibilityGeneral
End Get
Set(value As Visibility)
m_VisibilityGeneral = value
NotifyPropertyChanged("VisibilityGeneral")
End Set
End Property
#Region "MESSAGES"
Public ReadOnly Property GeneralMsg As String
Get
Return "General"
End Get
End Property
Public ReadOnly Property TemplateMsg As String
Get
Return "Template"
End Get
End Property
Public ReadOnly Property TypeMsg As String
Get
Return "Type"
End Get
End Property
Public ReadOnly Property BrandMsg As String
Get
Return "Brand"
End Get
End Property
#End Region ' Messages
' definizione comando
Private m_EnterRefreshCmd As ICommand
Private m_F1GuideCmd As ICommand
#Region "COMMANDS"
Public ReadOnly Property RefreshCmd As ICommand
Get
If m_EnterRefreshCmd Is Nothing Then
m_EnterRefreshCmd = New Command(AddressOf EnterRefresh)
End If
Return m_EnterRefreshCmd
End Get
End Property
Public Sub EnterRefresh()
Map.refSceneManagerVM.RefreshBtn()
End Sub
' Comando Guida
Public ReadOnly Property GuideCmd As ICommand
Get
If m_F1GuideCmd Is Nothing Then
m_F1GuideCmd = New Command(AddressOf F1Guide)
End If
Return m_F1GuideCmd
End Get
End Property
Public Sub F1Guide()
Dim rfGuideVM As New GuideVM
If String.IsNullOrEmpty(GuideVM.m_AddressGuide) Then
GuideVM.m_AddressGuide = "Test.html"
End If
Map.refProjectManagerVM.Guide()
End Sub
#End Region ' Command
Public Function CreateDoor() As Boolean
Dim Hardware As String = String.Empty
' questa stringa serve solo per costruire un overload della sub New!
Dim ref_Door As New Part(Hardware)
Door = ref_Door
Dim sTempFile As String = IniFile.m_sTempDir & "\" & TEMP_FILE
DdfFile.WriteDDFPartForTestHardware(Door, sTempFile, False, False)
ExecDoors(Map.refSceneManagerVM.ProjectScene, sTempFile)
Return True
End Function
Sub New()
Map.SetRefHardwarePageVM(Me)
' se non esiste la lista dei componenti per l'HardwareManager viene creata nuova
If IsNothing(Map.refCompoPanelHardwareVM) Then Map.SetRefCompoPaneHardwarelVM(New CompoPanelVM("HardwarePage"))
' se il ContentControl è vuoto allora viene creato nuovo
If IsNothing(m_CompoPanelPart) Then m_CompoPanelPart = New CompoPanelHardwareV
m_CompoPanelPart.DataContext = Map.refCompoPanelHardwareVM
End Sub
End Class
+33
View File
@@ -48,6 +48,8 @@ Friend Module IniFile
Friend m_DDFFilePath As String = String.Empty
' Path Doors directory
Friend m_sDoorsDirPath As String = String.Empty
' Path StdTemplate.ini
Friend m_StdTemplate As String = String.Empty ' il percorso viene aggiornato ad ogni scelta dell'hardware in LoadType()
' EgtDoorCreator.ini
Public Function GetPrivateProfileLanguage(ByVal lpAppName As String, ByVal lpKeyName As String) As Language
@@ -128,6 +130,37 @@ Friend Module IniFile
Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_DefaultIniFile)
End Function
' StdTemplate.ini
Public Function StdTemplateGetPrivateProfileString(IpAppName As String, IpKeyName As String, IpDefault As String, ByRef IpString As String) As Integer
Return EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, m_StdTemplate)
End Function
Public Function StdTemplateGetPrivateProfileList(ByVal lpAppName As String, ByVal lpKeyName As String, ByVal List As List(Of String)) As Boolean
Dim sVal As String = String.Empty
StdTemplateGetPrivateProfileString(lpAppName, lpKeyName, "", sVal)
If String.IsNullOrEmpty(sVal) Then Return False
Dim sItems() As String = sVal.Split(",".ToCharArray)
' se la lista ha almeno un elemento
If sItems.Count > 0 Then
For Index = 0 To sItems.Count() - 1
List.Add(Trim(sItems(Index)))
Next
End If
Return True
End Function
Public Function StdTemplateGetPrivateProfileChapterName(ByVal lpAppName As String, ByVal lpKeyName As String, ByRef sValueLua As String, ByRef sValue As String) As Boolean
Dim sVal As String = String.Empty
StdTemplateGetPrivateProfileString(lpAppName, lpKeyName, "", sVal)
If String.IsNullOrEmpty(sVal) Then Return False
Dim sItems() As String = sVal.Split("/".ToCharArray)
' se la lista ha almeno un elemento
If sItems.Count = 0 Then Return False
If sItems.Count > 0 Then sValueLua = sItems(0)
If sItems.Count > 1 Then sValue = sItems(1)
Return True
End Function
' Config.ini di ciascun direttorio dei componenti (deve ricevere anche la path completa del file)
Public Function GetPrivateProfileCompoName(IpAppName As String, IpKeyName As String, ByRef DDFName As String, ByRef Name As String, CompoIniPath As String) As Boolean
Dim sVal As String = String.Empty
+9 -5
View File
@@ -14,9 +14,12 @@
<KeyBinding Key="F1" Command="{Binding OptionGuideCmd}"/>
</EgtWPFLib5:EgtCustomWindow.InputBindings>
<EgtWPFLib5:EgtCustomWindow.TitlePanel>
<EgtDOORCreator:ProjectManagerV DataContext="{StaticResource ProjectManagerVM}"/>
<!--<EgtDOORCreator:ProjectManagerHardwareV DataContext="{StaticResource ProjectManagerHardwareVM}"/>-->
<UniformGrid Rows="1">
<ContentControl Content="{Binding ProjectManagerControl}"/>
</UniformGrid>
</EgtWPFLib5:EgtCustomWindow.TitlePanel>
<Grid>
<Grid.ColumnDefinitions>
<!--<ColumnDefinition Width="1*"/>-->
@@ -24,11 +27,12 @@
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<EgtDOORCreator:AssemblyManagerV Grid.Column="0" DataContext="{StaticResource AssemblyManagerVM}"/>
<!--<EgtDOORCreator:AssemblyManagerV Grid.Column="0" DataContext="{StaticResource AssemblyManagerVM}"/>-->
<ContentControl Grid.Column="0" Grid.Row="0" Content="{Binding AssemblyManagerControl}"/>
<ContentControl Grid.Column="0" Grid.Row="1" Content="{Binding PageControl}"/>
<EgtDOORCreator:SceneManagerV Grid.Column="1" Grid.RowSpan="2" DataContext="{StaticResource SceneManagerVM}"/>
+101 -46
View File
@@ -9,14 +9,23 @@ Public Class MainWindowVM
' Modello del MainWindow (classe vera e propria)
Private m_MainWindowModel As New MainWindowModel
Private m_VisibilityAssemblyManager As Visibility = Visibility.Visible
Public Property VisibilityAssemblyManager As Visibility
Get
Return m_VisibilityAssemblyManager
End Get
Set(value As Visibility)
m_VisibilityAssemblyManager = value
NotifyPropertyChanged("VisibilityAssemblyManager")
End Set
End Property
Private m_ProjectNameMsg As String
Public Property ProjectNameMsg As String
Get
Return m_ProjectNameMsg
End Get
Set(value As String)
' sostituisco il nome del direttorio con il path completo
'm_ProjectNameMsg = "EgtDOORCreator - " & SetTitle(value)
m_ProjectNameMsg = "EgtDOORCreator - " & value
NotifyPropertyChanged("ProjectNameMsg")
End Set
@@ -47,6 +56,7 @@ Public Class MainWindowVM
nNothingSelected
nAssemblyPage
nDDFPage
nHardwarePage
End Enum
Private m_SelectedPage As ListPageEnum
@@ -60,17 +70,57 @@ Public Class MainWindowVM
End Set
End Property
Private m_ProjectManagerHardware As ProjectManagerHardwareV
Private m_ProjectManager As ProjectManagerV
Private m_AssemblyManager As AssemblyManagerV
Private m_PartPage As PartPageV
Private m_AssemblyPage As AssemblyPageV
Private m_HardwarePage As HardwarePageV
Public ReadOnly Property PageControl As ContentControl
Get
If m_SelectedPage = ListPageEnum.nDDFPage Then
Return m_PartPage
ElseIf m_SelectedPage = ListPageEnum.nAssemblyPage Then
Return m_AssemblyPage
Else
Return Nothing
End If
VisibilityAssemblyManager = Visibility.Visible
NotifyPropertyChanged("AssemblyManagerControl")
NotifyPropertyChanged("ProjectManagerControl")
Return m_PartPage
ElseIf m_SelectedPage = ListPageEnum.nAssemblyPage Then
VisibilityAssemblyManager = Visibility.Visible
NotifyPropertyChanged("AssemblyManagerControl")
NotifyPropertyChanged("ProjectManagerControl")
Return m_AssemblyPage
ElseIf m_SelectedPage = ListPageEnum.nHardwarePage Then
VisibilityAssemblyManager = Visibility.Collapsed
NotifyPropertyChanged("AssemblyManagerControl")
NotifyPropertyChanged("ProjectManagerControl")
Return m_HardwarePage
Else
VisibilityAssemblyManager = Visibility.Visible
NotifyPropertyChanged("AssemblyManagerControl")
NotifyPropertyChanged("ProjectManagerControl")
Return Nothing
End If
End Get
End Property
Public ReadOnly Property AssemblyManagerControl As ContentControl
Get
If VisibilityAssemblyManager = Visibility.Visible Then
Return m_AssemblyManager
Else
Return Nothing
End If
End Get
End Property
Public ReadOnly Property ProjectManagerControl As ContentControl
Get
If VisibilityAssemblyManager = Visibility.Visible Then
Return m_ProjectManager
Else
ProjectNameMsg = "HardwareManager"
Return m_ProjectManagerHardware
End If
End Get
End Property
@@ -78,8 +128,16 @@ Public Class MainWindowVM
Map.SetRefMainWindowVM(Me)
m_AssemblyPage = New AssemblyPageV
m_AssemblyPage.DataContext = New AssemblyPageVM
m_ProjectManagerHardware = New ProjectManagerHardwareV
m_ProjectManagerHardware.DataContext = New ProjectManagerHardwareVM
m_ProjectManager = New ProjectManagerV
m_ProjectManager.DataContext = New ProjectManagerVM
m_PartPage = New PartPageV
m_PartPage.DataContext = New PartPageVM
m_HardwarePage = New HardwarePageV
m_HardwarePage.DataContext = New HardwarePageVM
m_AssemblyManager = New AssemblyManagerV
m_AssemblyManager.DataContext = New AssemblyManagerVM
End Sub
' Comandi
@@ -109,32 +167,6 @@ Public Class MainWindowVM
End Select
End Sub
' questa funzione restituisce il nome del direttorio corrente
Friend Function SetTitle(DirectoryTitle As String) As String
If Not String.IsNullOrWhiteSpace(DirectoryTitle) Then
Dim Items() As String = DirectoryTitle.Split("\".ToCharArray)
If Items.Count = 1 Then
Items = DirectoryTitle.Split("-".ToCharArray)
End If
' restituisco il nome dell'ultimo direttorio aperto
DirectoryTitle = Items(Items.Count - 1)
End If
Return DirectoryTitle
End Function
'Friend Sub ModifyTitle(bModified As Boolean)
' If bModified Then
' If Not m_ProjectNameMsg(m_ProjectNameMsg.Count - 1) = "*" Then
' ProjectNameMsg &= "*"
' End If
' Else
' If m_ProjectNameMsg(m_ProjectNameMsg.Count - 1) = "*" Then
' ProjectNameMsg.Trim("*"c)
' End If
' End If
'End Sub
#Region "AboutBoxCommand"
' Returns a command that manage the MainWindow_Unloaded command
@@ -175,18 +207,41 @@ Public Class MainWindowVM
''' </summary>
Public Sub CloseApplication(ByVal param As Object)
' verifico se selezionato esiste e modificato
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) AndAlso Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified Then
Dim sText As String = String.Format(EgtMsg(50109), Path.GetFileNameWithoutExtension(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name))
Select Case MessageBox.Show(sText, "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
Case MessageBoxResult.Yes
Map.refAssemblyManagerVM.Save(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
If Not DdfFile.DDFIsCorrect Then Return ' se il ddf non è corretto non permetto il salvataggio
Case MessageBoxResult.No
' Non faccio alcunchè
Case MessageBoxResult.Cancel
Return
End Select
End If
Select Case SelectedPage
Case ListPageEnum.nHardwarePage
If Not IsNothing(Map.refHardwarePageVM) And Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
If Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nCancel Then
Return
ElseIf Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nYes Then
Map.refHardwarePageVM.CurrHardware.Save()
End If
End If
Case Else
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) AndAlso Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified Then
Dim sText As String = String.Format(EgtMsg(50109), Path.GetFileNameWithoutExtension(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name))
Select Case MessageBox.Show(sText, "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
Case MessageBoxResult.Yes
Map.refAssemblyManagerVM.Save(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
If Not DdfFile.DDFIsCorrect Then Return ' se il ddf non è corretto non permetto il salvataggio
Case MessageBoxResult.No
' Non faccio alcunchè
Case MessageBoxResult.Cancel
Return
End Select
End If
End Select
'If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) AndAlso Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified Then
' Dim sText As String = String.Format(EgtMsg(50109), Path.GetFileNameWithoutExtension(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name))
' Select Case MessageBox.Show(sText, "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
' Case MessageBoxResult.Yes
' Map.refAssemblyManagerVM.Save(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName)
' If Not DdfFile.DDFIsCorrect Then Return ' se il ddf non è corretto non permetto il salvataggio
' Case MessageBoxResult.No
' ' Non faccio alcunchè
' Case MessageBoxResult.Cancel
' Return
' End Select
'End If
' scrivo il nome dell'ultimo file aperto
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) Then
WriteMainPrivateProfileString(S_LAUNCHERWINDOW, K_LASTPROJECT, Map.refAssemblyManagerVM.CurrProject.Name)
+36 -2
View File
@@ -3,7 +3,9 @@
Private m_refMainWindowVM As MainWindowVM
Private m_refStatusBarVM As StatusBarVM
Private m_refProjectManagerVM As ProjectManagerVM
Private m_refProjectManagerHardwareVM As ProjectManagerHardwareVM
Private m_refCompoPanelVM As CompoPanelVM
Private m_refCompoPanelHardwareVM As CompoPanelVM
Private m_refAssemblyManagerVM As AssemblyManagerVM
Private m_refPartPageVM As PartPageVM
Private m_refSceneManagerVM As SceneManagerVM
@@ -14,7 +16,7 @@
Private m_refShowPanelVM As ShowPanelVM
Private m_refAssemblyPageVM As AssemblyPageVM
Private m_refHardwarePageVM As HardwarePageVM
Private m_refOrderVM As OrderVM
Private m_refOptionsVM As OptionsVM
@@ -39,12 +41,24 @@
End Get
End Property
Public ReadOnly Property refProjectManagerHardwareVM As ProjectManagerHardwareVM
Get
Return m_refProjectManagerHardwareVM
End Get
End Property
Public ReadOnly Property refCompoPanelVM As CompoPanelVM
Get
Return m_refCompoPanelVM
End Get
End Property
Public ReadOnly Property refCompoPanelHardwareVM As CompoPanelVM
Get
Return m_refCompoPanelHardwareVM
End Get
End Property
Public ReadOnly Property refAssemblyManagerVM As AssemblyManagerVM
Get
Return m_refAssemblyManagerVM
@@ -105,6 +119,12 @@
End Get
End Property
Public ReadOnly Property refHardwarePageVM As HardwarePageVM
Get
Return m_refHardwarePageVM
End Get
End Property
#End Region ' Get
#Region "Set"
@@ -124,11 +144,21 @@
Return Not IsNothing(m_refProjectManagerVM)
End Function
Friend Function SetRefProjectManagerHardwareVM(ProjectManagerHardwareVM As ProjectManagerHardwareVM) As Boolean
m_refProjectManagerHardwareVM = ProjectManagerHardwareVM
Return Not IsNothing(m_refProjectManagerHardwareVM)
End Function
Friend Function SetRefCompoPanelVM(CompoPanelVM As CompoPanelVM) As Boolean
m_refCompoPanelVM = CompoPanelVM
Return Not IsNothing(m_refCompoPanelVM)
End Function
Friend Function SetRefCompoPaneHardwarelVM(CompoPanelHardwareVM As CompoPanelVM) As Boolean
m_refCompoPanelHardwareVM = CompoPanelHardwareVM
Return Not IsNothing(m_refCompoPanelHardwareVM)
End Function
Friend Function SetRefDoorManagerVM(DoorManagerVM As AssemblyManagerVM) As Boolean
m_refAssemblyManagerVM = DoorManagerVM
Return Not IsNothing(m_refAssemblyManagerVM)
@@ -179,6 +209,11 @@
Return Not IsNothing(m_refOptionsVM)
End Function
Friend Function SetRefHardwarePageVM(HardwarePageVM As HardwarePageVM) As Boolean
m_refHardwarePageVM = HardwarePageVM
Return Not IsNothing(m_refHardwarePageVM)
End Function
#End Region ' Set
#Region "Init"
@@ -194,7 +229,6 @@
Not IsNothing(m_refProjectManagerVM) AndAlso Not IsNothing(m_refCompoPanelVM) AndAlso
Not IsNothing(m_refAssemblyManagerVM) AndAlso Not IsNothing(m_refPartPageVM) AndAlso
Not IsNothing(m_refSceneManagerVM) AndAlso Not IsNothing(m_refOptionsVM)
End Function
#End Region ' Init
+50
View File
@@ -0,0 +1,50 @@
<EgtWPFLib5:EgtCustomWindow x:Class="NewHardwareV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="{Binding Title}" Icon="/Resources/EgtDOOR.ico"
TitleBarBrush="{StaticResource EgaltechBlue1}"
BorderBrush="{StaticResource EgaltechBlue1}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
CloseCommand="{Binding CloseOptionsCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"
Height="140" Width="350">
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.6*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<!--<RowDefinition Height="1*"/>-->
</Grid.RowDefinitions>
<ComboBox Grid.Column="1" Grid.Row="0"
ItemsSource="{Binding BrandList}"
SelectedItem="{Binding SelBrand}"
Style="{StaticResource DoorParamsCmBx}"
Margin="0,2,15,2"/>
<TextBlock Grid.Column="0" Grid.Row="0"
Text="{Binding BrandMsg}" VerticalAlignment="Center"
Margin="15,2,0,0"
Style="{StaticResource DoorParamsTxBl}"/>
<TextBox Grid.Column="1" Grid.Row="1"
Text="{Binding Template}"
Style="{StaticResource DoorParamsTxBx}"
Margin="0,2,15,0"/>
<TextBlock Grid.Column="0" Grid.Row="1" Text="{Binding TemplateMsg}" VerticalAlignment="Center"
Margin="15,2,0,0"
Style="{StaticResource DoorParamsTxBl}"/>
<UniformGrid Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Columns="2">
<Button Grid.Column="0" Content="Save"
Margin="55,5,55,3"
Command="{Binding SaveCmd}"/>
<Button Grid.Column="1" Content="Cancel"
Margin="55,5,55,3"
Command="{Binding CancelCmd}"/>
</UniformGrid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
+3
View File
@@ -0,0 +1,3 @@
Public Class NewHardwareV
End Class
+142
View File
@@ -0,0 +1,142 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtWPFLib5
' la finestra associata a queta classe serve per gestire la creazione di una copia (ivocata dal bottone Duplica)
Public Class NewHardwareVM
Inherits VMBase
Public ReadOnly Property Title As String
Get
Return "New Hardware"
End Get
End Property
Public ReadOnly Property BrandMsg As String
Get
Return "Brand"
End Get
End Property
Public ReadOnly Property TemplateMsg As String
Get
Return "Template"
End Get
End Property
' Comandi
Private m_cmdSave As ICommand
Private m_cmdCancel As ICommand
Private m_CmdCloseNewHardware As ICommand
Private m_HardwareGeneral As CompoType
Private m_BrandList As New ObservableCollection(Of String)
Public Property BrandList As ObservableCollection(Of String)
Get
Return m_BrandList
End Get
Set(value As ObservableCollection(Of String))
m_BrandList = value
End Set
End Property
Private m_SelBrand As String
Public Property SelBrand As String
Get
Return m_SelBrand
End Get
Set(value As String)
m_SelBrand = value
NotifyPropertyChanged("SelBrand")
End Set
End Property
Private m_Template As String
Public Property Template As String
Get
Return m_Template
End Get
Set(value As String)
m_Template = value
End Set
End Property
Sub New(HardwareGeneral As CompoType)
m_HardwareGeneral = HardwareGeneral
Dim ModelList As New ObservableCollection(Of CompoBrandDir)
GetDirectoryCompoModel(HardwareGeneral.Path, ModelList)
If ModelList.Count > 0 Then
For IndexModel As Integer = 0 To ModelList.Count - 1
m_BrandList.Add(ModelList(IndexModel).ModelDirGraphic)
Next
NotifyPropertyChanged("BrandList")
Dim SelItemindex As Integer = 0
While Path.HasExtension(m_BrandList(SelItemindex)) And SelItemindex < m_BrandList.Count - 1
SelItemindex += 1
End While
SelBrand = m_BrandList(SelItemindex)
Template = "File Name"
End If
End Sub
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property SaveCmd() As ICommand
Get
If m_cmdSave Is Nothing Then
m_cmdSave = New Command(AddressOf Save)
End If
Return m_cmdSave
End Get
End Property
Public Sub Save(ByVal param As Object)
If Map.refHardwarePageVM.CurrHardware.Duplicate(Trim(m_SelBrand), Trim(m_Template)) Then CloseNewHardware()
End Sub
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property CancelCmd() As ICommand
Get
If m_cmdCancel Is Nothing Then
m_cmdCancel = New Command(AddressOf Cancel)
End If
Return m_cmdCancel
End Get
End Property
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Sub Cancel(ByVal param As Object)
CloseNewHardware()
End Sub
#Region "CloseNewHardwareCommand"
''' <summary>
''' Returns a command that remove the current selected machining.
''' </summary>
Public ReadOnly Property CloseNewHardwareCmd() As ICommand
Get
If m_CmdCloseNewHardware Is Nothing Then
m_CmdCloseNewHardware = New Command(AddressOf CloseNewHardware)
End If
Return m_CmdCloseNewHardware
End Get
End Property
''' <summary>
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
''' </summary>
Public Sub CloseNewHardware()
' Chiusura finestra
For Each Window In Application.Current.Windows
If TypeOf Window Is NewHardwareV Then
Dim NewHardwareWindow As NewHardwareV = DirectCast(Window, NewHardwareV)
NewHardwareWindow.Close()
End If
Next
End Sub
#End Region ' CloseOptionsCommand
End Class
+9
View File
@@ -34,6 +34,7 @@ Friend Module OptionModule
End Enum
Friend m_SmartHelp As Boolean = False
Friend m_DisableHM As Boolean = False
Friend m_Width As String
Friend m_Height As String
@@ -199,6 +200,14 @@ Friend Module OptionModule
m_SmartHelp = False
End If
Dim nDisableHM As Integer = 1
nDisableHM = GetMainPrivateProfileInt(S_GENERAL, K_DISABLEHM, 1)
If nDisableHM = 0 Then
m_DisableHM = True
Else
m_DisableHM = False
End If
' leggo il tipo di Bevel selezionato
Dim BevelUp As Visibility
DefaultGetPrivateProfilesBevel(S_EDGE, K_BEVELU_INI, BevelUp)
+86
View File
@@ -0,0 +1,86 @@
<EgtWPFLib5:EgtCustomWindow x:Class="PrintWndV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtDOORCreator="clr-namespace:EgtDOORCreator"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="{Binding Title}" Icon="/Resources/EgtDOOR.ico"
TitleBarBrush="{StaticResource EgaltechBlue1}"
BorderBrush="{StaticResource EgaltechBlue1}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
CloseCommand="{Binding CancelCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="6*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<UniformGrid>
<TextBlock Text="{Binding DimensioningMsg}"
Style="{StaticResource DoorParamsTxBl}"
Margin="2,5,5,0"/>
<ComboBox ItemsSource="{Binding DimensioningList}"
Margin="0,5,5,2"
SelectedItem="{Binding SelDimensioning}"
Style="{StaticResource DoorParamsCmBx}"/>
</UniformGrid>
<GroupBox Margin="5" Grid.Row="1" IsEnabled="{Binding IsEnableCompoList}">
<GroupBox.Header>
<StackPanel>
<TextBlock Text="{Binding HardwareMsg}"/>
</StackPanel>
</GroupBox.Header>
<ItemsControl ItemsSource="{Binding CompoList}" Focusable="True">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="1"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel >
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<CheckBox Grid.Column="0"
IsChecked="{Binding SelectedLayer}"
VerticalAlignment="Center"/>
<TextBlock Grid.Column="1"
VerticalAlignment="Center"
Margin="20,0,0,0"
Style="{StaticResource DoorParamsTxBl}"
Text="{Binding NameHardware}"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</GroupBox>
<UniformGrid Grid.Column="0" Grid.Row="2" VerticalAlignment="Bottom">
<Button Grid.Column="0" VerticalAlignment="Center"
Height="30" Margin="5,0,5,0"
Content="{Binding PrintMsg}"
Command="{Binding PrintCommand}"
ToolTip="{Binding PrintToolTip}"
Focusable="False"/>
<Button Grid.Column="0" VerticalAlignment="Center"
Height="30" Margin="5,0,5,0"
Content="{Binding CancelMsg}"
Command="{Binding CancelCommand}"
ToolTip="{Binding CancelToolTip}"
Focusable="False"/>
</UniformGrid>
<EgtDOORCreator:PrintSceneHostV Grid.Column="1" Grid.RowSpan="3"/>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
+14
View File
@@ -0,0 +1,14 @@
Public Class PrintWndV
Private m_PrintWndVM As PrintWndVM
Sub New(Owner As Window, PrintWndVM As PrintWndVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
Me.DataContext = PrintWndVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_PrintWndVM = PrintWndVM
End Sub
End Class
+258
View File
@@ -0,0 +1,258 @@
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.IO
Imports System.Windows
Imports EgtUILib
Imports EgtWPFLib5
Imports Ionic.Zip
Public Class PrintWndVM
Inherits VMBase
Shared m_Door As Part
#Region "MESSAGES"
Public ReadOnly Property Title As String
Get
Return "Print"
End Get
End Property
Public ReadOnly Property PrintMsg As String
Get
Return "Print"
End Get
End Property
Public ReadOnly Property CancelMsg As String
Get
Return "Cancel"
End Get
End Property
Public ReadOnly Property PrintToolTip As String
Get
Return "Print"
End Get
End Property
Public ReadOnly Property HardwareMsg As String
Get
Return "Hardware"
End Get
End Property
Public ReadOnly Property DimensioningMsg As String
Get
Return "Dimensioning"
End Get
End Property
#End Region ' Messages
Private m_DimensioningList As New ObservableCollection(Of String)({"All", "Door", "Hardware"})
Public ReadOnly Property DimensioningList As ObservableCollection(Of String)
Get
Return m_DimensioningList
End Get
End Property
Private m_SelDimensioning As String = m_DimensioningList(0)
Public Property SelDimensioning As String
Get
Return m_SelDimensioning
End Get
Set(value As String)
m_SelDimensioning = value
Dimensioning()
NotifyPropertyChanged("SelDimensioning")
End Set
End Property
Private m_IsEnableCompoList As Boolean = True
Public ReadOnly Property IsEnableCompoList As Boolean
Get
Return m_IsEnableCompoList
End Get
End Property
' lista degli hardware presenti nelli porta corrente
Private m_CompoList As New ObservableCollection(Of HardwarePrint)
Public Property CompoList As ObservableCollection(Of HardwarePrint)
Get
Return m_CompoList
End Get
Set(value As ObservableCollection(Of HardwarePrint))
m_CompoList = value
End Set
End Property
Private Function Dimensioning() As Boolean
Select Case m_SelDimensioning
Case "All"
m_IsEnableCompoList = True
For IndexCompo As Integer = 0 To m_CompoList.Count - 1
CompoList(IndexCompo).SelectedLayer = True
Next
Case "Door"
m_IsEnableCompoList = False
For IndexCompo As Integer = 0 To m_CompoList.Count - 1
CompoList(IndexCompo).SelectedLayer = False
Next
Case "Hardware"
m_IsEnableCompoList = True
End Select
NotifyPropertyChanged("IsEnableCompoList")
Return True
End Function
Private m_cmdPrint As ICommand
Private m_cmdCancel As ICommand
#Region "PrintCommand"
Public ReadOnly Property PrintCommand As ICommand
Get
If m_cmdPrint Is Nothing Then
m_cmdPrint = New Command(AddressOf Print)
End If
Return m_cmdPrint
End Get
End Property
Public Sub Print(ByVal param As Object)
Dim printDlg As New PrintDialog
If printDlg.ShowDialog() Then
' Recupero le dimensioni dell'area di stampa
Dim dW As Double = printDlg.PrintableAreaWidth
Dim dH As Double = printDlg.PrintableAreaHeight
'' Nascondo la tavola ed eseguo zoom su quello che rimane
'Dim nTabId As Integer = EgtGetTableId(MAIN_TAB)
'EgtSetStatus(nTabId, GDB_ST.OFF)
EgtZoom(ZM.ALL, True)
' Prendo l'immagine per la stampa
Dim colWhite As New Color3d(255, 255, 255)
Dim nImgW As Integer = 4000
Dim nImgH As Integer = 2400
Dim sPath As String = m_sTempDir & "\Image.png"
If Not EgtGetImage(SM.HIDDENLINE, colWhite, colWhite, nImgW, nImgH, sPath) Then
EgtOutLog("Errore creazione immagine di stampa")
Return
End If
'' Ripristino la visualizzazione della tavola
'EgtSetStatus(nTabId, GDB_ST.ON_)
'EgtZoom(ZM.ALL)
'Thread.Sleep(10)
Try
'Metodo complesso di stampa che permette di rilasciare il file :
'carico la bitmap e la metto in uno stream in memoria
Dim stream As System.IO.Stream = New System.IO.MemoryStream()
Dim bitmap As System.Drawing.Bitmap = New System.Drawing.Bitmap(sPath)
bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png)
bitmap.Dispose()
' la sposto in una BitmapImage
Dim bitImage As New System.Windows.Media.Imaging.BitmapImage()
bitImage.BeginInit()
bitImage.StreamSource = stream
bitImage.EndInit()
' la sposto in un Visual Control
Dim tmpImg As New Image
tmpImg.BeginInit()
tmpImg.Source = bitImage
tmpImg.Margin = New Thickness(30)
' ruoto a seconda dell'aspetto della pagina
If (dH > dW And nImgH < nImgW) Or (dH < dW And nImgH > nImgW) Then
tmpImg.LayoutTransform = New RotateTransform(-90)
End If
tmpImg.EndInit()
' eseguo la stampa
printDlg.PrintVisual(tmpImg, "Parts Layout")
Catch
EgtOutLog("Errore esecuzione stampa")
End Try
End If
End Sub
#End Region ' PrintCommand
#Region "CancelCommand"
Public ReadOnly Property CancelCommand() As ICommand
Get
If m_cmdCancel Is Nothing Then
m_cmdCancel = New Command(AddressOf Close)
End If
Return m_cmdCancel
End Get
End Property
Public Sub Close()
' Chiusura finestra
For Each Window In Application.Current.Windows
If TypeOf Window Is PrintWndV Then
Dim CurrWindow As PrintWndV = DirectCast(Window, PrintWndV)
CurrWindow.Close()
End If
Next
EgtSetCurrentContext(Map.refSceneManagerVM.ProjectScene.GetCtx)
End Sub
#End Region ' CancelCommand
Sub New()
m_Door = Map.refPartPageVM.CurrPart
Dim IndexCompoDoor As Integer = 1
Dim IndexCompoPrint As Integer = 0
Dim LocalHardware As New HardwarePrint
If m_Door.CompoList.Count >= 1 Then
LocalHardware.NameHardware = m_Door.CompoList(0).CompoType.Name
LocalHardware.SelectedLayer = True
End If
CompoList.Add(LocalHardware)
While IndexCompoDoor < m_Door.CompoList.Count
If m_CompoList(IndexCompoPrint).NameHardware <> m_Door.CompoList(IndexCompoDoor).CompoType.Name Then
LocalHardware = New HardwarePrint
LocalHardware.NameHardware = m_Door.CompoList(IndexCompoDoor).CompoType.Name
LocalHardware.SelectedLayer = True
m_CompoList.Add(LocalHardware)
IndexCompoPrint += 1
End If
IndexCompoDoor += 1
End While
NotifyPropertyChanged("CompoList")
End Sub
End Class
Public Class HardwarePrint
Inherits VMBase
Private m_NameHardware As String
Public Property NameHardware As String
Get
Return m_NameHardware
End Get
Set(value As String)
m_NameHardware = value
End Set
End Property
Private m_SelectedLayer As Boolean = True
Public Property SelectedLayer As Boolean
Get
Return m_SelectedLayer
End Get
Set(value As Boolean)
m_SelectedLayer = value
NotifyPropertyChanged("SelectedLayer")
End Set
End Property
End Class
+8
View File
@@ -0,0 +1,8 @@
<WindowsFormsHost x:Class="PrintSceneHostV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtUILib="clr-namespace:EgtUILib;assembly=EgtUILib">
<EgtUILib:Scene x:Name="PrintScene"/>
</WindowsFormsHost>
+102
View File
@@ -0,0 +1,102 @@
Imports EgtUILib
Imports EgtWPFLib5
Imports System.IO
Public Class PrintSceneHostV
Private m_SelFromScene As Boolean = False
Friend ReadOnly Property SelFromScene As Boolean
Get
Return m_SelFromScene
End Get
End Property
Public Sub RefreshPrint()
ExecDoorsPrinter(PrintScene, IniFile.m_sTempDir & "\" & TEMP_FILE)
End Sub
Sub New()
' This call is required by the designer.
InitializeComponent()
'' Creo riferimento a questa classe in CompoWindowMap
'CompoWindowMap.SetRefCompoSceneHostV(Me)
' Inizializzazione Scena
PreInitializeScene()
PrintScene.Init()
PostInitializeScene()
' Imposto stato gestione mouse diretto della scena a nessuno
PrintScene.SetStatusNull()
EgtSetCurrentContext(PrintScene.GetCtx)
RefreshPrint()
'EgtNewFile()
'EgtDraw()
'EgtOpenFile(IniFile.m_sTempDir & "\" & Path.ChangeExtension(TEMP_FILE, ".nge"))
End Sub
Private Sub PreInitializeScene()
' imposto colore di default
Dim DefColor As New Color3d(0, 0, 0)
GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor)
PrintScene.SetDefaultMaterial(DefColor)
' imposto colori sfondo
Dim BackTopColor As New Color3d(192, 192, 192)
GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
Dim BackBotColor As New Color3d(BackTopColor)
GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
PrintScene.SetViewBackground(BackTopColor, BackBotColor)
' imposto colore di evidenziazione
Dim MarkColor As New Color3d(255, 255, 0)
GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor)
PrintScene.SetMarkMaterial(MarkColor)
' imposto colore per superfici selezionate
Dim SelSurfColor As New Color3d(255, 255, 192)
GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor)
PrintScene.SetSelSurfMaterial(SelSurfColor)
' imposto tipo e colore del rettangolo di zoom
Dim bOutline As Boolean = True
Dim ZwColor As New Color3d(0, 0, 0)
GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor)
PrintScene.SetZoomWinAttribs(bOutline, ZwColor)
' imposto colore della linea di distanza
Dim DstLnColor As New Color3d(255, 0, 0)
GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor)
PrintScene.SetDistLineMaterial(DstLnColor)
' imposto parametri OpenGL
Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3)
Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0)
Dim nColorBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_COLORBITS, 32)
Dim nDepthBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32)
PrintScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
End Sub
Private Sub PostInitializeScene()
' imposto tipo coordinate
PrintScene.SetGridCursorPos(True)
' modo di visualizzazione
Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.HIDDENLINE)
EgtSetShowMode(DirectCast(nShowMode, SM))
'' visualizzazione avanzata dei triangoli costituenti le superfici
'Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0)
'EgtSetShowTriaAdv(bShowTriaAdv)
'' tipo visualizzazione per Zmap
'Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1)
'EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False)
'' dati di griglia
'Dim dSnapStep As Double = If(EgtUiUnitsAreMM(),
' GetMainPrivateProfileDouble(S_GRID, K_SNAPSTEP, 10),
' GetMainPrivateProfileDouble(S_GRID, K_SNAPSTEPINCH, 12.7))
'Dim nMinLineSStep As Integer = GetMainPrivateProfileInt(S_GRID, K_MINLINESSTEP, 1)
'Dim nMajLineSStep As Integer = GetMainPrivateProfileInt(S_GRID, K_MAJLINESSTEP, 10)
'Dim nExtSStep As Integer = GetMainPrivateProfileInt(S_GRID, K_EXTSSTEP, 50)
'Dim MinLnColor As New Color3d(160, 160, 160)
'GetMainPrivateProfileColor(S_GRID, K_MINLNCOLOR, MinLnColor)
'Dim MajLnColor As New Color3d(160, 160, 160)
'GetMainPrivateProfileColor(S_GRID, K_MAJLNCOLOR, MajLnColor)
'EgtSetGridFrame(Frame3d.GLOB)
'EgtSetGridGeo(dSnapStep, nMinLineSStep, nMajLineSStep, nExtSStep)
'EgtSetGridColor(MinLnColor, MajLnColor)
'Dim bShowGrid As Boolean = (GetMainPrivateProfileInt(S_GRID, K_SHOWGRID, 1) <> 0)
'EgtSetGridShow(bShowGrid, False)
End Sub
End Class
@@ -0,0 +1,33 @@
<UserControl x:Class="ProjectManagerHardwareV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel Orientation="Horizontal">
<!--Barra superiore dei comandi-->
<Button Command="{Binding NewCommand}" ToolTip="{Binding NewToolTip}" Focusable="False">
<Image Source="/Resources/TopCommandBar/New.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding SaveCommand}" ToolTip="{Binding SaveToolTip}" Focusable="False">
<Image Source="/Resources/TopCommandBar/Save.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding DuplicaCommand}" ToolTip="{Binding DuplicaToolTip}" Focusable="False">
<ContentControl>
<Image Source="/Resources/TopCommandBar/CopyDDF.png" Stretch="Uniform" />
</ContentControl>
</Button>
<Button Command="{Binding OptionsCommand}" ToolTip="{Binding OptionsToolTip}" Focusable="False">
<Image Source="/Resources/TopCommandBar/Options.png" Height="22" />
</Button>
<Button Command="{Binding SendFeedbackCommand}" ToolTip="{Binding SendFeedbackToolTip}" Focusable="False">
<Image Source="/Resources/TopCommandBar/Send.png" Height="22" Margin="3,0,3,0" />
</Button>
<Button Command="{Binding GuideCommand}" ToolTip="{Binding GuideToolTip}" Focusable="False">
<ContentControl>
<Image Source="/Resources/TopCommandBar/Help.png" Stretch="Uniform" />
</ContentControl>
</Button>
<Button Command="{Binding DoorCommand}" ToolTip="{Binding}" Focusable="False">
Door
</Button>
</StackPanel>
</UserControl>
@@ -0,0 +1,3 @@
Public Class ProjectManagerHardware
End Class
+371
View File
@@ -0,0 +1,371 @@
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Imports Ionic.zip
Public Class ProjectManagerHardwareVM
Implements INotifyPropertyChanged
#Region "FIELDS & PROPERTIES"
Friend m_CurrProject As Project
' Definizione comandi
Private m_cmdNew As ICommand
Private m_cmdSave As ICommand
Private m_cmdOptions As ICommand
Private m_cmdSendFeedback As ICommand
Private m_cmdGuide As ICommand
Private m_cmdDuplica As ICommand
Private m_cmdDoor As ICommand
#Region "ToolTip"
'Proprietà ToolTip
Public ReadOnly Property NewToolTip As String
Get
Return EgtMsg(MSG_TOPCOMMANDBAR + 1)
End Get
End Property
Public ReadOnly Property SaveToolTip As String
Get
Return EgtMsg(MSG_TOPCOMMANDBAR + 3)
End Get
End Property
Public ReadOnly Property SendFeedbackToolTip As String
Get
Return EgtMsg(50046)
End Get
End Property
Public ReadOnly Property OptionsToolTip As String
Get
Return EgtMsg(MSG_MAINWINDOW + 209)
End Get
End Property
Public ReadOnly Property GuideToolTip As String
Get
Return EgtMsg(50305)
End Get
End Property
Public ReadOnly Property Help As String
Get
Return EgtMsg(50305)
End Get
End Property
Public ReadOnly Property DuplicaToolTip As String
Get
Return "Duplicate"
End Get
End Property
#End Region ' ToolTip
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Sub New()
Map.SetRefProjectManagerHardwareVM(Me)
End Sub
#End Region ' Constructor
#Region "COMMANDS"
#Region "NewCommand"
''' <summary>
''' Returns a command that do New.
''' </summary>
Public ReadOnly Property NewCommand As ICommand
Get
If m_cmdNew Is Nothing Then
m_cmdNew = New Command(AddressOf NewCmd)
End If
Return m_cmdNew
End Get
End Property
''' <summary>
''' Execute the New. This method is invoked by the NewCommand.
''' </summary>
Public Sub NewCmd()
If Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
' controllo che quello che esiste sia salvato
If Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nCancel Then Return
' notifico la modifica
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True
Map.refHardwarePageVM.CurrHardware.ClearGroupChapters()
' solo se il modello non esiste allora carico l'unico che può esistere
Map.refHardwarePageVM.CurrHardware.TemplateName = "File Name"
Map.refHardwarePageVM.CurrHardware.ReadChapterTemplate()
Map.refSceneManagerVM.RefreshBtn()
Map.refHardwarePageVM.CurrHardware.VisibilityTextTemplate = Visibility.Visible
Map.refHardwarePageVM.CurrHardware.IsEnableType = True
End If
End Sub
#End Region ' NewCommand
#Region "SaveCommand"
''' <summary>
''' Returns a command that do Save.
''' </summary>
Public ReadOnly Property SaveCommand As ICommand
Get
If m_cmdSave Is Nothing Then
m_cmdSave = New Command(AddressOf Save)
End If
Return m_cmdSave
End Get
End Property
''' <summary>
''' Execute the Save. This method is invoked by the SaveCommand.
''' </summary>
Public Sub Save()
If Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then Map.refHardwarePageVM.CurrHardware.Save()
End Sub
#End Region ' SaveCommand
#Region "OptionsCommand"
''' <summary>
''' Returns a command that do Export.
''' </summary>
Public ReadOnly Property OptionsCommand As ICommand
Get
If m_cmdOptions Is Nothing Then
m_cmdOptions = New Command(AddressOf Options)
End If
Return m_cmdOptions
End Get
End Property
''' <summary>
''' Execute the Export. This method is invoked by the ExportCommand.
''' </summary>
Public Sub Options(ByVal param As Object)
Dim OptionsWindow As New OptionsV
OptionsWindow.Height = 550
OptionsWindow.Width = 650
OptionsWindow.DataContext = New OptionsVM()
OptionsWindow.Owner = Application.Current.MainWindow
OptionsWindow.ShowDialog()
End Sub
#End Region ' OptionsCommand
#Region "SendFeedbackCommand"
''' <summary>
''' Returns a command that do SendFeedback.
''' </summary>
Public ReadOnly Property SendFeedbackCommand As ICommand
Get
If m_cmdSendFeedback Is Nothing Then
m_cmdSendFeedback = New Command(AddressOf SendFeedback)
End If
Return m_cmdSendFeedback
End Get
End Property
''' <summary>
''' Execute the SendFeedback. This method is invoked by the SendFeedbackCommand.
''' </summary>
Public Sub SendFeedback()
'' Recupero indirizzo a cui spedire la mail
'Dim sSupportAddress As String = String.Empty
'GetMainPrivateProfileString(S_GENERAL, K_SUPPORT, "support@egaltech.com", sSupportAddress)
'' se vuoto do messaggio di errore ed esco
'If String.IsNullOrWhiteSpace(sSupportAddress) Then
' MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 10), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
' Return
'End If
'' Recupero numero chiave
'Dim sKey As String = String.Empty
'EgtGetKeyInfo(sKey)
'' Recupero file del progetto corrente (tipo file .nge)
'Dim sCurrProject As String = String.Empty
'EgtGetCurrFilePath(sCurrProject)
'' se nome file vuoto, chiedo se si vuole salvare (file .nge)
'If String.IsNullOrWhiteSpace(sCurrProject) Then
' If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
' Save()
' End If
' EgtGetCurrFilePath(sCurrProject)
' ' se modificato, chiedo se si vuole salvare
'Else
' If EgtGetModified() Then
' If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
' Save()
' End If
' End If
'End If
'' recuro il file DDF associato al file .nge
'Dim sCurrProjectDDF As String = String.Empty
'sCurrProjectDDF = IniFile.m_sTempDir & "\CurrPart.ddf"
'' recupero il file di log
'Dim sFileLog As String = String.Empty
'sFileLog = IniFile.m_sTempDir & "\EgtDOORCreatorLog1.txt"
'' Creo zip file da allegare
'Dim sZipToCreate As String = IniFile.m_sTempDir & "\Feedback.zip"
'If File.Exists(sZipToCreate) Then
' File.Delete(sZipToCreate)
'End If
'Try
' Using zip As New Ionic.Zip.ZipFile(sZipToCreate, Console.Out)
' ' aggiungo progetto corrente .nge
' If File.Exists(sCurrProject) Then
' zip.AddItem(sCurrProject, "")
' End If
' ' aggiungo progetto corrente .ddf
' If File.Exists(sCurrProjectDDF) Then
' zip.AddItem(sCurrProjectDDF, "")
' End If
' ' aggiungo file log
' If File.Exists(sFileLog) Then
' zip.AddItem(sFileLog, "")
' End If
' ' aggiungo la cartella Doors
' If Directory.Exists(IniFile.m_sDoorsDirPath) Then
' zip.AddItem(IniFile.m_sDoorsDirPath, "Doors")
' End If
' zip.Save()
' End Using
'Catch ex1 As Exception
' EgtOutLog("Exception in zip: " & ex1.ToString())
'End Try
'' preparo la mail per il supporto
'Dim bEx As Boolean = False
'Try
' Dim SendFeedbackWindow As New EgtWPFLib5.MapiMailMessage("EgtDOORCreator Feedback - " & sKey)
' SendFeedbackWindow.Recipients.Add(sSupportAddress)
' If Not String.IsNullOrWhiteSpace(sZipToCreate) AndAlso File.Exists(sZipToCreate) Then
' SendFeedbackWindow.Files.Add(IniFile.m_sTempDir & "\Feedback.zip")
' End If
' SendFeedbackWindow.ShowDialog()
'Catch ex As Exception
' EgtOutLog("Feedback exception: " & ex.ToString)
' bEx = True
'End Try
'If bEx OrElse EgtWPFLib5.MapiMailMessage.m_ErrorCode <> 0 Then
' MessageBox.Show(String.Format(EgtMsg(MSG_TOPCOMMANDBAR + 12), sSupportAddress, sZipToCreate), EgtMsg(MSG_EGTDOORCREATOR + 118), MessageBoxButton.OK, MessageBoxImage.Information)
' ' stampo il messaggio nella StatusBar
' Map.refStatusBarVM.StatusOutput = EgtMsg(MSG_TOPCOMMANDBAR + 14)
'Else
' ' stampo il messaggio nella StatusBar
' Map.refStatusBarVM.StatusOutput = EgtMsg(MSG_TOPCOMMANDBAR + 14)
'End If
End Sub
#End Region ' SendFeedbackCommand
#Region "Guide"
Public ReadOnly Property GuideCommand As ICommand
Get
If m_cmdGuide Is Nothing Then
m_cmdGuide = New Command(AddressOf Guide)
End If
Return m_cmdGuide
End Get
End Property
Public Sub Guide()
Dim GuideWindow As New GuideV(Application.Current.MainWindow, New GuideVM)
GuideWindow.Show()
End Sub
#End Region ' Guide
#Region "Duplica"
Public ReadOnly Property DuplicaCommand As ICommand
Get
If m_cmdDuplica Is Nothing Then
m_cmdDuplica = New Command(AddressOf Duplica)
End If
Return m_cmdDuplica
End Get
End Property
Public Sub Duplica()
If Not IsNothing(Map.refHardwarePageVM) And Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
If Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nCancel Then
Return
ElseIf Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nYes Then
Map.refHardwarePageVM.CurrHardware.Save()
End If
End If
If Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
Dim refNewHardwareV As New NewHardwareV
Dim refNewhardwareVM As New NewHardwareVM(Map.refHardwarePageVM.CurrHardware.HardwareGeneral)
refNewHardwareV.DataContext = refNewhardwareVM
refNewHardwareV.Owner = Application.Current.MainWindow
refNewHardwareV.ShowDialog()
refNewHardwareV.Close()
End If
End Sub
#End Region ' Duplica
#Region "Door"
Public ReadOnly Property DoorCommand As ICommand
Get
If m_cmdDoor Is Nothing Then
m_cmdDoor = New Command(AddressOf GoToPartPage)
End If
Return m_cmdDoor
End Get
End Property
Public Sub GoToPartPage()
' controllo che sia stato salvato
If Not IsNothing(Map.refHardwarePageVM) And Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
If Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nCancel Then
Return
ElseIf Map.refHardwarePageVM.CurrHardware.SaveControl() = Hardware.SaveResult.nYes Then
Map.refHardwarePageVM.CurrHardware.Save()
End If
End If
' torna all'EgtDOORCreator
If OptionModule.m_ConfigurationSoftware = ConfigType.Assembly Then
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage
Else
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage
Map.refCompoPanelVM.GoBackVisibility = Visibility.Collapsed
End If
' elimino i riferimenti all'hardware corrente
Map.refHardwarePageVM.CurrHardware = Nothing
' spengo il focus su tutti i bottoni
For IndexCompoType As Integer = 0 To Map.refCompoPanelHardwareVM.CompoTypeList.Count - 1
Map.refCompoPanelHardwareVM.CompoTypeList(IndexCompoType).IsSelectedBtn = False
Next
Map.refHardwarePageVM.CompoPanelControl.DataContext = Map.refCompoPanelHardwareVM
Map.refProjectManagerVM.OpenLastProject()
Map.refSceneManagerVM.RefreshBtn()
CompoMatch.ResetHMD()
End Sub
#End Region ' LastProject
#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
+53 -41
View File
@@ -1,50 +1,62 @@
<StackPanel x:Class="ProjectManagerV"
<UserControl x:Class="ProjectManagerV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Orientation="Horizontal">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel Orientation="Horizontal">
<!--Barra superiore dei comandi-->
<Button Command="{Binding NewCommand}" ToolTip="{Binding NewToolTip}" Focusable="False">
<!--Barra superiore dei comandi-->
<Button Command="{Binding NewCommand}" ToolTip="{Binding NewToolTip}" Focusable="False">
<Image Source="/Resources/TopCommandBar/New.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding OpenCommand}" ToolTip="{Binding OpenToolTip}"
</Button>
<Button Command="{Binding OpenCommand}" ToolTip="{Binding OpenToolTip}"
ContextMenuService.Placement="Bottom" Focusable="False">
<!--<Button.ContextMenu>
<!--<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding MruFileNames}" ItemContainerStyle="{StaticResource MruFileItem}">
</ContextMenu>
</Button.ContextMenu>-->
<Image Source="/Resources/TopCommandBar/Open.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding SaveCommand}" ToolTip="{Binding SaveToolTip}" Focusable="False">
<Image Source="/Resources/TopCommandBar/Save.png" Stretch="Uniform"/>
</Button>
<!--<Button Command="{Binding SaveAsCommand}" ToolTip="{Binding SaveAsToolTip}">
<Image Source="/Resources/TopCommandBar/Open.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding SaveCommand}" ToolTip="{Binding SaveToolTip}" Focusable="False">
<Image Source="/Resources/TopCommandBar/Save.png" Stretch="Uniform"/>
</Button>
<!--<Button Command="{Binding SaveAsCommand}" ToolTip="{Binding SaveAsToolTip}">
<Image Source="/Resources/TopCommandBar/SaveAs.png" Stretch="Uniform"/>
</Button>-->
<Button Command="{Binding CreateTemplateCommand}" ToolTip="{Binding TemplateDoorToolTip}" Focusable="False">
<ContentControl>
<Image Source="/Resources/TopCommandBar/SaveAs.png" Stretch="Uniform" />
</ContentControl>
</Button>
<Button Command="{Binding DuplicaCommand}" ToolTip="{Binding DuplicaToolTip}" Focusable="False">
<ContentControl>
<Image Source="/Resources/TopCommandBar/CopyDDF.png" Stretch="Uniform" />
</ContentControl>
</Button>
<Button Command="{Binding CopyCommand}" ToolTip="{Binding CopyToolTip}" Focusable="False">
<ContentControl>
<Image Source="/Resources/TopCommandBar/Export.png" Stretch="Uniform" />
</ContentControl>
</Button>
<Button Command="{Binding OptionsCommand}" ToolTip="{Binding OptionsToolTip}" Focusable="False">
<Image Source="/Resources/TopCommandBar/Options.png" Height="22" />
</Button>
<Button Command="{Binding SendFeedbackCommand}" ToolTip="{Binding SendFeedbackToolTip}" Focusable="False">
<Image Source="/Resources/TopCommandBar/Send.png" Height="22" Margin="3,0,3,0" />
</Button>
<Button Command="{Binding GuideCommand}" ToolTip="{Binding GuideToolTip}" Focusable="False">
<ContentControl>
<Image Source="/Resources/TopCommandBar/Help.png" Stretch="Uniform" />
</ContentControl>
</Button>
</StackPanel>
<Button Command="{Binding CreateTemplateCommand}" ToolTip="{Binding TemplateDoorToolTip}" Focusable="False">
<ContentControl>
<Image Source="/Resources/TopCommandBar/SaveAs.png" Stretch="Uniform" />
</ContentControl>
</Button>
<Button Command="{Binding DuplicaCommand}" ToolTip="{Binding DuplicaToolTip}" Focusable="False">
<ContentControl>
<Image Source="/Resources/TopCommandBar/CopyDDF.png" Stretch="Uniform" />
</ContentControl>
</Button>
<Button Command="{Binding CopyCommand}" ToolTip="{Binding CopyToolTip}" Focusable="False">
<ContentControl>
<Image Source="/Resources/TopCommandBar/Export.png" Stretch="Uniform" />
</ContentControl>
</Button>
<Button Command="{Binding PrintCommand}" ToolTip="{Binding PrintToolTip}" Focusable="False">
<ContentControl>
Print
</ContentControl>
</Button>
<Button Command="{Binding OptionsCommand}" ToolTip="{Binding OptionsToolTip}" Focusable="False">
<Image Source="/Resources/TopCommandBar/Options.png" Height="22" />
</Button>
<Button Command="{Binding SendFeedbackCommand}" ToolTip="{Binding SendFeedbackToolTip}" Focusable="False">
<Image Source="/Resources/TopCommandBar/Send.png" Height="22" Margin="3,0,3,0" />
</Button>
<Button Command="{Binding GuideCommand}" ToolTip="{Binding GuideToolTip}" Focusable="False">
<ContentControl>
<Image Source="/Resources/TopCommandBar/Help.png" Stretch="Uniform" />
</ContentControl>
</Button>
<Button Command="{Binding HardwareCommand}" ToolTip="{Binding}" Focusable="False"
Visibility="{Binding DisableHM}">
Hardware
</Button>
</StackPanel>
</UserControl>
+94 -1
View File
@@ -8,6 +8,16 @@ Imports Ionic.zip
Public Class ProjectManagerVM
Implements INotifyPropertyChanged
Public ReadOnly Property DisableHM As Visibility
Get
If OptionModule.m_DisableHM Then
Return Visibility.Visible
Else
Return Visibility.Collapsed
End If
End Get
End Property
#Region "FIELDS & PROPERTIES"
Friend m_CurrProject As Project
@@ -20,6 +30,7 @@ Public Class ProjectManagerVM
Private m_cmdInsert As ICommand
Private m_cmdImport As ICommand
Private m_cmdExport As ICommand
Private m_cmdPrint As ICommand
Private m_cmdOptions As ICommand
Private m_CmdLastProject As ICommand
Private m_cmdSendFeedback As ICommand
@@ -27,6 +38,7 @@ Public Class ProjectManagerVM
Private m_cmdGuide As ICommand
Private m_cmdCopy As ICommand
Private m_cmdDuplica As ICommand
Private m_cmdHardware As ICommand
#Region "ToolTip"
@@ -100,6 +112,11 @@ Public Class ProjectManagerVM
Return "Duplicate"
End Get
End Property
Public ReadOnly Property PrintToolTip As String
Get
Return "Print"
End Get
End Property
#End Region ' ToolTip
@@ -338,9 +355,18 @@ Public Class ProjectManagerVM
Public Sub OpenLastProject()
' Apro l'ultimo progetto
Dim CurrName As String = String.Empty
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name) Then
CurrName = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.Name
End If
End If
Dim CurrProject As Project = Map.refAssemblyManagerVM.CurrProject
' carico il percorso dell'ultimo progetto salvato (sul file Config.ini)
CurrProject.Name = OptionModule.m_sLastProject
If IsNothing(CurrProject.Name) Then
CurrProject.Name = OptionModule.m_sLastProject
End If
' ripulisco la lista di porte
CurrProject.AssemblyList.Clear()
' verifico che esista la cartella
@@ -364,8 +390,20 @@ Public Class ProjectManagerVM
'Map.refMainWindowVM.ModifyTitle(False)
' Se c'è almeno una porta la visualizzo
If CurrProject.AssemblyList.Count > 0 Then
If Not IsNothing(CurrName) Then
For IndexListAss As Integer = 0 To CurrProject.AssemblyList.Count - 1
If CurrName = CurrProject.AssemblyList(IndexListAss).Name Then
Map.refAssemblyManagerVM.Open(CurrProject.AssemblyList(IndexListAss))
Return
End If
Next
End If
Map.refAssemblyManagerVM.Open(CurrProject.AssemblyList(0))
Else
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
End If
Else
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
End If
End Sub
@@ -605,6 +643,7 @@ Public Class ProjectManagerVM
End Property
Public Sub Duplica()
If IsNothing(Map.refAssemblyManagerVM.CurrProject) Then Return
If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified() Then
MessageBox.Show("Project must be saved before copying", EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
Return
@@ -673,8 +712,62 @@ Public Class ProjectManagerVM
End Sub
#End Region ' Duplica
#Region "Hardware"
Public ReadOnly Property HardwareCommand As ICommand
Get
If m_cmdHardware Is Nothing Then
m_cmdHardware = New Command(AddressOf GoToHardwarePage)
End If
Return m_cmdHardware
End Get
End Property
Public Sub GoToHardwarePage()
' se decido di annullare l'operazione di salvataggio
If Not Map.refAssemblyManagerVM.ManageModified() Then Return
' prima di continuare salvo il riferimento all'ultima cartella aperta
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage
' nascondo la visibilità del bottono goback dalla lista dei bottoni
Map.refCompoPanelHardwareVM.GoBackVisibility = Visibility.Collapsed
Map.refHardwarePageVM.VisibilityGeneral = Visibility.Collapsed
' creo una porta per il disegno dell'Hardware
Map.refHardwarePageVM.CreateDoor()
Map.refSceneManagerVM.RefreshBtn()
' carico la lista dei nomi delle geometrie
CompoMatch.LoadTableGeometry()
End Sub
#End Region ' LastProject
#Region "PrintCommand"
Public ReadOnly Property PrintCommand As ICommand
Get
If m_cmdPrint Is Nothing Then
m_cmdPrint = New Command(AddressOf Print)
End If
Return m_cmdPrint
End Get
End Property
Public Sub Print(ByVal param As Object)
If IsNothing(Map.refAssemblyManagerVM.CurrProject) Then Return
If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified() Then
MessageBox.Show("Project must be saved before printing", EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
Return
End If
Dim PrintWindow As New PrintWndV(Application.Current.MainWindow, New PrintWndVM)
PrintWindow.Height = 550
PrintWindow.Width = 650
PrintWindow.ShowDialog()
End Sub
#End Region ' PrintCommand
#End Region ' Commands
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
+37 -1
View File
@@ -31,8 +31,38 @@ Module RegexFunction
End If
End Function
' restituisce il nome del modello
Friend Function ModelTemplate(sLine As String) As String
Dim Model As String = Regex.Match(sLine, "\s* (Compo)\s*\/\s*(.*?\b)\s*$").Groups(2).Value
If Not String.IsNullOrEmpty(Model) Then
Return Model
Else
Model = Regex.Match(sLine, "\s*(Compo)\s*\\\s*(.*?\b)\s*$").Groups(2).Value
End If
If Not String.IsNullOrEmpty(Model) Then
Return Model
Else
Return sLine
End If
End Function
' dato il direttorio restituisce il nome del file
Friend Function SubStractDirFromPath(sLine As String, sLastDir As String) As String
Dim Model As String = Regex.Match(sLine, "\s* (" & sLastDir & ")\s*\/\s*(.*?\b)\s*$").Groups(2).Value
If Not String.IsNullOrEmpty(Model) Then
Return Model
Else
Model = Regex.Match(sLine, "\s*(" & sLastDir & ")\s*\\\s*(.*?\b)\s*$").Groups(2).Value
End If
If Not String.IsNullOrEmpty(Model) Then
Return Model
Else
Return sLine
End If
End Function
Friend Function ParamExpression(sLine As String) As String
Return Regex.Match(sLine, " \s*\(*\s*(.*?\b)\s*\).*$").Groups(1).Value
Return Regex.Match(sLine, "\s*\(*\s*(.*?\b)\s*\).*$").Groups(1).Value
End Function
' Cerca la stringa con 3 trattini
@@ -97,4 +127,10 @@ Module RegexFunction
Return sLine
End Function
Friend Function GetNameParamInFileTempl(sLine As String) As String
If sLine.Contains("%") Then sLine = Regex.Match(sLine, "\s*\%*\s*(.*?)\s*\%.*$").Groups(1).Value : Return sLine
Return String.Empty
End Function
End Module
+55 -1
View File
@@ -2,6 +2,7 @@
Imports System.IO
Imports System.Windows.Forms.Integration
Imports EgtUILib
Imports System.Collections.ObjectModel
Imports EgtWPFLib5
Public Class SceneManagerVM
@@ -288,15 +289,68 @@ Public Class SceneManagerVM
If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage Then
DdfFile.WriteDDFPart(Map.refPartPageVM.CurrPart, sTempFile, True, False)
ExecDoors(m_ProjectScene, sTempFile)
Else
ElseIf Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nAssemblyPage Then
DdfFile.WriteDDFAssembly(Map.refAssemblyPageVM.CurrAssembly, sTempFile, True)
ExecDoors(m_ProjectScene, sTempFile)
ElseIf Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nHardwarePage Then
If Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
Map.refHardwarePageVM.CurrHardware.RefreshTempHardware()
End If
DdfFile.WriteDDFPartForTestHardware(Map.refHardwarePageVM.Door, sTempFile, False, False)
Dim sNameModel As String = String.Empty
If Not IsNothing(Map.refHardwarePageVM.CurrHardware) Then
Dim nFirstPart As Integer = EgtGetFirstPart()
For IndexChapter As Integer = 0 To Map.refHardwarePageVM.CurrHardware.GroupChapters.Count - 1
Dim ParamList As ObservableCollection(Of CompoParam) = Map.refHardwarePageVM.CurrHardware.GroupChapters(IndexChapter).CompoParamList
For IndexParamInChapter As Integer = 0 To ParamList.Count - 1
If ParamList(IndexParamInChapter).DDFName.Contains(".Nome") Then
If TypeOf ParamList(IndexParamInChapter) Is TextBoxParam Then
ExecDoors(m_ProjectScene, sTempFile)
Dim sNome As String = DirectCast(ParamList(IndexParamInChapter), TextBoxParam).Value
Dim nCurrObject As Integer = EgtGetFirstNameInGroup(nFirstPart, sNome)
Dim sSide As String = String.Empty
IniFile.GetPrivateProfileJambSide(S_POSITIONSIDE, K_SIDE, sSide, Map.refHardwarePageVM.CurrHardware.HardwareGeneral.Path & "\" & CONFIGINI_FILE_NAME)
If String.IsNullOrEmpty(sSide) Then
' controllo nell'elenco dei parametri se esiste un parametro di tipo Side
For IndexParam As Integer = 0 To ParamList.Count - 1
If ParamList(IndexParam).DDFName.ToLower = "side" Then
Side = DirectCast(ParamList(IndexParam), ComboBoxParam).SelItem
Exit For
End If
Next
End If
Select Case sSide.ToLower
Case "hinge"
EgtSetView(VT.ISO_NE)
Case "lock"
EgtSetView(VT.ISO_NW)
Case "top"
EgtSetView(VT.ISO_NW)
Case "bottom"
EgtSetView(VT.ISO_SW)
End Select
EgtZoomObject(nCurrObject)
Return
End If
End If
Next
Next
End If
ExecDoors(m_ProjectScene, sTempFile)
End If
ShowGraphicError()
End Sub
#End Region ' RefreshBtnCommand
Public Function Dimensionning(sLayerName As String, bSelect As Boolean) As Boolean
Dim nFirstPart As Integer = EgtGetFirstPart()
Dim nLayer As Integer = EgtGetFirstNameInGroup(nFirstPart, sLayerName)
If bSelect Then EgtSetStatus(nLayer, GDB_ST.ON_) Else EgtSetStatus(nLayer, GDB_ST.OFF)
Return True
End Function
#Region "AssemblyBtnCommand"
Public Sub AssemblyBtn()
+163 -13
View File
@@ -107,6 +107,94 @@ Public Module Utility
Return Index
End Function
#Region "PARAM LUA"
' elimina i commenti nel file lua
Friend Function DeleteLuaComment(sLine As String) As String
sLine = Trim(sLine)
If sLine.Contains("--") Then
If sLine.StartsWith("--") Then Return String.Empty
sLine = Regex.Match(sLine, "\s*(.*?)\s*\--\s*\.*").Groups(1).Value
Return sLine
Else
Return sLine
End If
End Function
' controllo che il valore in lettura sia una misura
Friend Function GetMeasure(sValue As String) As String
Dim dVal As Double = 0.0
If sValue.Contains("(") And sValue.Contains(")") Then
sValue = Regex.Match(sValue, "\s*\((.*?)\s*\)\s*\.*").Groups(1).Value
If String.IsNullOrEmpty(sValue) Then Return "0.0000"
' ricevo un valore in inches
Select Case OptionModule.m_SelectedMeasureUnit
Case "Inches" ' se la configurazione è inches non faccio conversioni
If StringToDouble(sValue, dVal) Then
Return sValue
Else
Return "0.0000"
End If
Case "mm" ' se la configurazione è in mm faccio la conevrsione
If InchesToMm(sValue) Then
Return sValue
Else
Return "0.0000"
End If
End Select
End If
' il valore che ricevo è in mm
Select Case OptionModule.m_SelectedMeasureUnit
Case "Inches" ' se la configurazione è inches faccio conversione
If MmToInches(sValue) Then
Return sValue
Else
Return "0.0000"
End If
Case "mm" ' se la configurazione è in mm non faccio la conevrsione
If StringToDouble(sValue, dVal) Then
Return sValue
Else
Return "0.0000"
End If
End Select
' se non è nessuno dei casi restituisco zero
Return "0.0000"
End Function
Friend Function InchesToMm(ByRef sMeasure As String) As Boolean
Dim dVal As Double = 0.0
If Not StringToDouble(sMeasure, dVal) Then Return False
dVal = dVal * 25.4
sMeasure = DoubleToString(dVal, 4)
Return True
End Function
Friend Function MmToInches(ByRef sMeasure As String) As Boolean
Dim dVal As Double = 0.0
If Not StringToDouble(sMeasure, dVal) Then Return False
dVal = dVal / 25.4
sMeasure = DoubleToString(dVal, 4)
Return True
End Function
Friend Function ConvertCheckBox(sValue As String) As Boolean
If Trim(sValue.ToLower) = "true" Then Return True Else Return False
End Function
' elimina gli apici di una variabile
Friend Function DeleteSuperScript(sLine As String) As String
Return sLine.Replace("'"c, " "c)
End Function
Friend Function FindNameParam(sLine As String) As String
sLine = RegexFunction.GetNameParamInFileTempl(sLine)
If String.IsNullOrEmpty(sLine) Then Return String.Empty
Return sLine
End Function
#End Region ' Param lua
' Converte il valore Boolean in una stringa ON/OFF (attributo machining)
Friend Function ConvertBooleanToOnOff(bValue As Boolean) As String
Return If(bValue, DDF_ON, DDF_OFF)
@@ -149,11 +237,52 @@ Public Module Utility
Next
End Sub
Friend Sub GetDirectoryCompoFiles(DirectoryPath As String, ByRef FileList As List(Of String))
Friend Sub GetDirectoryCompoFiles(DirectoryPath As String, ByRef FileList As ObservableCollection(Of String))
GetDirectoryCompoFiles(DirectoryPath, DirectoryPath, FileList)
End Sub
Private Sub GetDirectoryCompoFiles(DirectoryPath As String, BaseDirectory As String, ByRef FileList As List(Of String))
Friend Sub GetDirectoryCompoModel(DirectoryPath As String, ByRef ModelList As ObservableCollection(Of CompoBrandDir))
Dim BaseDirName As String = RegexFunction.ModelTemplate(DirectoryPath)
Dim Model() As String = Directory.GetDirectories(DirectoryPath)
'Dim ModelList As New ObservableCollection(Of CompoModelDir)
For IndexModel As Integer = 0 To Model.Count - 1
ModelList.Add(New CompoBrandDir(Model(IndexModel), BaseDirName))
GetDirectoryCompoFiles(Model(IndexModel), ModelList(IndexModel).ModelFileList)
Next
Dim ListFiles() As String = Directory.GetFiles(DirectoryPath)
If ControlList(ListFiles) Then
ModelList.Add(New CompoBrandDir(RegexFunction.ModelTemplate(DirectoryPath), BaseDirName))
For IndexFiles As Integer = 0 To ListFiles.Count - 1
If ControlFile(ListFiles(IndexFiles)) Then
' Elimino il direttorio base dei componenti
Dim sFile As String = ListFiles(IndexFiles).Replace(DirectoryPath & "\", "")
' Elimino estensione lua
If LUA_EXTENSION = Path.GetExtension(ListFiles(IndexFiles)) Then sFile = Path.ChangeExtension(sFile, Nothing)
ModelList(ModelList.Count - 1).ModelFileList.Add(sFile)
End If
Next
End If
End Sub
Private Function ControlList(ByRef List() As String) As Boolean
For Index As Integer = 0 To List.Count - 1
If ControlFile(List(Index)) Then Return True
Next
Return False
End Function
Private Function ControlFile(Item As String) As Boolean
If Path.GetExtension(Item) = ".ini" Or Path.GetExtension(Item) = ".templ" Then
Return False
ElseIf Path.GetExtension(Item) = ".lua" And Item.Contains("Matching") Then
Return False
Else
Return True
End If
End Function
Private Sub GetDirectoryCompoFiles(DirectoryPath As String, BaseDirectory As String, ByRef FileList As ObservableCollection(Of String))
Dim SubDir() As String = Directory.GetDirectories(DirectoryPath)
For Index = 0 To SubDir.Count - 1
GetDirectoryCompoFiles(SubDir(Index), BaseDirectory, FileList)
@@ -178,17 +307,38 @@ Public Module Utility
End Module
Public Class SplitConverter
Implements IValueConverter
Public Class CompoBrandDir
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Dim dValue As Double = CDbl(value)
Dim nParam As Integer = CInt(parameter)
Return dValue / nParam
End Function
Private m_ModelDirGraphic As String
Public ReadOnly Property ModelDirGraphic As String
Get
Return m_ModelDirGraphic
End Get
End Property
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException
End Function
Private m_ModelDir As String
Public Property ModelDir As String
Get
Return m_ModelDir
End Get
Set(value As String)
m_ModelDir = value
End Set
End Property
End Class
Private m_ModelFileList As New ObservableCollection(Of String)
Public Property ModelFileList As ObservableCollection(Of String)
Get
Return m_ModelFileList
End Get
Set(value As ObservableCollection(Of String))
m_ModelFileList = value
End Set
End Property
Sub New(Model As String, BaseDirName As String)
m_ModelDir = Model
m_ModelDirGraphic = RegexFunction.SubStractDirFromPath(Model, BaseDirName)
End Sub
End Class