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

Public Class RawPartListVM

#Region "FIELDS & PROPERTIES"

   Private m_colRawPart_StartCut As EgtDataGridColumn
   Public ReadOnly Property colRawPart_StartCut As EgtDataGridColumn
      Get
         Return m_colRawPart_StartCut
      End Get
   End Property

   Private m_colRawPart_W As EgtDataGridColumn
   Public ReadOnly Property colRawPart_W As EgtDataGridColumn
      Get
         Return m_colRawPart_W
      End Get
   End Property

   Private m_colRawPart_L As EgtDataGridColumn
   Public ReadOnly Property colRawPart_L As EgtDataGridColumn
      Get
         Return m_colRawPart_L
      End Get
   End Property

   Private m_colRawPart_PosZ As EgtDataGridColumn
   Public ReadOnly Property colRawPart_PosZ As EgtDataGridColumn
      Get
         Return m_colRawPart_PosZ
      End Get
   End Property

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

#Region "Messages"

   Public ReadOnly Property ID_Msg As String
      Get
         Return EgtMsg(61815)
      End Get
   End Property

   Public ReadOnly Property StartOffset_Msg As String
      Get
         Return EgtMsg(61816)
      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 PosZ_Msg As String
      Get
         Return EgtMsg(61728)
      End Get
   End Property

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

   Public ReadOnly Property Used_Msg As String
      Get
         Return EgtMsg(61817)
      End Get
   End Property

   Public ReadOnly Property Waste_Msg As String
      Get
         Return EgtMsg(61818)
      End Get
   End Property

#End Region    ' Messages

#End Region    ' FIELDS & PROPERTIES

#Region "CONSTRUCTOR"

   Sub New()
      ' Aggiungo riferimento a Map
      Map.SetRefRawPartListVM(Me)
      ' carico le colonne della datagrid
      'GetPrivateProfileColumns(S_RAWPARTLIST_BEAM, RawPartColumns)
   End Sub

#End Region    ' CONSTRUCTOR

   Friend Sub UpdateColumns(nMachType As MachineType)
      If nMachType = MachineType.BEAM Then
         RawPartColumns.Clear()
         GetPrivateProfileColumns(S_RAWPARTLIST_BEAM, RawPartColumns)
      ElseIf nMachType = MachineType.WALL Then
         RawPartColumns.Clear()
         GetPrivateProfileColumns(S_RAWPARTLIST_WALL, RawPartColumns)
      End If
      ' recupero riferimento a colonna StartCut
      m_colRawPart_StartCut = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_STARTCUT)
      m_colRawPart_W = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_W)
      m_colRawPart_L = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_L)
      m_colRawPart_PosZ = RawPartColumns.FirstOrDefault(Function(x) x.Name = COL_POSZ)
      ' aggiorno la visibilità delle colonne
      For Each col In RawPartColumns
         col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
      Next
   End Sub

End Class
