diff --git a/EgtBEAMWALL.Optimizer/EgtBEAMWALL.Optimizer.vbproj b/EgtBEAMWALL.Optimizer/EgtBEAMWALL.Optimizer.vbproj
index b5846da8..64ba2ceb 100644
--- a/EgtBEAMWALL.Optimizer/EgtBEAMWALL.Optimizer.vbproj
+++ b/EgtBEAMWALL.Optimizer/EgtBEAMWALL.Optimizer.vbproj
@@ -211,10 +211,16 @@
StatusBarV.xaml
+
+ ParameterStrategyV.xaml
+ StrategyManagerV.xaml
+
+ StrategyV.xaml
+
@@ -675,10 +681,18 @@
MSBuild:CompileDesigner
+
+ Designer
+ MSBuild:Compile
+ DesignerMSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+ MSBuild:CompileDesigner
diff --git a/EgtBEAMWALL.Optimizer/StrategyManager/ParameterStrategyV.xaml b/EgtBEAMWALL.Optimizer/StrategyManager/ParameterStrategyV.xaml
new file mode 100644
index 00000000..f1f2dce6
--- /dev/null
+++ b/EgtBEAMWALL.Optimizer/StrategyManager/ParameterStrategyV.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.Optimizer/StrategyManager/ParameterStrategyV.xaml.vb b/EgtBEAMWALL.Optimizer/StrategyManager/ParameterStrategyV.xaml.vb
new file mode 100644
index 00000000..30b99966
--- /dev/null
+++ b/EgtBEAMWALL.Optimizer/StrategyManager/ParameterStrategyV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class ParameterStrategyV
+
+End Class
diff --git a/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerV.xaml b/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerV.xaml
index 401c3d27..21a10178 100644
--- a/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerV.xaml
+++ b/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerV.xaml
@@ -37,74 +37,12 @@
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ Width="900"/>
diff --git a/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerVM.vb b/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerVM.vb
index 24512a76..d1169994 100644
--- a/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerVM.vb
+++ b/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerVM.vb
@@ -9,6 +9,18 @@ Public Class StrategyManagerVM
#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)
@@ -21,6 +33,18 @@ Public Class StrategyManagerVM
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
@@ -29,7 +53,21 @@ Public Class StrategyManagerVM
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
@@ -59,7 +97,7 @@ Public Class StrategyManagerVM
#Region "ActiveStrategy"
- ' Lista che contiene le strategie che vengono rese attive
+ ' 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
@@ -91,7 +129,9 @@ Public Class StrategyManagerVM
End Get
Set(value As StrategyConfiguration)
m_SelectedActiveStrategy = value
+ m_SelectedStrategyParamList = m_SelectedActiveStrategy
NotifyPropertyChanged(NameOf(SelectedActiveStrategy))
+ NotifyPropertyChanged(NameOf(SelectedStrategyParamList))
End Set
End Property
@@ -129,7 +169,10 @@ Public Class StrategyManagerVM
' Leggo il contenuto del file JSON
Dim AvailableStrategyPathJson As String = File.ReadAllText(AvailableStrategyPath)
' Deserializza il JSON in un oggetto
- m_AvailableStrategyList = JsonConvert.DeserializeObject(Of ObservableCollection(Of AvailableStrategy))(AvailableStrategyPathJson)
+ 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
@@ -138,7 +181,31 @@ Public Class StrategyManagerVM
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
'''
@@ -153,17 +220,36 @@ Public Class StrategyManagerVM
' Leggo il contenuto del file JSON
Dim StrategyJson As String = File.ReadAllText(StrategyPath)
' Deserializza il JSON in un oggetto
- Dim strategyConfig As StrategyConfiguration = JsonConvert.DeserializeObject(Of StrategyConfiguration)(StrategyJson)
+ 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
+
+ '''
+ ''' Funzione per creare file json
+ '''
Friend Sub CreateCustumerConfigJsonFile()
' Serializzazione in JSON
- Dim AvailableStrategyListjsonFile As String = JsonConvert.SerializeObject(m_AvailableStrategyList, Formatting.Indented)
+ Dim AvailableStrategyListjsonFile As String = JsonConvert.SerializeObject(m_JsonStrategyFeatureList, Formatting.Indented)
' Scrittura su file
- File.WriteAllText(Map.refMainWindowVM.MainWindowM.GetAISetupDirPath() & "\" & CUSTOMERCONFIG_FILE & ".json", AvailableStrategyListjsonFile)
+ File.WriteAllText(Map.refMainWindowVM.MainWindowM.GetAISetupDirPath() & "\" & CUSTOMERCONFIG_FILE & "_1.json", AvailableStrategyListjsonFile)
End Sub
#End Region ' Methods
@@ -288,6 +374,21 @@ Public Class AvailableStrategy
#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 -----------
@@ -356,6 +457,19 @@ Public Class Topology
#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 -----------
@@ -364,6 +478,8 @@ Public Class StrategyConfiguration
#Region "FIELDS & PROPETIES"
+ Private m_ParentTopology As Topology
+
Private m_sStrategyID As String
Public Property sStrategyID As String
Get
@@ -416,6 +532,32 @@ Public Class StrategyConfiguration
#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 -----------
@@ -514,4 +656,260 @@ Public Class GenericParameter
#End Region ' Fields & Propeties
-End Class
\ No newline at end of file
+#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
+
diff --git a/EgtBEAMWALL.Optimizer/StrategyManager/StrategyV.xaml b/EgtBEAMWALL.Optimizer/StrategyManager/StrategyV.xaml
new file mode 100644
index 00000000..970ae9b5
--- /dev/null
+++ b/EgtBEAMWALL.Optimizer/StrategyManager/StrategyV.xaml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EgtBEAMWALL.Optimizer/StrategyManager/StrategyV.xaml.vb b/EgtBEAMWALL.Optimizer/StrategyManager/StrategyV.xaml.vb
new file mode 100644
index 00000000..7d817eb8
--- /dev/null
+++ b/EgtBEAMWALL.Optimizer/StrategyManager/StrategyV.xaml.vb
@@ -0,0 +1,26 @@
+Public Class StrategyV
+
+ '''
+ ''' Funzione che permette di riselezionare l'elemento DeactivateStrategyList della lista già selezionato
+ '''
+ '''
+ '''
+ Private Sub DeactivateStrategyList_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
+ Dim item As Object = DeactivateStrategyListBox.SelectedItem
+ DeactivateStrategyListBox.SelectedItem = Nothing
+ DeactivateStrategyListBox.SelectedItem = item
+ End Sub
+
+
+ '''
+ ''' Funzione che permette di riselezionare l'elemento ActiveStrategyList della lista già selezionato
+ '''
+ '''
+ '''
+ Private Sub ActiveStrategyList_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
+ Dim item As Object = ActiveStrategyListBox.SelectedItem
+ ActiveStrategyListBox.SelectedItem = Nothing
+ ActiveStrategyListBox.SelectedItem = item
+ End Sub
+
+End Class