Imports System.Collections.ObjectModel
Imports System.Threading
Imports EgtBEAMWALL.Core
Imports EgtWPFLib5

Public Class ProjectVM
   Inherits VMBase

#Region "FIELDS & PROPERTIES"

   Public Enum TabPages As Integer
      SCENE = 0
      MDI = 1
      MACHINELOG = 2
   End Enum

   Private m_SelTabPage As TabPages
   Public Property SelTabPage As Integer
      Get
         Return m_SelTabPage
      End Get
      Set(value As Integer)
         m_SelTabPage = value
      End Set
   End Property
   Friend Sub SetSelTabPage(SelTabPage As TabPages)
      If SelTabPage <> m_SelTabPage Then
         If m_SelTabPage = TabPages.MACHINELOG Then
            Map.refCALCPanelVM.SetMachineLog(False)
         End If
         If SelTabPage = TabPages.MACHINELOG Then
            Map.refMachineLogPageVM.LoadMachineLogList()
         End If
         m_SelTabPage = SelTabPage
         NotifyPropertyChanged(NameOf(SelTabPage))
      End If
   End Sub

   Private Property m_GridDims As New ObservableCollection(Of GridDimension)
   Public Property GridDims As ObservableCollection(Of GridDimension)
      Get
         Return m_GridDims
      End Get
      Set
         m_GridDims = Value
         NotifyPropertyChanged(NameOf(GridDims))
      End Set
   End Property

   Private m_ProdMachGroupPanelVM As MyMachGroupPanelVM
   Public Property ProdMachGroupPanelVM As MyMachGroupPanelVM
      Get
         Return m_ProdMachGroupPanelVM
      End Get
      Set(value As MyMachGroupPanelVM)
         m_ProdMachGroupPanelVM = value
         NotifyPropertyChanged(NameOf(ProdMachGroupPanelVM))
      End Set
   End Property

   Private m_SupervisorMachGroupPanelVM As SupervisorMachGroupPanelVM
   Public Property SupervisorMachGroupPanelVM As SupervisorMachGroupPanelVM
      Get
         Return m_SupervisorMachGroupPanelVM
      End Get
      Set(value As SupervisorMachGroupPanelVM)
         m_SupervisorMachGroupPanelVM = value
         NotifyPropertyChanged(NameOf(SupervisorMachGroupPanelVM))
      End Set
   End Property

   Private m_LeftPanel_Visibility As Boolean = True
   Public Property LeftPanel_Visibility As Visibility
      Get
         Return If(m_LeftPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
      End Get
      Set(value As Visibility)
         m_LeftPanel_Visibility = (value = Visibility.Visible)
      End Set
   End Property
   Friend Sub SetLeftPanel_Visibility(IsVisible As Boolean)
      m_LeftPanel_Visibility = IsVisible
   End Sub

   Private m_TopPanel_Visibility As Boolean = False
   Public Property TopPanel_Visibility As Visibility
      Get
         Return If(m_TopPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
      End Get
      Set(value As Visibility)
         m_TopPanel_Visibility = (value = Visibility.Visible)
      End Set
   End Property
   Friend Sub SetTopPanel_Visibility(IsVisible As Boolean)
      m_TopPanel_Visibility = IsVisible
   End Sub

   Private m_BottomPanel_Visibility As Boolean = True
   Public Property BottomPanel_Visibility As Visibility
      Get
         Return If(m_BottomPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
      End Get
      Set(value As Visibility)
         m_BottomPanel_Visibility = (value = Visibility.Visible)
      End Set
   End Property
   Friend Sub SetBottomPanel_Visibility(IsVisible As Boolean)
      m_BottomPanel_Visibility = IsVisible
   End Sub

   Private m_PartManager_Visibility As Boolean = True
   Public Property PartManager_Visibility As Visibility
      Get
         Return If(m_PartManager_Visibility, Visibility.Visible, Visibility.Collapsed)
      End Get
      Set(value As Visibility)
         m_PartManager_Visibility = (value = Visibility.Visible)
      End Set
   End Property
   Friend Sub SetPartManager_Visibility(IsVisible As Boolean)
      m_PartManager_Visibility = IsVisible
   End Sub

   Private m_FeatureManager_Visibility As Boolean = True
   Public Property FeatureManager_Visibility As Visibility
      Get
         Return If(m_FeatureManager_Visibility, Visibility.Visible, Visibility.Collapsed)
      End Get
      Set(value As Visibility)
         m_FeatureManager_Visibility = (value = Visibility.Visible)
      End Set
   End Property
   Friend Sub SetFeatureManager_Visibility(IsVisible As Boolean)
      m_FeatureManager_Visibility = IsVisible
   End Sub

   Private m_ShowBeamPanel_Visibility As Boolean = True
   Public Property ShowBeamPanel_Visibility As Visibility
      Get
         Return If(m_ShowBeamPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
      End Get
      Set(value As Visibility)
         m_ShowBeamPanel_Visibility = (value = Visibility.Visible)
      End Set
   End Property
   Friend Sub SetShowBeamPanel_Visibility(IsVisible As Boolean)
      m_ShowBeamPanel_Visibility = IsVisible
   End Sub

   Private m_ProjManager_Visibility As Boolean = True
   Public Property ProjManager_Visibility As Visibility
      Get
         Return If(m_ProjManager_Visibility, Visibility.Visible, Visibility.Collapsed)
      End Get
      Set(value As Visibility)
         m_ProjManager_Visibility = (value = Visibility.Visible)
      End Set
   End Property
   Friend Sub SetProjManager_Visibility(IsVisible As Boolean)
      m_ProjManager_Visibility = IsVisible
   End Sub

   Private m_ProdManager_Visibility As Boolean = True
   Public Property ProdManager_Visibility As Visibility
      Get
         Return If(m_ProdManager_Visibility, Visibility.Visible, Visibility.Collapsed)
      End Get
      Set(value As Visibility)
         m_ProdManager_Visibility = (value = Visibility.Visible)
      End Set
   End Property
   Friend Sub SetProdManager_Visibility(IsVisible As Boolean)
      m_ProdManager_Visibility = IsVisible
   End Sub

   Friend Sub NotifyAllPanelVisibility()
      NotifyPropertyChanged("LeftPanel_Visibility")
      NotifyPropertyChanged("TopPanel_Visibility")
      NotifyPropertyChanged("BottomPanel_Visibility")
      NotifyPropertyChanged("PartManager_Visibility")
      NotifyPropertyChanged("FeatureManager_Visibility")
      NotifyPropertyChanged("ShowBeamPanel_Visibility")
      NotifyPropertyChanged("ProjManager_Visibility")
      NotifyPropertyChanged("ProdManager_Visibility")
   End Sub

#End Region    ' FIELDS & PROPERTIES

#Region "CONSTRUCTOR"

   Sub New()
      ' Creo riferimento a questa classe in Map
      Map.SetRefProjectVM(Me)
      ' imposto dimensioni colonne/righe della Grid
      DimensionsIniFile.ReadGridDimensions(ConstDims.PROJECT_SUPERVISOR, GridDims)
   End Sub

#End Region    ' CONSTRUCTOR

   Friend Sub ManageIsEnabled(bIsEnabled As Boolean)
      'Map.refInstrumentPanelVM.SetInstrumentPanelIsEnabled(bIsEnabled)
      Map.refCALCPanelVM.SetCalcPanelIsEnabled(bIsEnabled)
      Map.refMainMenuVM.SetMainMenuIsEnabled(bIsEnabled)
      Map.refLeftPanelVM.SetLeftPanelIsEnabled(bIsEnabled)
      Map.refSupervisorManagerVM.SetSupervisorManagerIsEnabled(bIsEnabled)
      ' aggiungere gestione colonne editabili delle tabelle


   End Sub

End Class

