Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib

Public Class ProjectFileVM
   Inherits VMBase

   Protected m_ProjectFileM As ProjectFileM

   Public Overridable ReadOnly Property nProjId As Integer
      Get
         Return m_ProjectFileM.nProjId
      End Get
   End Property
   Public Overridable ReadOnly Property sProjId As String
      Get
         Return m_ProjectFileM.nProjId.ToString("0000")
      End Get
   End Property

   Public Overridable ReadOnly Property nProdId As Integer
      Get
         Return m_ProjectFileM.nProdId
      End Get
   End Property
   Public Overridable ReadOnly Property sProdId As String
      Get
         Return m_ProjectFileM.nProdId.ToString("0000")
      End Get
   End Property

   Friend Overridable ReadOnly Property sProjDirPath As String
      Get
         If IsNothing(m_ProjectFileM.nProjId) OrElse m_ProjectFileM.nProjId = 0 Then Return String.Empty
         Return refMainWindowVM.MainWindowM.sProjsDir & "\" & nProjId.ToString("0000")
      End Get
   End Property
   Friend Overridable ReadOnly Property sProjPath As String
      Get
         Dim sPath As String = String.Empty
         If IsNothing(m_ProjectFileM.nProjId) OrElse m_ProjectFileM.nProjId = 0 Then Return String.Empty
         sPath = refMainWindowVM.MainWindowM.sProjsDir & "\" & nProjId.ToString("0000") & "\" & nProjId.ToString("0000") & ".nge"
         Return sPath
      End Get
   End Property

   Friend Overridable ReadOnly Property sProdDirPath As String
      Get
         Dim sPath As String = String.Empty
         If IsNothing(m_ProjectFileM.nProdId) OrElse m_ProjectFileM.nProdId = 0 Then Return String.Empty
         Return refMainWindowVM.MainWindowM.sProdsDir & "\" & nProdId.ToString("0000")
      End Get
   End Property
   Friend Overridable ReadOnly Property sProdPath As String
      Get
         Dim sPath As String = String.Empty
         If IsNothing(m_ProjectFileM.nProdId) OrElse m_ProjectFileM.nProdId = 0 Then Return String.Empty
         Return refMainWindowVM.MainWindowM.sProdsDir & "\" & nProdId.ToString("0000") & "\" & nProdId.ToString("0000") & ".nge"
      End Get
   End Property

   Public Overridable Property bIsNew As Boolean
      Get
         Return m_ProjectFileM.bIsNew
      End Get
      Set(value As Boolean)
         m_ProjectFileM.bIsNew = value
      End Set
   End Property

   Public Overridable Property bIsLocked As Boolean
      Get
         Return m_ProjectFileM.bIsLocked
      End Get
      Set(value As Boolean)
         m_ProjectFileM.bIsLocked = value
      End Set
   End Property

   Public ReadOnly Property dtCreateDate As DateTime
      Get
         Return m_ProjectFileM.dtCreateDate
      End Get
   End Property

   Public ReadOnly Property nType As BWType
      Get
         Return m_ProjectFileM.nType
      End Get
   End Property

   ' variabile che indica se ricaricare il progetto
   Private m_bReloadProject As Boolean = True
   Friend ReadOnly Property bReloadProject As Boolean
      Get
         Return m_bReloadProject
      End Get
   End Property

#Region "Messages"

   Public ReadOnly Property Id_Msg As String
      Get
         Return EgtMsg(61815)
      End Get
   End Property
   Public ReadOnly Property BTLFileName_Msg As String
      Get
         Return EgtMsg(61819)
      End Get
   End Property
   Public ReadOnly Property ListName_Msg As String
      Get
         Return EgtMsg(61820)
      End Get
   End Property
   Public ReadOnly Property ExportDate_Msg As String
      Get
         Return EgtMsg(61821)
      End Get
   End Property
   Public ReadOnly Property CreateDate_Msg As String
      Get
         Return EgtMsg(61822)
      End Get
   End Property
   Public ReadOnly Property Name_Msg As String
      Get
         Return EgtMsg(61808)
      End Get
   End Property

#End Region    ' Messages

#Region "CONSTRUCTORS"

#End Region    ' CONSTRUCTORS

   Friend Sub SetReloadProject(bValue As Boolean)
      m_bReloadProject = bValue
   End Sub

End Class