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

Public Class BTLFeatureVM
   Inherits Core.BTLFeatureVM

   Public Overrides Property bDO As Boolean
      Get
         Return m_BTLFeatureM.bDO
      End Get
      Set(value As Boolean)
         If EgtBeamEnableProcess(nFeatureId, value) Then
            m_BTLFeatureM.bDO = value
            NotifyPropertyChanged(NameOf(bDO))
            EgtDraw()
         End If
      End Set
   End Property
   Friend Sub SetDo(bValue As Boolean)
      If EgtBeamEnableProcess(nFeatureId, bValue) Then
         m_BTLFeatureM.bDO = bValue
         NotifyPropertyChanged(NameOf(bDO))
      End If
   End Sub

#Region "CONSTRUCTOR"

   Sub New(BTLFeatureM As BTLFeatureM, BTLPartM As BTLPartM)
      m_BTLFeatureM = BTLFeatureM
      m_BTLPartM = BTLPartM
      NotifyPropertyChanged(NameOf(Calc_Background))
   End Sub

   Sub New(BTLFeatureM As BTLFeatureM)
      m_BTLFeatureM = BTLFeatureM
      m_BTLPartM = Nothing
      NotifyPropertyChanged(NameOf(Calc_Background))
   End Sub

#End Region    ' CONSTRUCTOR

#Region "METHODS"

   ' funzione che aggiorna lo stato e gli errori dopo calcolo
   Friend Sub CalcFeatureUpdate(ERR As Integer, ROT As Integer, MSG As String)
      EgtSetInfo(nFeatureId, If(Map.refMainMenuVM.SelPage = Pages.VIEW, ITG_PROJ_ERR, ITG_PROD_ERR), ERR, True)
      EgtSetInfo(nFeatureId, If(Map.refMainMenuVM.SelPage = Pages.VIEW, ITG_PROJ_MSG, ITG_PROD_MSG), MSG, True)
      EgtSetInfo(nFeatureId, If(Map.refMainMenuVM.SelPage = Pages.VIEW, ITG_PROJ_ROT, ITG_PROD_ROT), ROT, True)
      m_BTLFeatureM.nCALC_ERR = ERR
      m_BTLFeatureM.nCALC_ROT = ROT
      m_BTLFeatureM.sCALC_MSG = MSG
      If ERR = 0 Then
         m_BTLFeatureM.nState = CalcStates.OK
      ElseIf ERR = 17 Then
         m_BTLFeatureM.nState = CalcStates.WARNING
      ElseIf ERR > 0 Then
         m_BTLFeatureM.nState = CalcStates.ERROR_
      ElseIf ERR < 0 Then
         m_BTLFeatureM.nState = Core.CalcStates.INFO
      End If
      NotifyPropertyChanged(NameOf(Calc_Background))
      NotifyPropertyChanged(NameOf(CALC_ROT_Visibility))
      NotifyPropertyChanged(NameOf(CALC_ERR_Letter))
      NotifyPropertyChanged(NameOf(CALC_ERR_Foreground))
   End Sub

#End Region    ' METHODS

#Region "COMMANDS"

#End Region    ' COMMANDS

End Class
