Imports System.Collections.ObjectModel
Imports System.Windows
Imports System.Windows.Input
Imports System.Windows.Media
Imports EgtUILib
Imports EgtWPFLib5

Public Class BTLParamM

   ' parametro che dice se il parametro e' P o Q
   Protected m_bIsP As Boolean = True
   Public ReadOnly Property bIsP As Boolean
      Get
         Return m_bIsP
      End Get
   End Property

   ' parametro che dice se il parametro e' stato modificato
   Protected m_bIsModified As Boolean
   Public Property bIsModified As Boolean
      Get
         Return m_bIsModified
      End Get
      Set(value As Boolean)
         m_bIsModified = value
      End Set
   End Property

   ' parametri da struttura
   Protected m_sName As String
   Public Property sName As String
      Get
         Return m_sName
      End Get
      Set(value As String)
         m_sName = value
      End Set
   End Property

   Protected m_nId As Integer
   Public ReadOnly Property nId As Integer
      Get
         Return m_nId
      End Get
   End Property

   Protected m_sDescription As String
   Public Property sDescription As String
      Get
         Return m_sDescription
      End Get
      Set(value As String)
         m_sDescription = value
      End Set
   End Property

   ' parametri da struttura
   Protected m_dMin As Double
   Public Property dMin As Double
      Get
         Return m_dMin
      End Get
      Set(value As Double)
         m_dMin = value
      End Set
   End Property

   Protected m_dMax As Double
   Public Property dMax As Double
      Get
         Return m_dMax
      End Get
      Set(value As Double)
         m_dMax = value
      End Set
   End Property

   Protected m_ValueList As List(Of String)
   Public ReadOnly Property ValueList As List(Of String)
      Get
         Return m_ValueList
      End Get
   End Property

   ' parametri da geometria
   Protected m_dValue As Double
   Public Overridable Property dValue As Double
      Get
         Return m_dValue
      End Get
      Set(value As Double)
         m_dValue = value
      End Set
   End Property
   Public Sub SetValue(value As Double)
      m_dValue = value
   End Sub

   Protected m_sValue As String
   Public Overridable Property sValue As String
      Get
         Return m_sValue
      End Get
      Set(value As String)
         m_sValue = value
      End Set
   End Property
   Public Sub SetValue(value As String)
      m_sValue = value
   End Sub

   Protected m_nSelValue As Integer
   Public Property nSelValue As Integer
      Get
         Return m_nSelValue
      End Get
      Set(value As Integer)
         m_nSelValue = value
      End Set
   End Property

   Protected m_dDefault As Double
   Public Property dDefault As Double
      Get
         Return m_dDefault
      End Get
      Set(value As Double)
         m_dDefault = value
      End Set
   End Property

   Protected m_sDefault As String
   Public Property sDefault As String
      Get
         Return m_sDefault
      End Get
      Set(value As String)
         m_sDefault = value
      End Set
   End Property

   ' tipo della variabile
   Protected m_nType As BTLParamType
   Public ReadOnly Property nType As BTLParamType
      Get
         Return m_nType
      End Get
   End Property
   Public Sub SetType(value As BTLParamType)
      m_nType = value
   End Sub

   ' Feature a cui appartiene il parametro
   Protected m_ParentFeature As BTLFeatureM
   Public ReadOnly Property ParentFeature As BTLFeatureM
      Get
         Return m_ParentFeature
      End Get
   End Property

   Protected m_bCustom As Boolean
   Public Property bCustom As Boolean
      Get
         Return m_bCustom
      End Get
      Set(value As Boolean)
         m_bCustom = value
      End Set
   End Property

   Protected m_sBWType As String
   Public Property sBWType As String
      Get
         Return m_sBWType
      End Get
      Set(value As String)
         m_sBWType = value
      End Set
   End Property

#Region "MESSAGES"

   Public ReadOnly Property Name_Msg As String
      Get
         Return EgtMsg(61614)
      End Get
   End Property

   Public ReadOnly Property Value_Msg As String
      Get
         Return EgtMsg(61615)
      End Get
   End Property

   Public ReadOnly Property Min_Msg As String
      Get
         Return EgtMsg(61616)
      End Get
   End Property

   Public ReadOnly Property Max_Msg As String
      Get
         Return EgtMsg(61617)
      End Get
   End Property

