Files
egtbeamwall/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerVM.vb
T
Demetrio Cassarino 9d572699a2 -suddiviso in più xaml la finestra strategymanagerv
-inizio gestione checkboc, combobox
2025-05-05 17:34:56 +02:00

1141 lines
37 KiB
VB.net

Imports System.Collections.ObjectModel
Imports EgtWPFLib5
Imports Newtonsoft.Json
Imports System.IO
Imports EgtBEAMWALL.Core
Public Class StrategyManagerVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
' Lista che contiene il file json AvailableStrategyList
Private m_JsonStrategyFeatureList As New ObservableCollection(Of JsonAvailableStrategy)
Public Property JsonStrategyFeatureList As ObservableCollection(Of JsonAvailableStrategy)
Get
Return m_JsonStrategyFeatureList
End Get
Set(value As ObservableCollection(Of JsonAvailableStrategy))
m_JsonStrategyFeatureList = value
NotifyPropertyChanged(NameOf(JsonStrategyFeatureList))
End Set
End Property
' Lista che contiene il file json AvailableStrategyList
Private m_AvailableStrategyList As New ObservableCollection(Of AvailableStrategy)
Public Property AvailableStrategyList As ObservableCollection(Of AvailableStrategy)
Get
Return m_AvailableStrategyList
End Get
Set(value As ObservableCollection(Of AvailableStrategy))
m_AvailableStrategyList = value
NotifyPropertyChanged(NameOf(AvailableStrategyList))
End Set
End Property
' Lista che contiene il file json AvailableStrategyList
Private m_CustomerConfigurationList As New ObservableCollection(Of AvailableStrategy)
Public Property CustomerConfigurationList As ObservableCollection(Of AvailableStrategy)
Get
Return m_CustomerConfigurationList
End Get
Set(value As ObservableCollection(Of AvailableStrategy))
m_CustomerConfigurationList = value
NotifyPropertyChanged(NameOf(CustomerConfigurationList))
End Set
End Property
' Seleziona l'elemento della lista StrategyList
Public m_SelectedStrategy As StrategyConfiguration
Public Property SelectedStrategy As StrategyConfiguration
Get
Return m_SelectedStrategy
End Get
Set(value As StrategyConfiguration)
m_SelectedStrategy = value
m_SelectedStrategyParamList = m_SelectedStrategy
' Controllo se selezionato non è nullo
If Not IsNothing(m_SelectedStrategy) Then
For Each ParamItem As GenericParameter In m_SelectedStrategy.ParameterList
' Controllo se il tipo è un booleano
If ParamItem.sType.Equals("b") Then
' Se si setto SelTypeValue per visualizzare la checkbox
ParamItem.SelTypeValue = 1
' Converto il parametro in un booleano
ParamItem.sValue = If(ParamItem.sValue = "1", "True", "False")
Boolean.Parse(ParamItem.sValue)
ElseIf ParamItem.sType.Equals("combo") Then
' Se si setto SelTypeValue per visualizzare la checkbox
ParamItem.SelTypeValue = 2
End If
Next
End If
NotifyPropertyChanged(NameOf(SelectedStrategy))
NotifyPropertyChanged(NameOf(SelectedStrategyParamList))
End Set
End Property
' Seleziona l'elemento della lista StrategyList
Public m_SelectedStrategyParamList As StrategyConfiguration
Public Property SelectedStrategyParamList As StrategyConfiguration
Get
Return m_SelectedStrategyParamList
End Get
Set(value As StrategyConfiguration)
m_SelectedStrategyParamList = value
NotifyPropertyChanged(NameOf(SelectedStrategyParamList))
End Set
End Property
#Region "SelTreeItem"
' Permette di selezionare l'elemento dell'albero
Public m_SelTreeItem As Topology
Public Property SelTreeItem As Topology
Get
Return m_SelTreeItem
End Get
Set(value As Topology)
m_SelTreeItem = value
NotifyPropertyChanged(NameOf(SelTreeItem))
End Set
End Property
''' <summary>
''' Funzione che aggiorna la selezione dell'elemento dell'albero
''' </summary>
''' <param name="Item">Elemento dell'albero</param>
Friend Sub UpdateSelTreeItem(Item As Topology)
m_SelTreeItem = Item
NotifyPropertyChanged(NameOf(SelTreeItem))
End Sub
#End Region ' SelTreeItem
#Region "ActiveStrategy"
' Lista che contiene le strategie che vengono rese non attive
Private m_DeactivateStrategyList As New ObservableCollection(Of StrategyConfiguration)
Public Property DeactivateStrategyList As ObservableCollection(Of StrategyConfiguration)
Get
Return m_DeactivateStrategyList
End Get
Set(value As ObservableCollection(Of StrategyConfiguration))
m_DeactivateStrategyList = value
NotifyPropertyChanged(NameOf(DeactivateStrategyList))
End Set
End Property
' Lista che contiene le strategie che vengono rese attive
Private m_ActiveStrategyList As New ObservableCollection(Of StrategyConfiguration)
Public Property ActiveStrategyList As ObservableCollection(Of StrategyConfiguration)
Get
Return m_ActiveStrategyList
End Get
Set(value As ObservableCollection(Of StrategyConfiguration))
m_ActiveStrategyList = value
NotifyPropertyChanged(NameOf(ActiveStrategyList))
End Set
End Property
' Seleziona l'elemento della lista ActiveStrategyList
Public m_SelectedActiveStrategy As StrategyConfiguration
Public Property SelectedActiveStrategy As StrategyConfiguration
Get
Return m_SelectedActiveStrategy
End Get
Set(value As StrategyConfiguration)
m_SelectedActiveStrategy = value
m_SelectedStrategyParamList = m_SelectedActiveStrategy
NotifyPropertyChanged(NameOf(SelectedActiveStrategy))
NotifyPropertyChanged(NameOf(SelectedStrategyParamList))
End Set
End Property
#End Region ' ActiveStrategy
' Definizione Comandi
Private m_AddSelectedStrategyCommand As ICommand
Private m_RemoveSelectedStrategyCommand As ICommand
#End Region ' Field & Properties
#Region "CONSTRUCTOR"
Sub New()
' Setto riferimento
Map.SetRefStrategyManagerVM(Me)
' Leggo file json strategie
ReadAvailableStrategyJson()
' Aggiorno elemento selezionato dall'albero
Topology.refUpdateSelTreeItem = AddressOf UpdateSelTreeItem
End Sub
#End Region ' Constructor
#Region "METHODS"
''' <summary>
''' Funzione che legge il file json AVAILABLESTRATEGYLIST
''' </summary>
Private Sub ReadAvailableStrategyJson()
' Recupero file AvailableStrategyPathJson
Dim AvailableStrategyPath As String = Map.refMainWindowVM.MainWindowM.GetStrategiesDirPath() & "\" & AVAILABLESTRATEGYLIST_FILE & ".json"
' Controllo se il file esisite
If File.Exists(AvailableStrategyPath) Then
' Leggo il contenuto del file JSON
Dim AvailableStrategyPathJson As String = File.ReadAllText(AvailableStrategyPath)
' Deserializza il JSON in un oggetto
m_JsonStrategyFeatureList = JsonConvert.DeserializeObject(Of ObservableCollection(Of JsonAvailableStrategy))(AvailableStrategyPathJson)
' Aggiungo file alla lista
m_AvailableStrategyList = New ObservableCollection(Of AvailableStrategy)((From JsonStrategyFeature In JsonStrategyFeatureList
Select New AvailableStrategy(JsonStrategyFeature)).ToList())
' Leggo tutte le strategie presenti nelle feature
For Each AvailableStrategy As AvailableStrategy In m_AvailableStrategyList
For Each TopologyStrategy As Topology In AvailableStrategy.TopologyList
For Each StrategyItem As StrategyConfiguration In TopologyStrategy.StrategyList
ReadConfigurationStrategyJson(StrategyItem)
Next
Next
Next
' Leggo tutte le strategie presenti nelle feature per il file json
For Each JsonStrategyFeature As JsonAvailableStrategy In m_JsonStrategyFeatureList
For Each JsonTopologyStrategy As JsonTopology In JsonStrategyFeature.TopologyList
For Each JsonStrategyItem As JsonStrategyConfiguration In JsonTopologyStrategy.StrategyList
ReadConfigurationJsonStrategyJson(JsonStrategyItem)
Next
Next
Next
End If
' Carico CustomConfigJson
' Recupero percorso file json CustomConfigJson
Dim sAISetupDirPath As String = Map.refMainWindowVM.MainWindowM.GetAISetupDirPath()
' Recupero file json CustomConfigJson
Dim sCustomerConfigurationFilePath As String = sAISetupDirPath & "\" & CUSTOMERCONFIG_FILE & ".json"
' Controllo se esiste
If File.Exists(sCustomerConfigurationFilePath) Then
' Leggo il file json
Dim sReadedFile As String = File.ReadAllText(sCustomerConfigurationFilePath)
' Deserializza il JSON in un oggetto
m_CustomerConfigurationList = JsonConvert.DeserializeObject(Of ObservableCollection(Of AvailableStrategy))(sReadedFile)
' Controllo se le due liste sono uguali
If m_AvailableStrategyList.Select(Function(x) x.sName).SequenceEqual(m_CustomerConfigurationList.Select(Function(x) x.sName)) Then
'MessageBox.Show("OK")
Else
' Devo aggiornare la lista
End If
' Aggiorno la lista
m_AvailableStrategyList = m_CustomerConfigurationList
End If
NotifyPropertyChanged(NameOf(AvailableStrategyList))
End Sub
''' <summary>
''' Funzione che legge il file json delle strategie
''' </summary>
''' <param name="SelectedStrategyItem">Item delle singole feature</param>
Private Sub ReadConfigurationStrategyJson(SelectedStrategyItem As StrategyConfiguration)
' Recupero file StrategyJson
Dim StrategyPath As String = Map.refMainWindowVM.MainWindowM.GetStandardDirPath() & "\" & SelectedStrategyItem.sStrategyID & "\" & SelectedStrategyItem.sStrategyID & ".json"
' Controllo se il file esiste
If File.Exists(StrategyPath) Then
' Leggo il contenuto del file JSON
Dim StrategyJson As String = File.ReadAllText(StrategyPath)
' Deserializza il JSON in un oggetto
Dim strategyConfig As JsonStrategyConfiguration = JsonConvert.DeserializeObject(Of JsonStrategyConfiguration)(StrategyJson)
' Assegno ParamList per poter visualizzarla da interfaccia
SelectedStrategyItem.ParameterList = New ObservableCollection(Of GenericParameter)((From Parameter In strategyConfig.ParameterList
Select New GenericParameter(Parameter)).ToList())
End If
End Sub
Private Sub ReadConfigurationJsonStrategyJson(SelectedStrategyItem As JsonStrategyConfiguration)
' Recupero file StrategyJson
Dim StrategyPath As String = Map.refMainWindowVM.MainWindowM.GetStandardDirPath() & "\" & SelectedStrategyItem.sStrategyID & "\" & SelectedStrategyItem.sStrategyID & ".json"
' Controllo se il file esiste
If File.Exists(StrategyPath) Then
' Leggo il contenuto del file JSON
Dim StrategyJson As String = File.ReadAllText(StrategyPath)
' Deserializza il JSON in un oggetto
Dim strategyConfig As JsonStrategyConfiguration = JsonConvert.DeserializeObject(Of JsonStrategyConfiguration)(StrategyJson)
' Assegno ParamList per poter visualizzarla da interfaccia
SelectedStrategyItem.ParameterList = strategyConfig.ParameterList
End If
End Sub
''' <summary>
''' Funzione per creare file json
''' </summary>
Friend Sub CreateCustumerConfigJsonFile()
m_JsonStrategyFeatureList = New ObservableCollection(Of JsonAvailableStrategy)(m_AvailableStrategyList.Select(Function(x) ConvertToJsonStrategy(x)))
' Serializzazione in JSON
Dim AvailableStrategyListjsonFile As String = JsonConvert.SerializeObject(m_JsonStrategyFeatureList, Formatting.Indented)
' Scrittura su file
File.WriteAllText(Map.refMainWindowVM.MainWindowM.GetAISetupDirPath() & "\" & CUSTOMERCONFIG_FILE & ".json", AvailableStrategyListjsonFile)
End Sub
''' <summary>
''' Funzione per convertire da AvailableStrategy a JsonAvailableStrategy
''' </summary>
''' <param name="availableStrategy"></param>
''' <returns></returns>
Public Function ConvertToJsonStrategy(availableStrategy As AvailableStrategy) As JsonAvailableStrategy
Return New JsonAvailableStrategy With {
.sName = availableStrategy.sName,
.nPRC = availableStrategy.nPRC,
.nGRP = availableStrategy.nGRP,
.TopologyList = New ObservableCollection(Of JsonTopology)(availableStrategy.TopologyList.Select(Function(x) ConvertToJsonTopology(x)))}
End Function
''' <summary>
''' Funzione per convertire da Topology a JsonTopology
''' </summary>
''' <param name="topology"></param>
''' <returns></returns>
Public Function ConvertToJsonTopology(topology As Topology) As JsonTopology
Return New JsonTopology With {
.sName = topology.sName,
.StrategyList = New ObservableCollection(Of JsonStrategyConfiguration)(topology.StrategyList.Select(Function(x) ConvertToJsonStrategyConfiguration(x)))
}
End Function
''' <summary>
''' Funzione per convertire da StrategyConfiguration a JsonStrategyConfiguration
''' </summary>
''' <param name="strategyConfiguration"></param>
''' <returns></returns>
Public Function ConvertToJsonStrategyConfiguration(strategyConfiguration As StrategyConfiguration) As JsonStrategyConfiguration
Return New JsonStrategyConfiguration With {
.sStrategyID = strategyConfiguration.sStrategyID,
.nIndexInList = strategyConfiguration.nIndexInList,
.bActive = strategyConfiguration.bActive,
.ParameterList = New ObservableCollection(Of JsonGenericParameter)(strategyConfiguration.ParameterList.Select(Function(x) ConvertToJsonParameter(x)))}
End Function
''' <summary>
''' Funzione per convertire da GenericParameter a JsonGenericParameter
''' </summary>
''' <param name="genericParameter"></param>
''' <returns></returns>
Public Function ConvertToJsonParameter(genericParameter As GenericParameter) As JsonGenericParameter
Return New JsonGenericParameter With {
.sName = genericParameter.sName,
.sNameNge = genericParameter.sNameNge,
.sValue = genericParameter.sValue,
.sDescriptionShort = genericParameter.sDescriptionShort,
.sDescriptionLong = genericParameter.sDescriptionLong,
.sType = genericParameter.sType,
.sMessageId = genericParameter.sMessageId,
.sMinUserLevel = genericParameter.sMinUserLevel}
End Function
#End Region ' Methods
#Region "COMMANDS"
#Region "AddSelectedStrategyCommand"
Public ReadOnly Property AddSelectedStrategyCommand As ICommand
Get
If m_AddSelectedStrategyCommand Is Nothing Then
m_AddSelectedStrategyCommand = New Command(AddressOf AddSelectedStrategyToActiveStrategy)
End If
Return m_AddSelectedStrategyCommand
End Get
End Property
''' <summary>
''' Funzione che permette di aggiungere la strategia da StrategyList a ActiveStrategyList
''' </summary>
Public Sub AddSelectedStrategyToActiveStrategy()
' Controllo se SelectedStrategy non è nullo
If Not IsNothing(m_SelectedStrategy) Then
' Aggiungo a ActiveStrategyList strategia selezionata
m_ActiveStrategyList.Add(m_SelectedStrategy)
' Setto indice per capire che la strategia è stata spostata in ActiveStrategyList
m_SelectedStrategy.SetIndexList(m_ActiveStrategyList.Count - 1)
' Rimuovo da StrategyList la strategia precedentemente selezionata
m_DeactivateStrategyList.Remove(m_SelectedStrategy)
NotifyPropertyChanged(NameOf(SelectedStrategy))
NotifyPropertyChanged(NameOf(ActiveStrategyList))
NotifyPropertyChanged(NameOf(DeactivateStrategyList))
End If
End Sub
#End Region ' AddSelectedStrategyCommand
#Region "RemoveSelectedStrategyCommand"
Public ReadOnly Property RemoveSelectedStrategyCommand As ICommand
Get
If m_RemoveSelectedStrategyCommand Is Nothing Then
m_RemoveSelectedStrategyCommand = New Command(AddressOf RemoveSelectedStrategyToActiveStrategy)
End If
Return m_RemoveSelectedStrategyCommand
End Get
End Property
''' <summary>
''' Funzione che rimuove la strategia da ActiveStrategyList e la riaggiunge a StrategyList
''' </summary>
Public Sub RemoveSelectedStrategyToActiveStrategy()
' Controllo se SelectedActiveStrategy non è nullo
If Not IsNothing(m_SelectedActiveStrategy) Then
' Aggiungo a ActiveStrategyList strategia selezionata
m_DeactivateStrategyList.Add(m_SelectedActiveStrategy)
' Setto indice per capire che la strategia è stata spostata in StrategyList
m_SelectedActiveStrategy.SetIndexList(-1)
' Rimuovo da StrategyList la strategia precedentemente selezionata
m_ActiveStrategyList.Remove(m_SelectedActiveStrategy)
NotifyPropertyChanged(NameOf(SelectedActiveStrategy))
NotifyPropertyChanged(NameOf(ActiveStrategyList))
NotifyPropertyChanged(NameOf(DeactivateStrategyList))
End If
End Sub
#End Region ' RemoveSelectedStrategyCommand
#End Region ' Commands
End Class
'----------- Classe che fa riferimento alle Feature -----------
Public Class AvailableStrategy
Inherits VMBase
#Region "FIELDS & PROPETIES"
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
NotifyPropertyChanged(NameOf(sName))
End Set
End Property
Private m_nPRC As Integer
Public Property nPRC As Integer
Get
Return m_nPRC
End Get
Set(value As Integer)
m_nPRC = value
NotifyPropertyChanged(NameOf(nPRC))
End Set
End Property
Private m_nGRP As Integer
Public Property nGRP As Integer
Get
Return m_nGRP
End Get
Set(value As Integer)
m_nGRP = value
NotifyPropertyChanged(NameOf(nGRP))
End Set
End Property
Private m_TopologyList As New ObservableCollection(Of Topology)
Public Property TopologyList As ObservableCollection(Of Topology)
Get
Return m_TopologyList
End Get
Set(value As ObservableCollection(Of Topology))
m_TopologyList = value
NotifyPropertyChanged(NameOf(TopologyList))
End Set
End Property
#End Region ' Fields & Propeties
#Region "CONSTRUCTOR"
Sub New(JsonAvailableStrategy As JsonAvailableStrategy)
If Not IsNothing(JsonAvailableStrategy) Then
m_sName = JsonAvailableStrategy.sName
m_nPRC = JsonAvailableStrategy.nPRC
m_nGRP = JsonAvailableStrategy.nGRP
m_TopologyList = New ObservableCollection(Of Topology)((From JsonTopology In JsonAvailableStrategy.TopologyList
Select New Topology(JsonTopology)).ToList())
End If
NotifyPropertyChanged(NameOf(TopologyList))
End Sub
#End Region ' Constructor
End Class
'----------- Classe che fa riferimento alle Topologie delle Feature -----------
Public Class Topology
Inherits VMBase
#Region "FIELDS & PROPETIES"
Friend Shared refUpdateSelTreeItem As Action(Of Topology)
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
NotifyPropertyChanged(NameOf(sName))
End Set
End Property
Private m_bIsSelected As Boolean
<JsonIgnore> ' Inserito per evitare di scriverlo nella creazione del file json CustomerConfig
Public Property IsSelected As Boolean
Get
Return m_bIsSelected
End Get
Set(value As Boolean)
Map.refStrategyManagerVM.ActiveStrategyList.Clear()
Map.refStrategyManagerVM.DeactivateStrategyList.Clear()
m_bIsSelected = value
refUpdateSelTreeItem(Me)
For Each ItemStrategy As StrategyConfiguration In Me.StrategyList
If ItemStrategy.bActive Then
Map.refStrategyManagerVM.ActiveStrategyList.Add(ItemStrategy)
Else
Map.refStrategyManagerVM.DeactivateStrategyList.Add(ItemStrategy)
End If
Next
NotifyPropertyChanged(NameOf(IsSelected))
End Set
End Property
' Seleziona l'elemento della lista StrategyList
Public m_SelectedStrategy As StrategyConfiguration
Public Property SelectedStrategy As StrategyConfiguration
Get
Return m_SelectedStrategy
End Get
Set(value As StrategyConfiguration)
m_SelectedStrategy = value
NotifyPropertyChanged(NameOf(SelectedStrategy))
End Set
End Property
Private m_StrategyList As New ObservableCollection(Of StrategyConfiguration)
Public Property StrategyList As ObservableCollection(Of StrategyConfiguration)
Get
Return m_StrategyList
End Get
Set(value As ObservableCollection(Of StrategyConfiguration))
m_StrategyList = value
NotifyPropertyChanged(NameOf(StrategyList))
End Set
End Property
#End Region ' Fields & Propeties
#Region "CONSTRUCTOR"
Sub New(JsonTopology As JsonTopology)
If Not IsNothing(JsonTopology) Then
m_sName = JsonTopology.sName
m_StrategyList = New ObservableCollection(Of StrategyConfiguration)((From JsonStrategy In JsonTopology.StrategyList
Select New StrategyConfiguration(Me, JsonStrategy)).ToList())
End If
NotifyPropertyChanged(NameOf(StrategyList))
End Sub
#End Region ' Constructor
End Class
'----------- Classe che fa alle Strategie delle Topologie delle Feature -----------
Public Class StrategyConfiguration
Inherits VMBase
#Region "FIELDS & PROPETIES"
Private m_ParentTopology As Topology
Private m_sStrategyID As String
Public Property sStrategyID As String
Get
Return m_sStrategyID
End Get
Set(value As String)
m_sStrategyID = value
NotifyPropertyChanged(NameOf(sStrategyID))
End Set
End Property
Private m_nIndexInList As Integer = -1
Public Property nIndexInList As Integer
Get
Return m_nIndexInList
End Get
Set(value As Integer)
m_nIndexInList = value
NotifyPropertyChanged(NameOf(nIndexInList))
End Set
End Property
Friend Sub SetIndexList(value As Integer)
m_nIndexInList = value
If nIndexInList > -1 Then
m_bActive = True
Else
m_bActive = False
End If
NotifyPropertyChanged(NameOf(nIndexInList))
NotifyPropertyChanged(NameOf(bActive))
End Sub
Private m_bActive As Boolean
Public ReadOnly Property bActive As Boolean
Get
Return m_bActive
End Get
End Property
Private m_ParameterList As New ObservableCollection(Of GenericParameter)
Public Property ParameterList As ObservableCollection(Of GenericParameter)
Get
Return m_ParameterList
End Get
Set(value As ObservableCollection(Of GenericParameter))
m_ParameterList = value
NotifyPropertyChanged(NameOf(ParameterList))
End Set
End Property
#End Region ' Fields & Propeties
#Region "CONSTRUCTOR"
Sub New(ParentTopology As Topology, JsonStrategyConfiguration As JsonStrategyConfiguration)
m_ParentTopology = ParentTopology
If Not IsNothing(JsonStrategyConfiguration) Then
m_sStrategyID = JsonStrategyConfiguration.sStrategyID
m_nIndexInList = JsonStrategyConfiguration.nIndexInList
m_bActive = JsonStrategyConfiguration.bActive
m_ParameterList = New ObservableCollection(Of GenericParameter)((From JsonParameter In JsonStrategyConfiguration.ParameterList
Select New GenericParameter(JsonParameter)).ToList())
End If
NotifyPropertyChanged(NameOf(ParameterList))
End Sub
#End Region ' Constructor
#Region "METHODS"
Friend Sub ReadConfiguration(ConfigurationStrategy As JsonStrategyConfiguration)
m_nIndexInList = ConfigurationStrategy.nIndexInList
NotifyPropertyChanged(NameOf(nIndexInList))
End Sub
#End Region ' Methods
End Class
'----------- Classe che fa riferimento ai parametri delle Strategie -----------
Public Class GenericParameter
Inherits VMBase
#Region "FIELDS & PROPETIES"
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
NotifyPropertyChanged(NameOf(sName))
End Set
End Property
Private m_sNameNge As String
Public Property sNameNge As String
Get
Return m_sNameNge
End Get
Set(value As String)
m_sNameNge = value
NotifyPropertyChanged(NameOf(sNameNge))
End Set
End Property
Private m_sValue As String
Public Property sValue As String
Get
Return m_sValue
End Get
Set(value As String)
m_sValue = value
NotifyPropertyChanged(NameOf(sValue))
End Set
End Property
Private m_sDescriptionShort As String
Public Property sDescriptionShort As String
Get
Return m_sDescriptionShort
End Get
Set(value As String)
m_sDescriptionShort = value
NotifyPropertyChanged(NameOf(sDescriptionShort))
End Set
End Property
Private m_sDescriptionLong As String
Public Property sDescriptionLong As String
Get
Return m_sDescriptionLong
End Get
Set(value As String)
m_sDescriptionLong = value
NotifyPropertyChanged(NameOf(sDescriptionLong))
End Set
End Property
Private m_sType As String
Public Property sType As String
Get
Return m_sType
End Get
Set(value As String)
m_sType = value
NotifyPropertyChanged(NameOf(sType))
End Set
End Property
Private m_sMessageId As String
Public Property sMessageId As String
Get
Return m_sMessageId
End Get
Set(value As String)
m_sMessageId = value
NotifyPropertyChanged(NameOf(sMessageId))
End Set
End Property
Private m_sMinUserLevel As Integer
Public Property sMinUserLevel As Integer
Get
Return m_sMinUserLevel
End Get
Set(value As Integer)
m_sMinUserLevel = value
NotifyPropertyChanged(NameOf(sMinUserLevel))
End Set
End Property
Private m_Choices As New ObservableCollection(Of ChoiceParameter)
Public Property Choices As ObservableCollection(Of ChoiceParameter)
Get
Return m_Choices
End Get
Set(value As ObservableCollection(Of ChoiceParameter))
m_Choices = value
NotifyPropertyChanged(NameOf(Choices))
End Set
End Property
Friend m_SelTypeValue As Integer = 0
Public Property SelTypeValue As Integer
Get
Return m_SelTypeValue
End Get
Set(value As Integer)
m_SelTypeValue = value
NotifyPropertyChanged(NameOf(SelTypeValue))
End Set
End Property
#End Region ' Fields & Propeties
#Region "CONSTRUCTOR"
Sub New(JsonGenericParameter As JsonGenericParameter)
If Not IsNothing(JsonGenericParameter) Then
m_sName = JsonGenericParameter.sName
m_sNameNge = JsonGenericParameter.sNameNge
m_sValue = JsonGenericParameter.sValue
m_sDescriptionShort = JsonGenericParameter.sDescriptionShort
m_sDescriptionLong = JsonGenericParameter.sDescriptionLong
m_sType = JsonGenericParameter.sType
m_sMessageId = JsonGenericParameter.sMessageId
m_sMinUserLevel = JsonGenericParameter.sMinUserLevel
m_Choices = New ObservableCollection(Of ChoiceParameter)((From JsonChoice In JsonGenericParameter.Choices
Select New ChoiceParameter(JsonChoice)).ToList())
End If
NotifyPropertyChanged(NameOf(Choices))
End Sub
#End Region ' Constructor
End Class
'----------- Classe che fa riferimento ai parametri delle Scelte -----------
Public Class ChoiceParameter
Inherits VMBase
#Region "FIELD & PROPERTIES"
Private m_sValue As String
Public Property sValue As String
Get
Return m_sValue
End Get
Set(value As String)
m_sValue = value
NotifyPropertyChanged(NameOf(sValue))
End Set
End Property
Private m_sDescriptionShort As String
Public Property sDescriptionShort As String
Get
Return m_sDescriptionShort
End Get
Set(value As String)
m_sDescriptionShort = value
NotifyPropertyChanged(NameOf(sDescriptionShort))
End Set
End Property
Private m_sDescriptionLong As String
Public Property sDescriptionLong As String
Get
Return m_sDescriptionLong
End Get
Set(value As String)
m_sDescriptionLong = value
NotifyPropertyChanged(NameOf(sDescriptionLong))
End Set
End Property
Private m_sMessageId As String
Public Property sMessageId As String
Get
Return m_sMessageId
End Get
Set(value As String)
m_sMessageId = value
NotifyPropertyChanged(NameOf(sMessageId))
End Set
End Property
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Sub New(JsonChoiceParameter As JsonChoiceParameter)
m_sValue = JsonChoiceParameter.sValue
m_sDescriptionShort = JsonChoiceParameter.sDescriptionShort
m_sDescriptionLong = JsonChoiceParameter.sDescriptionLong
m_sMessageId = JsonChoiceParameter.sMessageId
End Sub
#End Region ' Constructor
End Class
'----------- Classe che fa riferimento alle Feature del file Json -----------
Public Class JsonAvailableStrategy
Inherits VMBase
#Region "FIELDS & PROPETIES"
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
NotifyPropertyChanged(NameOf(sName))
End Set
End Property
Private m_nPRC As Integer
Public Property nPRC As Integer
Get
Return m_nPRC
End Get
Set(value As Integer)
m_nPRC = value
NotifyPropertyChanged(NameOf(nPRC))
End Set
End Property
Private m_nGRP As Integer
Public Property nGRP As Integer
Get
Return m_nGRP
End Get
Set(value As Integer)
m_nGRP = value
NotifyPropertyChanged(NameOf(nGRP))
End Set
End Property
Private m_TopologyList As New ObservableCollection(Of JsonTopology)
Public Property TopologyList As ObservableCollection(Of JsonTopology)
Get
Return m_TopologyList
End Get
Set(value As ObservableCollection(Of JsonTopology))
m_TopologyList = value
NotifyPropertyChanged(NameOf(TopologyList))
End Set
End Property
#End Region ' Fields & Propeties
End Class
'----------- Classe che fa riferimento alle Topologie delle Feature del file Json -----------
Public Class JsonTopology
Inherits VMBase
#Region "FIELDS & PROPETIES"
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
NotifyPropertyChanged(NameOf(sName))
End Set
End Property
Private m_StrategyList As New ObservableCollection(Of JsonStrategyConfiguration)
Public Property StrategyList As ObservableCollection(Of JsonStrategyConfiguration)
Get
Return m_StrategyList
End Get
Set(value As ObservableCollection(Of JsonStrategyConfiguration))
m_StrategyList = value
NotifyPropertyChanged(NameOf(StrategyList))
End Set
End Property
#End Region ' Fields & Propeties
End Class
'----------- Classe che fa alle Strategie delle Topologie delle Feature del file Json -----------
Public Class JsonStrategyConfiguration
Inherits VMBase
#Region "FIELDS & PROPETIES"
Private m_sStrategyID As String
Public Property sStrategyID As String
Get
Return m_sStrategyID
End Get
Set(value As String)
m_sStrategyID = value
NotifyPropertyChanged(NameOf(sStrategyID))
End Set
End Property
Private m_nIndexInList As Integer = -1
Public Property nIndexInList As Integer
Get
Return m_nIndexInList
End Get
Set(value As Integer)
m_nIndexInList = value
NotifyPropertyChanged(NameOf(nIndexInList))
End Set
End Property
Private m_bActive As Boolean
Public Property bActive As Boolean
Get
Return m_bActive
End Get
Set(value As Boolean)
m_bActive = value
NotifyPropertyChanged(NameOf(bActive))
End Set
End Property
Private m_ParameterList As New ObservableCollection(Of JsonGenericParameter)
Public Property ParameterList As ObservableCollection(Of JsonGenericParameter)
Get
Return m_ParameterList
End Get
Set(value As ObservableCollection(Of JsonGenericParameter))
m_ParameterList = value
NotifyPropertyChanged(NameOf(ParameterList))
End Set
End Property
#End Region ' Fields & Propeties
End Class
'----------- Classe che fa riferimento ai parametri delle Strategie nel file Json -----------
Public Class JsonGenericParameter
Inherits VMBase
#Region "FIELDS & PROPETIES"
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
NotifyPropertyChanged(NameOf(sName))
End Set
End Property
Private m_sNameNge As String
Public Property sNameNge As String
Get
Return m_sNameNge
End Get
Set(value As String)
m_sNameNge = value
NotifyPropertyChanged(NameOf(sNameNge))
End Set
End Property
Private m_sValue As String
Public Property sValue As String
Get
Return m_sValue
End Get
Set(value As String)
m_sValue = value
NotifyPropertyChanged(NameOf(sValue))
End Set
End Property
Private m_sDescriptionShort As String
Public Property sDescriptionShort As String
Get
Return m_sDescriptionShort
End Get
Set(value As String)
m_sDescriptionShort = value
NotifyPropertyChanged(NameOf(sDescriptionShort))
End Set
End Property
Private m_sDescriptionLong As String
Public Property sDescriptionLong As String
Get
Return m_sDescriptionLong
End Get
Set(value As String)
m_sDescriptionLong = value
NotifyPropertyChanged(NameOf(sDescriptionLong))
End Set
End Property
Private m_sType As String
Public Property sType As String
Get
Return m_sType
End Get
Set(value As String)
m_sType = value
NotifyPropertyChanged(NameOf(sType))
End Set
End Property
Private m_sMessageId As String
Public Property sMessageId As String
Get
Return m_sMessageId
End Get
Set(value As String)
m_sMessageId = value
NotifyPropertyChanged(NameOf(sMessageId))
End Set
End Property
Private m_sMinUserLevel As Integer
Public Property sMinUserLevel As Integer
Get
Return m_sMinUserLevel
End Get
Set(value As Integer)
m_sMinUserLevel = value
NotifyPropertyChanged(NameOf(sMinUserLevel))
End Set
End Property
Private m_Choices As New ObservableCollection(Of JsonChoiceParameter)
Public Property Choices As ObservableCollection(Of JsonChoiceParameter)
Get
Return m_Choices
End Get
Set(value As ObservableCollection(Of JsonChoiceParameter))
m_Choices = value
NotifyPropertyChanged(NameOf(Choices))
End Set
End Property
#End Region ' Fields & Propeties
End Class
'----------- Classe che fa riferimento ai parametri delle Scelte nel file Json -----------
Public Class JsonChoiceParameter
Inherits VMBase
Private m_sValue As String
Public Property sValue As String
Get
Return m_sValue
End Get
Set(value As String)
m_sValue = value
NotifyPropertyChanged(NameOf(sValue))
End Set
End Property
Private m_sDescriptionShort As String
Public Property sDescriptionShort As String
Get
Return m_sDescriptionShort
End Get
Set(value As String)
m_sDescriptionShort = value
NotifyPropertyChanged(NameOf(sDescriptionShort))
End Set
End Property
Private m_sDescriptionLong As String
Public Property sDescriptionLong As String
Get
Return m_sDescriptionLong
End Get
Set(value As String)
m_sDescriptionLong = value
NotifyPropertyChanged(NameOf(sDescriptionLong))
End Set
End Property
Private m_sMessageId As String
Public Property sMessageId As String
Get
Return m_sMessageId
End Get
Set(value As String)
m_sMessageId = value
NotifyPropertyChanged(NameOf(sMessageId))
End Set
End Property
End Class