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

Public Class LeftPanelVM
   Inherits VMBase

#Region "FIELDS & PROPERTIES"

   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_LeftPanel_IsEnabled As Boolean = True
   Public ReadOnly Property LeftPanel_IsEnabled As Boolean
      Get
         Return m_LeftPanel_IsEnabled
      End Get
   End Property

   Public ReadOnly Property SearchFilter_IsEnabled As Boolean
      Get
         Return Not Map.refFreeContourManagerVM.bIsActive
      End Get
   End Property

   Private m_Parameters_IsEnabled As Boolean = False
   Public ReadOnly Property Parameters_IsEnabled As Boolean
      Get
         Return m_Parameters_IsEnabled
      End Get
   End Property
   Friend Sub SetParametersIsEnabled(bIsEnabled As Boolean)
      m_Parameters_IsEnabled = bIsEnabled
      NotifyPropertyChanged(NameOf(Parameters_IsEnabled))
   End Sub

   Private m_Data_IsEnabled As Boolean = False
   Public ReadOnly Property Data_IsEnabled As Boolean
      Get
         Return m_Data_IsEnabled
      End Get
   End Property
   Friend Sub SetData_IsEnabled(bIsEnabled As Boolean)
      m_Data_IsEnabled = bIsEnabled
      NotifyPropertyChanged(NameOf(Data_IsEnabled))
   End Sub

   Private m_OnlyProdPartManagerVisibility As Visibility = Visibility.Collapsed
   Public ReadOnly Property OnlyProdPartManagerVisibility As Visibility
      Get
         Return m_OnlyProdPartManagerVisibility
      End Get
   End Property
   Friend Sub SetOnlyProdPartManager_Visibility(value As Visibility)
      m_OnlyProdPartManagerVisibility = value
      NotifyPropertyChanged(NameOf(OnlyProdPartManagerVisibility))
   End Sub

   ' Definizione comandi
   Private m_cmdData As ICommand
   Private m_cmdParameter As ICommand

#Region "Messages"

   Public ReadOnly Property SearchFilter_Msg As String
      Get
         Return EgtMsg(61949)
      End Get
   End Property

   Public ReadOnly Property Section_Msg As String
      Get
         Return EgtMsg(61771)
      End Get
   End Property

   Public ReadOnly Property Group_Msg As String
      Get
         Return EgtMsg(61624)
      End Get
   End Property
   Public ReadOnly Property SubGroup_Msg As String
      Get
         Return EgtMsg(61623)
      End Get
   End Property

   Public ReadOnly Property ParType_Msg As String
      Get
         Return EgtMsg(61950)
      End Get
   End Property

   Public ReadOnly Property ParValue_Msg As String
      Get
         Return EgtMsg(61951)
      End Get
   End Property

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

   Public ReadOnly Property Description_Msg As String
      Get
         Return EgtMsg(62511)
      End Get
   End Property

   Public ReadOnly Property Data_ToolTip As String
      Get
         Return EgtMsg(61897)
      End Get
   End Property

   Public ReadOnly Property Parameters_ToolTip As String
      Get
         Return EgtMsg(61898)
      End Get
   End Property

#End Region    ' Messages

#End Region    'FIELDS & PROPERTIES

   Sub New()
      ' imposto riferimento su mappa
      Map.SetRefLeftPanelVM(Me)
      ' imposto dimensioni colonne/righe della Grid
      DimensionsIniFile.ReadGridDimensions(ConstDims.LEFTPANEL_VIEW, GridDims)
   End Sub

#Region "METHODS"

   Friend Sub SetLeftPanelIsEnabled(bIsEnabled As Boolean)
      m_LeftPanel_IsEnabled = bIsEnabled
      NotifyPropertyChanged(NameOf(LeftPanel_IsEnabled))
      NotifyPropertyChanged(NameOf(SearchFilter_IsEnabled))
   End Sub

#End Region    ' METHODS

#Region "COMMANDS"

#Region "Data"

   ''' <summary>
   ''' Returns a command that do Open.
   ''' </summary>
   Public ReadOnly Property Data_Command As ICommand
      Get
         If m_cmdData Is Nothing Then
            m_cmdData = New Command(AddressOf Data)
         End If
         Return m_cmdData
      End Get
   End Property

   ''' <summary>
   ''' Execute the Open.  This method is invoked by the OpenCommand.
   ''' </summary>
   Friend Sub Data()
      Dim BTLDataWnd As New BTLDataWndV(Application.Current.MainWindow, New BTLDataWndVM())
      BTLDataWnd.ShowDialog()
   End Sub

#End Region ' Data

#Region "Parameter"

   ''' <summary>
   ''' Returns a command that do Open.
   ''' </summary>
   Public ReadOnly Property Parameter_Command As ICommand
      Get
         If m_cmdParameter Is Nothing Then
            m_cmdParameter = New Command(AddressOf Parameter)
         End If
         Return m_cmdParameter
      End Get
   End Property

   ''' <summary>
   ''' Execute the Open.  This method is invoked by the OpenCommand.
   ''' </summary>
   Friend Sub Parameter()
      Dim PartParametersWnd As New PartParametersWndV(Application.Current.MainWindow, New PartParametersWndVM())
      PartParametersWnd.ShowDialog()
   End Sub

#End Region ' Parameter

#End Region    ' COMMANDS

End Class
