Files
EgtDOORCreator/Assembly/AssemblyPageVM.vb
T
Dario Sassi 827092686c EgtDOORCreator :
- revisione generale.
2017-11-28 11:31:57 +00:00

283 lines
8.1 KiB
VB.net

Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Public Class AssemblyPageVM
Implements INotifyPropertyChanged
Public ReadOnly Property CurrAssembly As Assembly
Get
If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then
Return Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.SelAssembly
Else
Return Nothing
End If
End Get
End Property
' Definizione comando
Private m_CmdJambBtn As ICommand
Private m_EnterRefreshCmd As ICommand
Private m_CmdOrderBtn As ICommand
Sub New()
Map.SetRefJambPageVM(Me)
End Sub
#Region "Messages"
Public ReadOnly Property JambPageMsg As String
Get
Return "Jamb"
End Get
End Property
Public ReadOnly Property LightUpMsg As String
Get
Return "Light Up"
End Get
End Property
Public ReadOnly Property LightLockMsg As String
Get
Return "Light Lock"
End Get
End Property
Public ReadOnly Property LightBottomMsg As String
Get
Return "Light Bottom"
End Get
End Property
Public ReadOnly Property LightHingeMsg As String
Get
Return "Light Hinge"
End Get
End Property
Public ReadOnly Property ThicknessHeadMsg As String
Get
Return "Thickness Head"
End Get
End Property
Public ReadOnly Property OverlapHingeMsg As String
Get
Return "Overlap Hinge"
End Get
End Property
Public ReadOnly Property OverlapLockMsg As String
Get
Return "Overlap Lock"
End Get
End Property
Public ReadOnly Property OverlapTopMsg As String
Get
Return "Overlap Top"
End Get
End Property
Public ReadOnly Property DeltaTMsg As String
Get
Return "Delta T"
End Get
End Property
Public ReadOnly Property ExteriorMsg As String
Get
Return "Exterior"
End Get
End Property
Public ReadOnly Property DoorNumberMsg As String
Get
Return "Number of Doors"
End Get
End Property
Public ReadOnly Property JambsAndDoorsMsg As String
Get
Return "Jambs and Doors"
End Get
End Property
Public ReadOnly Property OrderMsg As String
Get
Return "Order"
End Get
End Property
Public ReadOnly Property LockedgeMsg As String
Get
Return EgtMsg(50005)
End Get
End Property
Public ReadOnly Property HingeedgeMsg As String
Get
Return EgtMsg(50006)
End Get
End Property
Public ReadOnly Property TopMsg As String
Get
Return EgtMsg(50007)
End Get
End Property
Public ReadOnly Property BottomMsg As String
Get
Return EgtMsg(50008)
End Get
End Property
Public ReadOnly Property EdgeMsg As String
Get
Return EgtMsg(50044)
End Get
End Property
Public ReadOnly Property OverMaterialMsg As String
Get
Return EgtMsg(50045)
End Get
End Property
Public ReadOnly Property ThicknessMsg As String
Get
Return EgtMsg(50003)
End Get
End Property
Public ReadOnly Property WidthMsg As String
Get
Return EgtMsg(50001)
End Get
End Property
#End Region
#Region "COMMANDS"
#Region "JambBtnCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property JambBtnCommand As ICommand
Get
If m_CmdJambBtn Is Nothing Then
m_CmdJambBtn = New Command(AddressOf JambBtn)
End If
Return m_CmdJambBtn
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
'''
Private bLoadSwing As Boolean = False
Public Sub JambBtn(param As Object)
' il parametro param arriva direttamente dal Jamb del bottone, quindi è gia scritto nella forma FL_ (le porte no! sono passate da binding)
Dim SelectPart As String = (CStr(param))
' In questa fase manca la gestione degli swing dei Jamb
Select Case SelectPart
Case "FL_"
DdfFile.WriteDDFPart(CurrAssembly.LeftJamb, IniFile.m_sTempDir & "\" & TEMP_FILE, True, False)
ExecDoors(Map.refSceneManagerVM.ProjectScene, IniFile.m_sTempDir & "\" & TEMP_FILE)
Map.refPartPageVM.CurrPart = CurrAssembly.LeftJamb
Map.refCompoPanelVM.IsVisible = Visibility.Hidden
Map.refPartPageVM.IsRaedOnly = True
Case "FR_"
DdfFile.WriteDDFPart(CurrAssembly.RightJamb, IniFile.m_sTempDir & "\" & TEMP_FILE, True, False)
ExecDoors(Map.refSceneManagerVM.ProjectScene, IniFile.m_sTempDir & "\" & TEMP_FILE)
Map.refPartPageVM.CurrPart = CurrAssembly.RightJamb
Map.refCompoPanelVM.IsVisible = Visibility.Hidden
Map.refPartPageVM.IsRaedOnly = True
Case "FT_"
DdfFile.WriteDDFPart(CurrAssembly.TopJamb, IniFile.m_sTempDir & "\" & TEMP_FILE, True, False)
ExecDoors(Map.refSceneManagerVM.ProjectScene, IniFile.m_sTempDir & "\" & TEMP_FILE)
Map.refPartPageVM.CurrPart = CurrAssembly.TopJamb
Map.refCompoPanelVM.IsVisible = Visibility.Hidden
Map.refPartPageVM.IsRaedOnly = True
Case "FB_"
DdfFile.WriteDDFPart(CurrAssembly.BottomJamb, IniFile.m_sTempDir & "\" & TEMP_FILE, True, False)
ExecDoors(Map.refSceneManagerVM.ProjectScene, IniFile.m_sTempDir & "\" & TEMP_FILE)
Map.refPartPageVM.CurrPart = CurrAssembly.BottomJamb
Map.refCompoPanelVM.IsVisible = Visibility.Hidden
Map.refPartPageVM.IsRaedOnly = True
Case Else
' scelta della porta
DdfFile.WriteDDFPart(SelectDoor(SelectPart), IniFile.m_sTempDir & "\" & TEMP_FILE, True, False)
ExecDoors(Map.refSceneManagerVM.ProjectScene, IniFile.m_sTempDir & "\" & TEMP_FILE)
Map.refPartPageVM.CurrPart = SelectDoor(SelectPart)
bLoadSwing = False
Map.refCompoPanelVM.IsVisible = Visibility.Visible
Map.refPartPageVM.IsRaedOnly = False
End Select
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage
End Sub
#End Region ' CompoBtnCommand
''' <summary>
''' Returns a command that do New.
''' </summary>
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
Public ReadOnly Property OrderCmd As ICommand
Get
If m_CmdOrderBtn Is Nothing Then
m_CmdOrderBtn = New Command(AddressOf ShowOrder)
End If
Return m_CmdOrderBtn
End Get
End Property
Public Sub ShowOrder()
Dim OrderWnd As New OrderV(Application.Current.MainWindow, New OrderVM())
OrderWnd.ShowDialog()
End Sub
#End Region ' Comand
#Region "METHODS"
' letto il nome della porta restituisce l'oggetto correttamente selezionato dal vettore delle porte
Private Function SelectDoor(NamePart As String) As Part
Dim Index As Integer
Dim ref_Part As Part = Nothing
For Index = 0 To CInt(CurrAssembly.DoorNumber) - 1
If CurrAssembly.GetArrayPartDoor(Index).Type = NamePart Then
ref_Part = CurrAssembly.GetArrayPartDoor(Index).Door
Exit For
End If
Next
Return ref_Part
End Function
#End Region ' Methods
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
End Class