Files

369 lines
10 KiB
VB.net

Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Public Class AssemblyPageVM
Implements INotifyPropertyChanged
' copia del riferimento all'assemblato corrente
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 comandi
Private m_CmdJambBtn As ICommand
Private m_EnterRefreshCmd As ICommand
Private m_CmdOrderBtn As ICommand
' all'avvio del programma definisco come pagina impostata quella dell'Assemblato (altrimenti dovrei definire "FR_", "FL_"..)
Public Property SlectedPart As String = "AssemblyPage"
' Costruttore
Sub New()
Map.SetRefJambPageVM(Me)
End Sub
Sub PrepareEvent()
If Not IsNothing(Map.refInstrumentPanelVM) Then
AddHandler Map.refInstrumentPanelVM.EnableCurrentPage, AddressOf Me.SetStatusPage
End If
End Sub
#Region "Messages"
Public ReadOnly Property JambPageMsg As String
Get
' Jamb
Return EgtMsg(50055)
End Get
End Property
Public ReadOnly Property LightUpMsg As String
Get
' Light Up
Return EgtMsg(50056)
End Get
End Property
Public ReadOnly Property LightLockMsg As String
Get
' Light Lock
Return EgtMsg(50057)
End Get
End Property
Public ReadOnly Property LightBottomMsg As String
Get
' Light Bottom
Return EgtMsg(50058)
End Get
End Property
Public ReadOnly Property LightHingeMsg As String
Get
' Light Hinge
Return EgtMsg(50059)
End Get
End Property
Public ReadOnly Property ThicknessHeadMsg As String
Get
' Thickness Head
Return EgtMsg(50060)
End Get
End Property
Public ReadOnly Property OverlapHingeMsg As String
Get
' Overlap Hinge
Return EgtMsg(50061)
End Get
End Property
Public ReadOnly Property OverlapLockMsg As String
Get
' Overlap Lock
Return EgtMsg(50062)
End Get
End Property
Public ReadOnly Property OverlapTopMsg As String
Get
' Overlap Top
Return EgtMsg(50063)
End Get
End Property
Public ReadOnly Property DeltaTMsg As String
Get
' Delta T
Return EgtMsg(50064)
End Get
End Property
Public ReadOnly Property ExteriorMsg As String
Get
' Exterior
Return EgtMsg(50065)
End Get
End Property
Public ReadOnly Property DoorNumberMsg As String
Get
' Number of Doors
Return EgtMsg(50066)
End Get
End Property
Public ReadOnly Property JambsAndDoorsMsg As String
Get
' Jambs and Doors
Return EgtMsg(50067)
End Get
End Property
Public ReadOnly Property OrderMsg As String
Get
' Order
Return EgtMsg(50068)
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
' 50715=Depth
Return EgtMsg(50715)
End Get
End Property
Public ReadOnly Property WidthMsg As String
Get
' 50003=Thickness
Return EgtMsg(50003)
End Get
End Property
Public ReadOnly Property DimensionMsg As String
Get
' 50418=Dimension
Return EgtMsg(50418)
End Get
End Property
Public ReadOnly Property TotalHeightMsg As String
Get
' 50002=Height
Return EgtMsg(50002)
End Get
End Property
Public ReadOnly Property TotalWidthMsg As String
Get
' 50001=Width
Return EgtMsg(50001)
End Get
End Property
Public ReadOnly Property OverlapBottomMsg As String
Get
' 50716=Overlap Bottom
Return EgtMsg(50716)
End Get
End Property
Public ReadOnly Property ThicknessBottomMsg As String
Get
' 50717=Thickness Bottom
Return EgtMsg(50717)
End Get
End Property
Public ReadOnly Property DepthBottomMsg As String
Get
' 50718=Depth Bottom
Return EgtMsg(50718)
End Get
End Property
Public ReadOnly Property DeltaBottomMsg As String
Get
' 50719=Delta Bottom
Return EgtMsg(50719)
End Get
End Property
#End Region
#Region "COMMANDS"
#Region "PARTBtn"
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
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))
SlectedPart = SelectPart
Dim bOkSelection As Boolean = False
' In questa fase manca la gestione degli swing dei Jamb
Select Case SelectPart
Case ConstGen.PART_FRAME_LEFT
bOkSelection = LoadSelectedPartDoor(ConstGen.PART_FRAME_LEFT, OptionModule.m_CompoPanelFrameVisibility, True)
Case ConstGen.PART_FRAME_RIGHT
bOkSelection = LoadSelectedPartDoor(ConstGen.PART_FRAME_RIGHT, OptionModule.m_CompoPanelFrameVisibility, True)
Case ConstGen.PART_FRAME_TOP
bOkSelection = LoadSelectedPartDoor(ConstGen.PART_FRAME_TOP, OptionModule.m_CompoPanelFrameVisibility, True)
Case ConstGen.PART_FRAME_BOTTOM
bOkSelection = LoadSelectedPartDoor(ConstGen.PART_FRAME_BOTTOM, OptionModule.m_CompoPanelFrameVisibility, True)
Case Else
bOkSelection = LoadSelectedPartDoor(SelectPart, Visibility.Visible, OptionModule.ReadOnlyDDF)
End Select
If bOkSelection Then Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage
' aggiorno elenco quotature
Map.refDimensioningPanelVM.LoadHardwareDimList()
Map.refSceneManagerVM.RefreshBtn()
Map.refProjectManagerVM.NotifyPropertyChanged("VisibilityCreateAssembly")
End Sub
#End Region ' PartBtn
#Region "REFRESH"
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
#End Region ' Refresh
#Region "ORDER"
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 ' Order
#End Region ' Comand
#Region "METHODS"
' ricevuto il nome dell'oggetto di tipo Part restituisce il PartDoor che lo contiene
Public Function ReserchPartDoor(TypePart As String) As PartDoor
Dim PD As PartDoor = Nothing
If IsNothing(CurrAssembly) OrElse IsNothing(CurrAssembly.ListPartDoor) Then
Return PD
End If
For IndexPartDoor As Integer = 0 To CurrAssembly.ListPartDoor.Count - 1
If CurrAssembly.ListPartDoor(IndexPartDoor).Door.TypePart.Contains(TypePart) Then
PD = CurrAssembly.ListPartDoor(IndexPartDoor)
Exit For
End If
Next
Return PD
End Function
' carica a video l'ogetto di cui è passato il nome (TypePart)
Private Function LoadSelectedPartDoor(TypePart As String, CompoPanelVisibility As Visibility, PartPageIsReadOnly As Boolean) As Boolean
Dim Local_PD As PartDoor = ReserchPartDoor(TypePart)
If IsNothing(Local_PD) Then Return False
DdfFile.WriteDDFPart(Local_PD.Door, IniFile.m_sTempDir & "\" & TEMP_FILE, True, False)
ExecDoors(Map.refSceneManagerVM.ProjectScene, IniFile.m_sTempDir & "\" & TEMP_FILE, False)
Map.refPartPageVM.CurrPart = Local_PD.Door
Map.refCompoPanelVM.IsVisible = CompoPanelVisibility
Map.refPartPageVM.NotifyPropertyChanged("VisibilityTopShape")
Map.refPartPageVM.IsRaedOnly = PartPageIsReadOnly
Return True
End Function
Sub SetStatusPage()
NotifyPropertyChanged("EnablePageAssembly")
End Sub
Public ReadOnly Property EnablePageAssembly As Boolean
Get
Map.refProjectManagerVM.NotifyPropertyChanged("EnableProjectManager")
Map.refAssemblyManagerVM.NotifyPropertyChanged("EnableAssebmlyManager")
If Not IsNothing(Map.refInstrumentPanelVM) Then
Return Map.refInstrumentPanelVM.EnablePage
Else
Return True
End If
End Get
End Property
#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