916 lines
29 KiB
VB.net
916 lines
29 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
|
|
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
|
|
Dim sAISetupDirPath As String = Map.refMainWindowVM.MainWindowM.GetAISetupDirPath()
|
|
Dim sCustomerConfigurationFilePath As String = sAISetupDirPath & "\" & CUSTOMERCONFIG_FILE & ".json"
|
|
If File.Exists(sCustomerConfigurationFilePath) Then
|
|
Dim sReadedFile As String = File.ReadAllText(sCustomerConfigurationFilePath)
|
|
m_CustomerConfigurationList = JsonConvert.DeserializeObject(Of ObservableCollection(Of AvailableStrategy))(sReadedFile)
|
|
End If
|
|
' 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
|
|
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()
|
|
' Serializzazione in JSON
|
|
Dim AvailableStrategyListjsonFile As String = JsonConvert.SerializeObject(m_JsonStrategyFeatureList, Formatting.Indented)
|
|
' Scrittura su file
|
|
File.WriteAllText(Map.refMainWindowVM.MainWindowM.GetAISetupDirPath() & "\" & CUSTOMERCONFIG_FILE & "_1.json", AvailableStrategyListjsonFile)
|
|
End Sub
|
|
|
|
#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
|
|
|
|
#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
|
|
End If
|
|
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
|
|
|
|
#End Region ' Fields & Propeties
|
|
|
|
End Class
|
|
|