#End Region

   Public Sub StdInit(ParentFeature As BTLFeatureM, IsP As Boolean, Type As BTLParamType, sName As String, sDescription As String)
      m_ParentFeature = ParentFeature
      m_bIsP = IsP
      m_nType = Type
      m_sName = sName
      Dim nDescription As Integer
      If IsNumeric(sDescription) AndAlso Integer.TryParse(sDescription, nDescription) Then
         m_sDescription = EgtMsg(sDescription)
      Else
         m_sDescription = sDescription
      End If
      If Not String.IsNullOrWhiteSpace(sName) Then
         Dim sId As String = sName.Trim({"P"c, "Q"c, "p"c, "q"c})
         Integer.TryParse(sId, m_nId)
      End If
   End Sub

#Region "CONSTRUCTOR"

   Protected Sub New()
   End Sub

   Public Shared Function CreateNewBTLParam() As BTLParamM
      Return New BTLParamM
   End Function

   ' new per double e length
   Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String,
                                         dMin As Double, dMax As Double, dDefault As Double, sDescription As String) As BTLParamM
      Dim NewBTLParam As New BTLParamM

      NewBTLParam.StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
      NewBTLParam.dMin = dMin
      NewBTLParam.dMax = dMax
      NewBTLParam.m_dDefault = dDefault
      Return NewBTLParam
   End Function

   ' new per double e length (con tipo Beam o Wall)
   Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String,
                                         dMin As Double, dMax As Double, dDefault As Double, sDescription As String, sBWType As String) As BTLParamM
      Dim NewBTLParam As New BTLParamM

      NewBTLParam.StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
      NewBTLParam.dMin = dMin
      NewBTLParam.dMax = dMax
      NewBTLParam.m_dDefault = dDefault
      NewBTLParam.m_sBWType = sBWType
      Return NewBTLParam
   End Function

   ' new per stringhe
   Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, sDefault As String, sDescription As String)
      Dim NewBTLParam As New BTLParamM
      NewBTLParam.StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
      NewBTLParam.m_sDefault = sDefault
      Return NewBTLParam
   End Function

   ' new per stringhe (con tipo Beam o Wall)
   Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, sDefault As String, sDescription As String, sBWType As String)
      Dim NewBTLParam As New BTLParamM
      NewBTLParam.StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
      NewBTLParam.m_sDefault = sDefault
      NewBTLParam.m_sBWType = sBWType
      Return NewBTLParam
   End Function

   ' new per combobox
   Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, nMin As Integer, nMax As Integer, nDefault As Integer, sDescription As String, ValueList As List(Of String))
      Dim NewBTLParam As New BTLParamM
      NewBTLParam.StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
      NewBTLParam.dMin = nMin
      NewBTLParam.dMax = nMax
      NewBTLParam.m_dDefault = nDefault
      NewBTLParam.m_ValueList = ValueList
      Return NewBTLParam
   End Function

   ' new per combobox (con tipo Beam o Wall)
   Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, nMin As Integer, nMax As Integer, nDefault As Integer, sDescription As String, ValueList As List(Of String), sBWType As String)
      Dim NewBTLParam As New BTLParamM
      NewBTLParam.StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
      NewBTLParam.dMin = nMin
      NewBTLParam.dMax = nMax
      NewBTLParam.m_dDefault = nDefault
      NewBTLParam.m_ValueList = ValueList
      NewBTLParam.m_sBWType = sBWType
      Return NewBTLParam
   End Function

   ' new per parametro vuoto
   Public Shared Function CreateBTLParam(IsP As Boolean, nType As BTLParamType, sParamName As String)
      Dim NewBTLParam As New BTLParamM
      NewBTLParam.StdInit(Nothing, IsP, nType, sParamName, "")
      Return NewBTLParam
   End Function

   '' new per double e length
   'Sub New(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, dMin As Double, dMax As Double, dDefault As Double, sDescription As String)
   '   StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
   '   m_dMin = dMin
   '   m_dMax = dMax
   '   m_dDefault = dDefault
   'End Sub

   '' new per stringhe
   'Sub New(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, sDescription As String)
   '   StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
   'End Sub

   '' new per combobox
   'Sub New(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, nMin As Integer, nMax As Integer, nDefault As Integer, sDescription As String, ValueList As List(Of String))
   '   StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
   '   m_dMin = nMin
   '   m_dMax = nMax
   '   m_dDefault = nDefault
   '   m_ValueList = ValueList
   'End Sub

   '' new per parametro vuoto
   'Sub New(IsP As Boolean, nType As BTLParamType, sParamName As String)
   '   StdInit(Nothing, IsP, nType, sParamName, "")
   'End Sub

#End Region    ' CONSTRUCTOR

#Region "METHODS"

#End Region    ' METHODS

End Class

