Imports System.Collections.ObjectModel
Imports EgtBEAMWALL.Core
Imports EgtUILib

Public Class PartInRawPartListVM

   Private m_colPartInRawPart_Offset As EgtDataGridColumn
   Public ReadOnly Property colPartInRawPart_Offset As EgtDataGridColumn
      Get
         Return m_colPartInRawPart_Offset
      End Get
   End Property

   Private m_colPartInRawPart_Rot As EgtDataGridColumn
   Public ReadOnly Property colPartInRawPart_Rot As EgtDataGridColumn
      Get
         Return m_colPartInRawPart_Rot
      End Get
   End Property

   Private m_colPartInRawPart_Flip As EgtDataGridColumn
   Public ReadOnly Property colPartInRawPart_Flip As EgtDataGridColumn
      Get
         Return m_colPartInRawPart_Flip
      End Get
   End Property

   Private m_colPartInRawPart_PosX As EgtDataGridColumn
   Public ReadOnly Property colPartInRawPart_PosX As EgtDataGridColumn
      Get
         Return m_colPartInRawPart_PosX
      End Get
   End Property

   Private m_colPartInRawPart_PosY As EgtDataGridColumn
   Public ReadOnly Property colPartInRawPart_PosY As EgtDataGridColumn
      Get
         Return m_colPartInRawPart_PosY
      End Get
   End Property

   Private m_PartInRawPartColumns As New ObservableCollection(Of EgtDataGridColumn)
   Public Property PartInRawPartColumns As ObservableCollection(Of EgtDataGridColumn)
      Get
         Return m_PartInRawPartColumns
      End Get
      Set(value As ObservableCollection(Of EgtDataGridColumn))
         m_PartInRawPartColumns = value
      End Set
   End Property

#Region "Messages"

   Public ReadOnly Property PDN_Msg As String
      Get
         Return EgtMsg(61809)
      End Get
   End Property

   Public ReadOnly Property W_Msg As String
      Get
         Return EgtMsg(61605)
      End Get
   End Property

   Public ReadOnly Property H_Msg As String
      Get
         Return EgtMsg(61606)
      End Get
   End Property

   Public ReadOnly Property L_Msg As String
      Get
         Return EgtMsg(61604)
      End Get
   End Property

   Public ReadOnly Property NAM_Msg As String
      Get
         Return EgtMsg(61603)
      End Get
   End Property
   Public ReadOnly Property PosX_Msg As String
      Get
         Return EgtMsg(61811)
      End Get
   End Property
   Public ReadOnly Property PosY_Msg As String
      Get
         Return EgtMsg(61812)
      End Get
   End Property
   Public ReadOnly Property Offset_Msg As String
      Get
         Return EgtMsg(61755)
      End Get
   End Property

   Public ReadOnly Property MAT_Msg As String
      Get
         Return EgtMsg(61607)
      End Get
   End Property

   Public ReadOnly Property GRP_Msg As String
      Get
         Return EgtMsg(61624)
      End Get
   End Property

   Public ReadOnly Property STOREY_Msg As String
      Get
         Return EgtMsg(61623)
      End Get
   End Property

#End Region    ' Messages

#Region "CONSTRUCTOR"

   Sub New()
      ' aggiungo riferimento a map
      Map.SetRefPartInRawPartListVM(Me)
      ' carico le colonne della datagrid
      'GetPrivateProfileColumns(S_PARTINRAWPARTLIST_BEAM, PartInRawPartColumns)
   End Sub

#End Region    ' CONSTRUCTOR

   Friend Sub UpdateColumns(nMachType As MachineType)
      If nMachType = MachineType.BEAM Then
         PartInRawPartColumns.Clear()
         GetPrivateProfileColumns(S_PARTINRAWPARTLIST_BEAM, PartInRawPartColumns)
      ElseIf nMachType = MachineType.WALL Then
         PartInRawPartColumns.Clear()
         GetPrivateProfileColumns(S_PARTINRAWPARTLIST_WALL, PartInRawPartColumns)
      End If
      ' recupero riferimento a colonne Offset, Rot, Flip, PosX, PosY
      m_colPartInRawPart_Offset = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_OFFSET)
      m_colPartInRawPart_Rot = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_ROT)
      m_colPartInRawPart_Flip = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_FLIP)
      m_colPartInRawPart_PosX = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSX)
      m_colPartInRawPart_PosY = m_PartInRawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSY)
      ' aggiorno la visibilità delle colonne
      For Each col In PartInRawPartColumns
         col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
      Next
   End Sub

End Class
