-aggiunta parametri generali da terminare

This commit is contained in:
Demetrio Cassarino
2025-10-09 09:17:09 +02:00
parent 9c2e02943a
commit 579c57083f
34 changed files with 2019 additions and 52 deletions
+2 -1
View File
@@ -106,5 +106,6 @@ Public Module ConstGen
Public Const AVAILABLESTRATEGYLIST_FILE As String = "AvailableStrategyList"
' File contente tutte le feature
Public Const CUSTOMERCONFIG_FILE As String = "CustomerConfig"
' File contenente i parametri generali
Public Const GENERALPARAMETERS_FILE As String = "GeneralParameters"
End Module
@@ -15,12 +15,19 @@
<TabControl>
<TabItem Header="Strategy">
<ComboBox ItemsSource="{Binding StrategySetupList}"
SelectedItem="{Binding SelStrategySetup, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource Strategy_ComboBox}"/>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<ComboBox ItemsSource="{Binding StrategySetupList}"
SelectedItem="{Binding SelStrategySetup, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource Strategy_ComboBox}" Margin="0,10,0,0"/>
<EgtBEAMWALL:ProjectParametersV Grid.Row="1" Margin="0,10,0,0"
Tag="{Binding GeneralParametersList}"/>
</Grid>
</TabItem>
<TabItem Header="BTL">
<UniformGrid Margin="5"
Columns="6" Rows="7">
@@ -41,6 +41,12 @@ Public Class BTLDataWndVM
End Get
End Property
Public ReadOnly Property GeneralParametersList As ObservableCollection(Of ProjectParameters)
Get
Return Map.refOnlyProdManagerVM.GeneralParametersStrategyVM.GeneralParametersList
End Get
End Property
#Region "Parametri generici"
Public m_sPROJNUM As String
@@ -551,6 +557,7 @@ Public Class BTLDataWndVM
If GetMainPrivateProfileString(S_STRATEGY, K_DEFAULTCONFIG, "", sDefaultConfigFile) <> 0 Then
sTrimDefaultConfig = System.IO.Path.GetFileNameWithoutExtension(sDefaultConfigFile)
m_SelStrategySetup = sTrimDefaultConfig
EgtSetInfo(m_nBTLInfoLayerId, "AISETUP", m_SelStrategySetup)
End If
End Sub
@@ -1,7 +1,8 @@
Imports EgtWPFLib5
Imports EgtUILib
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class BTLPartManagerVM
Inherits VMBase
@@ -10,37 +10,37 @@
<StackPanel Orientation="Horizontal"
Style="{StaticResource OnlyProdBTLPartManager_StackPanel}">
<Button Command="{Binding CopyPart_Command}"
Click="ClosePopUp_Click"
ToolTip="{Binding CopyPart_ToolTip}"
IsEnabled="{Binding CopyPart_IsEnabled}"
Click="ClosePopUp_Click"
Style="{StaticResource OnlyProdLeftPanel_Button}">
<Image Source="/Resources/LeftPanel/CopyPart.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding RemovePart_Command}"
Click="ClosePopUp_Click"
ToolTip="{Binding RemovePart_ToolTip}"
IsEnabled="{Binding RemovePart_IsEnabled}"
Click="ClosePopUp_Click"
Style="{StaticResource OnlyProdLeftPanel_Button}">
<Image Source="/Resources/NewPage/Remove.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="{Binding Simulate_ToolTip}"
Click="ClosePopUp_Click"
Command="{Binding Simulate_Command}"
IsEnabled="{Binding Simulate_IsEnabled}"
Click="ClosePopUp_Click"
Style="{StaticResource OnlyProdLeftPanel_Button}">
<Image Source="/Resources/CALCPanel/Simulate.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="{Binding Edit_ToolTip}"
Click="ClosePopUp_Click"
Command="{Binding Edit_Command}"
IsEnabled="{Binding Edit_IsEnabled}"
Click="ClosePopUp_Click"
Style="{StaticResource OnlyProdLeftPanel_Button}">
<Image Source="/Resources/CALCPanel/Edit.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding ResetCalc_Command}"
Click="ClosePopUp_Click"
ToolTip="{Binding ResetCalc_ToolTip}"
IsEnabled="{Binding CALCPanel_IsEnabled}"
Click="ClosePopUp_Click"
Style="{StaticResource OnlyProdLeftPanel_Button}">
<Image Source="/Resources/CALCPanel/ResetCalc.png" Stretch="Uniform"/>
</Button>
@@ -2,7 +2,8 @@
Private Sub ClosePopUp_Click(sender As Object, e As RoutedEventArgs)
Dim Button As Button = DirectCast(sender, Button)
Dim OnlyProdBTLPartManagerV As OnlyProdBTLPartManagerV = DirectCast(Button.Parent, OnlyProdBTLPartManagerV)
Dim StackPanel As StackPanel = DirectCast(Button.Parent, StackPanel)
Dim OnlyProdBTLPartManagerV As OnlyProdBTLPartManagerV = DirectCast(StackPanel.Parent, OnlyProdBTLPartManagerV)
Dim Popup As Primitives.Popup = DirectCast(OnlyProdBTLPartManagerV.Parent, Primitives.Popup)
If Not IsNothing(Popup) Then
@@ -151,6 +151,17 @@
<DependentUpon>ForcedStrategyPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="ForcedStrategyPanel\ForcedStrategyPanelVM.vb" />
<Compile Include="GeneralParametersStrategy\GeneralParametersStrategyV.xaml.vb">
<DependentUpon>GeneralParametersStrategyV.xaml</DependentUpon>
</Compile>
<Compile Include="GeneralParametersStrategy\GeneralParametersStrategyVM.vb" />
<Compile Include="GeneralParametersStrategy\JsonGeneralParameters.vb" />
<Compile Include="GeneralParametersStrategy\JsonGenericParametersHelper.vb" />
<Compile Include="GeneralParametersStrategy\JsonParameters.vb" />
<Compile Include="GeneralParametersStrategy\JsonParametersHelper.vb" />
<Compile Include="GeneralParametersStrategy\ProjectParametersV.xaml.vb">
<DependentUpon>ProjectParametersV.xaml</DependentUpon>
</Compile>
<Compile Include="MachinePanel\OnlyProdMachinePanelV.xaml.vb">
<DependentUpon>OnlyProdMachinePanelV.xaml</DependentUpon>
</Compile>
@@ -579,6 +590,14 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="GeneralParametersStrategy\GeneralParametersStrategyV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="GeneralParametersStrategy\ProjectParametersV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="InputPwdWnd\OnlyProdInputPwdWndV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -1141,6 +1160,9 @@
<ItemGroup>
<Resource Include="Resources\NewPage\pezzo.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\NewPage\adjustment.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\EgtBEAMWALL.OptimizerR32.exe
@@ -24,6 +24,7 @@ Public Class FeatureListManagerVM
If Not IsNothing(Map.refBTLPartManagerVM) Then
Return Map.refBTLPartManagerVM.BTLPartManager_IsEnabled AndAlso PartIsSelected AndAlso FeatureIsSelected
End If
Return False
End Get
End Property
@@ -32,6 +33,7 @@ Public Class FeatureListManagerVM
If Not IsNothing(Map.refBTLPartManagerVM) Then
Return Map.refBTLPartManagerVM.BTLPartManager_IsEnabled AndAlso PartIsSelected AndAlso FeatureIsSelected
End If
Return False
End Get
End Property
@@ -46,6 +48,7 @@ Public Class FeatureListManagerVM
If Not IsNothing(Map.refBTLPartManagerVM) Then
Return Map.refBTLPartManagerVM.BTLPartManager_IsEnabled AndAlso PartIsSelected AndAlso FeatureIsSelected
End If
Return False
End Get
End Property
@@ -234,8 +234,10 @@ Public Class ForcedStrategyPanelVM
Dim sStrategyConfigurationFilePath As String = sAISetupDirPath & "\" & sStrategySetupName & ".json"
If File.Exists(sStrategyConfigurationFilePath) Then
Dim sReadedFile As String = File.ReadAllText(sStrategyConfigurationFilePath)
Dim JsonStrategyFeatureList As List(Of JsonStrategyFeature) = JsonConvert.DeserializeObject(Of List(Of JsonStrategyFeature))(sReadedFile)
Dim JsonStrategyFeature As JsonStrategyFeature = JsonStrategyFeatureList.FirstOrDefault(Function(x) x.nGRP = nGRP AndAlso x.nPRC = nPRC)
Dim JsonRoot As CustomJsonRoot = JsonConvert.DeserializeObject(Of CustomJsonRoot)(sReadedFile)
'Dim JsonStrategyFeatureList As List(Of JsonStrategyFeature) = JsonConvert.DeserializeObject(Of List(Of JsonStrategyFeature))(sReadedFile)
Dim JsonStrategyFeature As JsonStrategyFeature = JsonRoot.FEATURE.FirstOrDefault(Function(x) x.nGrp = nGRP AndAlso x.nPrc = nPRC)
If IsNothing(JsonStrategyFeature) Then Return False
Dim JsonTopology As JsonTopology = JsonStrategyFeature.TopologyList.FirstOrDefault(Function(x) x.sName = sTopologyName)
If IsNothing(JsonTopology) Then Return False
@@ -0,0 +1,46 @@
<EgtWPFLib5:EgtCustomWindow x:Class="GeneralParametersStrategyV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:Optmizer="clr-namespace:EgtBEAMWALL.Optimizer"
WindowStyle="None" ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterOwner"
IsClosable="False"
IsMinimizable="False"
IsResizable="False"
MinWidth="500"
MinHeight="250"
Height="Auto"
Width="Auto"
TitleBarHeight="30"
Title="GeneralParameters"
Style="{StaticResource OnlyProd_EgtCustomWindow}"
CloseCommand="{Binding Close_Command, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}">
<Grid Margin="0,10,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Optmizer:ProjectParametersV/>
<StackPanel Grid.Row="1"
Orientation="Horizontal"
HorizontalAlignment="Right"
Margin="10">
<Button Command="{Binding Ok_Command}"
ToolTip="{Binding SaveAsToolTip}"
Style="{StaticResource SaveStrategy_Button}">
<Image Source="/Resources/NewPage/Ok.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding CloseCommand}"
ToolTip="{Binding SaveAsToolTip}"
Style="{StaticResource SaveStrategy_Button}">
<Image Source="/Resources/PDFEditor/Delete.png" Stretch="Uniform"/>
</Button>
</StackPanel>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,31 @@
Imports System.Windows.Forms
Public Class GeneralParametersStrategyV
#Region "FIELDS & PROPERTIES"
Private WithEvents m_GeneralParametersStrategyVM As GeneralParametersStrategyVM
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Sub New(Owner As Window, GeneralParametersStrategyVM As GeneralParametersStrategyVM)
' La chiamata è richiesta dalla finestra di progettazione.
InitializeComponent()
Me.DataContext = GeneralParametersStrategyVM
' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent().
m_GeneralParametersStrategyVM = GeneralParametersStrategyVM
End Sub
#End Region ' Constructor
#Region "EVENTS"
Private Sub CloseWindow(DialogResult As DialogResult) Handles m_GeneralParametersStrategyVM.m_CloseWindow
Me.DialogResult = DialogResult
End Sub
#End Region ' Events
End Class
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,203 @@
Imports System.Collections.ObjectModel
Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtWPFLib5
Imports Newtonsoft.Json
Imports EgtUILib
Public Class JsonGeneralParameters
Inherits VMBase
#Region "FIELDS & PROPETIES"
Private m_nGroup As String
Public Property nGroup As String
Get
Return m_nGroup
End Get
Set(value As String)
m_nGroup = value
NotifyPropertyChanged(NameOf(nGroup))
End Set
End Property
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_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_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_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_Choices As New ObservableCollection(Of JsonDefaultComboParameter)
Public Property Choices As ObservableCollection(Of JsonDefaultComboParameter)
Get
Return m_Choices
End Get
Set(value As ObservableCollection(Of JsonDefaultComboParameter))
m_Choices = value
NotifyPropertyChanged(NameOf(Choices))
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"
<JsonConstructor>
Sub New(nGroup As String, sName As String, sNameNge As String, sValue As String, sDescriptionShort As String, sDescriptionLong As String, sType As String, sMinUserLevel As String)
m_nGroup = nGroup
m_sName = sName
m_sNameNge = sNameNge
m_sValue = sValue
m_sDescriptionShort = sDescriptionShort
m_sDescriptionLong = sDescriptionLong
m_sType = sType
m_sMinUserLevel = sMinUserLevel
End Sub
Sub New(ProjectParameters As ProjectParameters)
m_sName = ProjectParameters.sName
m_sNameNge = ProjectParameters.sNameNge
Select Case ProjectParameters.GetType()
Case GetType(BooleanGenericParameter)
m_sValue = If(DirectCast(ProjectParameters, BooleanGenericParameter).bValue, "true", "false")
Case GetType(DoubleGenericParameter)
m_sValue = DirectCast(ProjectParameters, DoubleGenericParameter).sValue
Case GetType(ComboGenericParameter)
m_sValue = DirectCast(ProjectParameters, ComboGenericParameter).SelValue.sValue
Case GetType(StringGenericParameter)
m_sValue = DirectCast(ProjectParameters, StringGenericParameter).sValue
Case GetType(ListGenericParameter)
m_sValue = DirectCast(ProjectParameters, ListGenericParameter).SelValue.sName
End Select
m_nGroup = ProjectParameters.nGroup
m_sDescriptionShort = ProjectParameters.sDescriptionShort
m_sDescriptionLong = ProjectParameters.sDescriptionLong
m_sMinUserLevel = ProjectParameters.sMinUserLevel
End Sub
#End Region ' Constructor
#Region "METHODS"
Friend Function Deserialize(StrategyType As BWType) As ProjectParameters
Dim ProjectParameters As ProjectParameters = Nothing
Select Case m_sType
Case "b"
'ProjectParameters = New BooleanStrategyParameter()
'DirectCast(ProjectParameters, BooleanStrategyParameter).SetValue(m_sValue)
'If m_sMinUserLevel = 1 Then
' DirectCast(ProjectParameters, BooleanStrategyParameter).SetbBooleanVisibility(Visibility.Visible)
'End If
Case "d"
ProjectParameters = New DoubleGenericParameter()
DirectCast(ProjectParameters, DoubleGenericParameter).SetValue(m_sValue)
'If m_sMinUserLevel = 1 Then
' DirectCast(ProjectParameters, DoubleStrategyParameter).SetbDoubleVisibility(Visibility.Visible)
'End If
Case "combo"
ProjectParameters = New ComboGenericParameter()
For Each Choice In Choices
DirectCast(ProjectParameters, ComboGenericParameter).ComboList.Add(Choice.Deserialize())
Next
DirectCast(ProjectParameters, ComboGenericParameter).SetSelValue(m_sValue)
'If m_sMinUserLevel = 1 Then
' DirectCast(ProjectParameters, ComboGenericParameter).SetbComboBoxVisibility(Visibility.Visible)
'End If
Case "tool"
'ProjectParameters = New ListStrategyParameter(m_sSubType)
'DirectCast(ProjectParameters, ListStrategyParameter).CreateToolsViews()
'If m_sMinUserLevel = 1 Then
' DirectCast(ProjectParameters, ListStrategyParameter).SetbListBoxVisibility(Visibility.Visible)
'End If
Case "s"
'ProjectParameters = New StringStrategyParameter()
'DirectCast(ProjectParameters, StringStrategyParameter).SetValue(m_sValue)
'If m_sMinUserLevel = 1 Then
' DirectCast(ProjectParameters, StringStrategyParameter).SetbStringVisibility(Visibility.Visible)
'End If
Case Else
EgtOutLog("Tipo: " & m_sType & " non presente")
Return Nothing
End Select
ProjectParameters.nGroup = m_nGroup
ProjectParameters.sName = m_sName
ProjectParameters.sNameNge = m_sNameNge
ProjectParameters.sDescriptionShort = m_sDescriptionShort
ProjectParameters.sDescriptionLong = m_sDescriptionLong
ProjectParameters.sMinUserLevel = m_sMinUserLevel
Return ProjectParameters
End Function
#End Region ' Methods
End Class
@@ -0,0 +1,202 @@
Imports System.Collections.ObjectModel
Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtWPFLib5
Imports Newtonsoft.Json
Imports EgtUILib
Public Class JsonProjectParameters
Inherits VMBase
#Region "FIELDS & PROPETIES"
Private m_nGroup As String
Public Property nGroup As String
Get
Return m_nGroup
End Get
Set(value As String)
m_nGroup = value
NotifyPropertyChanged(NameOf(nGroup))
End Set
End Property
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_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_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_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_Choices As New ObservableCollection(Of JsonDefaultComboParameter)
Public Property Choices As ObservableCollection(Of JsonDefaultComboParameter)
Get
Return m_Choices
End Get
Set(value As ObservableCollection(Of JsonDefaultComboParameter))
m_Choices = value
NotifyPropertyChanged(NameOf(Choices))
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"
<JsonConstructor>
Sub New(mGroup As String, sName As String, sNameNge As String, sValue As String, sType As String, sDescriptionShort As String, sDescriptionLong As String, sMinUserLevel As String)
m_nGroup = nGroup
m_sName = sName
m_sNameNge = sNameNge
m_sValue = sValue
m_sType = sType
m_sDescriptionShort = sDescriptionShort
m_sDescriptionLong = sDescriptionLong
m_sMinUserLevel = sMinUserLevel
End Sub
Sub New(ProjectParameters As ProjectParameters)
m_sName = ProjectParameters.sName
m_sNameNge = ProjectParameters.sNameNge
Select Case ProjectParameters.GetType()
Case GetType(BooleanGenericParameter)
m_sValue = If(DirectCast(ProjectParameters, BooleanGenericParameter).bValue, "true", "false")
Case GetType(DoubleGenericParameter)
m_sValue = DirectCast(ProjectParameters, DoubleGenericParameter).sValue
Case GetType(ComboGenericParameter)
m_sValue = DirectCast(ProjectParameters, ComboGenericParameter).SelValue.sValue
Case GetType(StringGenericParameter)
m_sValue = DirectCast(ProjectParameters, StringGenericParameter).sValue
Case GetType(ListGenericParameter)
m_sValue = DirectCast(ProjectParameters, ListGenericParameter).SelValue.sName
End Select
m_sDescriptionShort = ProjectParameters.sDescriptionShort
m_sDescriptionLong = ProjectParameters.sDescriptionLong
m_sMinUserLevel = ProjectParameters.sMinUserLevel
End Sub
#End Region ' Constructor
#Region "METHODS"
Friend Function Deserialize(StrategyType As BWType) As ProjectParameters
Dim ProjectParameters As ProjectParameters = Nothing
Select Case m_sType
Case "b"
ProjectParameters = New BooleanGenericParameter()
DirectCast(ProjectParameters, BooleanGenericParameter).SetValue(m_sValue)
If m_sMinUserLevel = 1 Then
DirectCast(ProjectParameters, BooleanGenericParameter).SetbBooleanVisibility(Visibility.Visible)
End If
Case "d"
ProjectParameters = New DoubleGenericParameter()
DirectCast(ProjectParameters, DoubleGenericParameter).SetValue(m_sValue)
If m_sMinUserLevel = 1 Then
DirectCast(ProjectParameters, DoubleGenericParameter).SetbDoubleVisibility(Visibility.Visible)
End If
Case "combo"
ProjectParameters = New ComboGenericParameter()
For Each Choice In Choices
DirectCast(ProjectParameters, ComboGenericParameter).ComboList.Add(Choice.Deserialize())
Next
DirectCast(ProjectParameters, ComboGenericParameter).SetSelValue(m_sValue)
If m_sMinUserLevel = 1 Then
DirectCast(ProjectParameters, ComboGenericParameter).SetbComboBoxVisibility(Visibility.Visible)
End If
Case "tool"
'ProjectParameters = New ListGenericParameter(m_sSubType)
'DirectCast(ProjectParameters, ListGenericParameter).CreateToolsViews()
'If m_sMinUserLevel = 1 Then
' DirectCast(ProjectParameters, ListGenericParameter).SetbListBoxVisibility(Visibility.Visible)
'End If
Case "s"
ProjectParameters = New StringGenericParameter()
DirectCast(ProjectParameters, StringGenericParameter).SetValue(m_sValue)
If m_sMinUserLevel = 1 Then
DirectCast(ProjectParameters, StringGenericParameter).SetbStringVisibility(Visibility.Visible)
End If
Case Else
EgtOutLog("Tipo: " & m_sType & " non presente")
Return Nothing
End Select
ProjectParameters.nGroup = nGroup
ProjectParameters.sName = m_sName
ProjectParameters.sNameNge = m_sNameNge
ProjectParameters.sDescriptionShort = m_sDescriptionShort
ProjectParameters.sDescriptionLong = m_sDescriptionLong
ProjectParameters.sMinUserLevel = m_sMinUserLevel
Return ProjectParameters
End Function
#End Region ' Methods
End Class
@@ -0,0 +1,61 @@
Imports EgtWPFLib5
Imports Newtonsoft.Json
Public Class JsonParameters
Inherits VMBase
#Region "FIELDS & PROPERTIES"
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
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
<JsonConstructor>
Sub New(sName As String, sNameNge As String, sValue As String)
m_sName = sName
m_sNameNge = sNameNge
m_sValue = sValue
End Sub
Sub New(ProjectParameters As ProjectParameters)
m_sName = ProjectParameters.sName
m_sNameNge = ProjectParameters.sNameNge
m_sValue = ProjectParameters.sValue
End Sub
#End Region ' Constructor
End Class
@@ -0,0 +1,97 @@
Imports EgtWPFLib5
Imports Newtonsoft.Json
Public Class JsonParametersHelper
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_sType As String
<JsonIgnore>
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_sMinUserLevel As Integer
<JsonIgnore>
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"
<JsonConstructor>
Sub New(sName As String, sNameNge As String, sValue As String, sType As String)
m_sName = sName
m_sNameNge = sNameNge
m_sValue = sValue
m_sType = sType
End Sub
Sub New(ProjectParameters As ProjectParameters)
m_sName = ProjectParameters.sName
m_sNameNge = ProjectParameters.sNameNge
Select Case ProjectParameters.GetType()
'Case GetType(BooleanStrategyParameter)
' m_sValue = If(DirectCast(ProjectParameters, BooleanStrategyParameter).bValue, "true", "false")
Case GetType(DoubleGenericParameter)
m_sValue = DirectCast(ProjectParameters, DoubleGenericParameter).sValue
Case GetType(ComboGenericParameter)
m_sValue = DirectCast(ProjectParameters, ComboGenericParameter).SelValue.sValue
'Case GetType(StringStrategyParameter)
' m_sValue = DirectCast(ProjectParameters, StringStrategyParameter).sValue
'Case GetType(ListStrategyParameter)
' m_sValue = DirectCast(ProjectParameters, ListStrategyParameter).SelValue.sName
End Select
End Sub
#End Region ' Constructor
End Class
@@ -0,0 +1,85 @@
<UserControl x:Class="ProjectParametersV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Optmizer="clr-namespace:EgtBEAMWALL.Optimizer">
<UserControl.Resources>
<CollectionViewSource x:Key="GroupedParameters" Source="{Binding GeneralParametersList}">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="nGroup"/>
</CollectionViewSource.GroupDescriptions>
</CollectionViewSource>
</UserControl.Resources>
<GroupBox Foreground="Black"
BorderThickness="2"
Margin="0,-11,0,0"
BorderBrush="{StaticResource BeamWall_Glacier}">
<GroupBox.Header>
<TextBlock Text="GENERAL PARAMETERS"
FontWeight="Bold"
Style="{StaticResource DialogWindow_TextBlock}"/>
</GroupBox.Header>
<ItemsControl ItemsSource="{Binding Source={StaticResource GroupedParameters}}"
Foreground="Black"
Margin="5,10,0,0"
Style="{StaticResource UsersControlStyle}">
<ItemsControl.GroupStyle>
<GroupStyle>
<GroupStyle.Panel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</GroupStyle.Panel>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<GroupBox Margin="0,5,0,0"
BorderBrush="{StaticResource BeamWall_Glacier}"
BorderThickness="1"
Foreground="Black">
<GroupBox.Header>
<TextBlock Text="{Binding Name}"
FontWeight="Bold"
Style="{StaticResource DialogWindow_TextBlock}"/>
</GroupBox.Header>
<ItemsPresenter />
</GroupBox>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ItemsControl.GroupStyle>
<ItemsControl.Resources>
<DataTemplate DataType="{x:Type Optmizer:DoubleGenericParameter}">
<UniformGrid Columns="2" Margin="2,2,2,5">
<TextBlock Text="{Binding sDescriptionShort}"
HorizontalAlignment="Left"
TextWrapping="WrapWithOverflow"
Style="{StaticResource DialogWindow_TextBlock}"/>
<TextBox Text="{Binding sValue}"
Style="{StaticResource ColorPicker_TextBox}"/>
</UniformGrid>
</DataTemplate>
<DataTemplate DataType="{x:Type Optmizer:ComboGenericParameter}">
<UniformGrid Columns="2" Margin="2,2,2,5">
<TextBlock Text="{Binding sDescriptionShort}"
HorizontalAlignment="Left"
TextWrapping="WrapWithOverflow"
Style="{StaticResource DialogWindow_TextBlock}"/>
<ComboBox ItemsSource="{Binding ComboList}"
SelectedItem="{Binding SelValue}"
DisplayMemberPath="sValue"
Margin="0"
Foreground="Black"
Style="{StaticResource OnlyProdCalcPanel_ComboBox}">
</ComboBox>
</UniformGrid>
</DataTemplate>
</ItemsControl.Resources>
</ItemsControl>
</GroupBox>
</UserControl>
@@ -0,0 +1,3 @@
Public Class ProjectParametersV
End Class
@@ -39,7 +39,6 @@
RenderOptions.CachingHint="Cache"
VirtualizingPanel.CacheLength="10"
VirtualizingPanel.CacheLengthUnit="Pixel"
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
Style="{StaticResource DataGrid_OnlyProd}">
<DataGrid.InputBindings>
@@ -396,7 +395,6 @@
Grid.IsSharedSizeScope="True"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto"
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type Expander}}}"
Style="{StaticResource BTL_ListBox}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
@@ -68,12 +68,27 @@ Public Class LeftPanelVM
NotifyPropertyChanged(NameOf(RotateAll_IsEnabled))
End Sub
Private m_IsProjectParametersBtnOpen As Boolean = False
Public Property IsProjectParametersBtnOpen As Boolean
Get
Return m_IsProjectParametersBtnOpen
End Get
Set(value As Boolean)
m_IsProjectParametersBtnOpen = value
End Set
End Property
Friend Sub SetIsProjectParametersBtnOpen(bIsProjectParametersBtnOpen As Boolean)
m_IsProjectParametersBtnOpen = bIsProjectParametersBtnOpen
NotifyPropertyChanged(NameOf(IsProjectParametersBtnOpen))
End Sub
' Definizione comandi
Private m_cmdVerifyAll As ICommand
Private m_cmdShowPopUpFilterBtnCmd As ICommand
Private m_cmdRotateAll As ICommand
Private m_cmdInvertAll As ICommand
Private m_cmdResetCalc As ICommand
Private m_cmdProjectParametersBtnCmd As ICommand
#Region "Messages"
@@ -227,6 +242,25 @@ Public Class LeftPanelVM
#End Region ' ShowPopUpFilterBtnCommand
#Region "ProjectParameters_Command"
Public ReadOnly Property ProjectParameters_Command As ICommand
Get
If m_cmdProjectParametersBtnCmd Is Nothing Then
m_cmdProjectParametersBtnCmd = New Command(AddressOf ProjectParameters)
End If
Return m_cmdProjectParametersBtnCmd
End Get
End Property
Public Sub ProjectParameters(ByVal param As Object)
Map.refOnlyProdManagerVM.GeneralParametersStrategyVM = New GeneralParametersStrategyVM()
Dim GeneralParametersStrategyWnd As New GeneralParametersStrategyV(Application.Current.MainWindow, Map.refOnlyProdManagerVM.GeneralParametersStrategyVM)
GeneralParametersStrategyWnd.ShowDialog()
End Sub
#End Region ' ProjectParameters_Command
#Region "RotateAll"
Public ReadOnly Property RotateAll_Command As ICommand
@@ -31,6 +31,7 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button ToolTip="{Binding VerifyAll_ToolTip}"
Command="{Binding VerifyAll_Command}"
@@ -115,21 +116,21 @@
Height="25"
Margin="0,6,4,0"
Style="{StaticResource SearchText_TextBox}"/>
<Button Grid.Column="5"
<Button Grid.Column="5" Visibility="Collapsed"
Command="{Binding RotateAll_Command}"
ToolTip="{Binding RotateAll_ToolTip}"
IsEnabled="{Binding RotateAll_IsEnabled}"
Style="{StaticResource OnlyProdLeftPanel_Button}">
<Image Source="/Resources/NewPage/Rotate.png" Stretch="Uniform"/>
</Button>
<Button Grid.Column="6"
<Button Grid.Column="6" Visibility="Collapsed"
Command="{Binding InvertAll_Command}"
ToolTip="{Binding InvertAll_ToolTip}"
IsEnabled="{Binding RotateAll_IsEnabled}"
Style="{StaticResource OnlyProdLeftPanel_Button}">
<Image Source="/Resources/NewPage/Inversion.png" Stretch="Uniform"/>
</Button>
<Button Grid.Column="7"
<Button Grid.Column="7" Visibility="Collapsed"
Command="{Binding Edit_Command}"
ToolTip="{Binding MultipleModify_ToolTip}"
IsEnabled="{Binding RotateAll_IsEnabled}"
@@ -137,7 +138,14 @@
Style="{StaticResource OnlyProdLeftPanel_Button}">
<Image Source="/Resources/CALCPanel/Edit.png" Stretch="Uniform"/>
</Button>
<Button Grid.Column="8"
Name="ProjectParametersBtn"
Command="{Binding ProjectParameters_Command}"
ToolTip="Parametri Progetto"
HorizontalAlignment="Right"
Style="{StaticResource OnlyProdLeftPanel_Button}">
<Image Source="/Resources/NewPage/adjustment.png" Stretch="Uniform"/>
</Button>
</Grid>
<EgtBEAMWALL:OnlyProdBTLPartListV Grid.Row="1"
@@ -92,7 +92,7 @@ Public Class MainWindowVM
AddHandler m_Supervisor_Timer.Tick, AddressOf SupervisorTimer_Tick
m_Supervisor_Timer.Start()
' imposto e avvio contatore SplashScreen
m_SplashScreen_Timer.Interval = New TimeSpan(0, 0, 0, 0, 500)
m_SplashScreen_Timer.Interval = New TimeSpan(0, 0, 0, 0, 100)
AddHandler m_SplashScreen_Timer.Tick, AddressOf SplashScreenTimer_Tick
If Not IsNothing(MapV.refSplashScreenV) Then
m_SplashScreen_Timer.Start()
@@ -163,6 +163,16 @@ Public Class OnlyProdManagerVM
NotifyPropertyChanged(NameOf(IsBtlBtnOpen))
End Sub
Private m_GeneralParametersStrategyVM As GeneralParametersStrategyVM
Friend Property GeneralParametersStrategyVM As GeneralParametersStrategyVM
Get
Return m_GeneralParametersStrategyVM
End Get
Set(value As GeneralParametersStrategyVM)
m_GeneralParametersStrategyVM = value
End Set
End Property
' Definizione comandi
Private m_cmdNew As ICommand
Private m_cmdOpen As ICommand
@@ -174,7 +184,6 @@ Public Class OnlyProdManagerVM
Private m_cmdImportProject As ICommand
Private m_cmdAddProj As ICommand
Private m_cmdAddBTL As ICommand
Private m_cmdGoToSupervisor As ICommand
Private m_cmdShowPopUpStartBtnCmd As ICommand
Private m_cmdShowPopUpSaveBtnCmd As ICommand
Private m_cmdShowPopUpBtlBtnCmd As ICommand
@@ -1331,6 +1340,7 @@ Public Class OnlyProdManagerVM
' aggiorno nome macchina in statusbar
Map.refMyStatusBarVM.RefreshMachName()
LoadingWndHelper.CloseLoadingWnd(ActiveIds.OPENPROD)
m_GeneralParametersStrategyVM = New GeneralParametersStrategyVM
Return True
End Function
@@ -7,13 +7,16 @@
Style="{StaticResource OnlyProdPartManager_Grid}">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.2*"/>
<RowDefinition Height="0.2*"/>
</Grid.RowDefinitions>
<UniformGrid Columns="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Grid.RowSpan="2" Grid.ColumnSpan="3" Style="{StaticResource OnlyProdPage_Border}"/>
<UniformGrid Columns="2" Margin="10,5,5,5">
<TextBlock Text="BTL Qty"
Style="{StaticResource OptionTextBlock_OnlyProd}"/>
<TextBlock Text="{Binding Tag.sCNT,
@@ -21,7 +24,7 @@
UpdateSourceTrigger=Explicit}"
Style="{StaticResource OnlyProdCNT_TextBlock}"/>
</UniformGrid>
<UniformGrid Grid.Row="1" Columns="2">
<UniformGrid Grid.Column="1" Columns="2" Margin="5">
<TextBlock Text="Added Qty"
Style="{StaticResource OptionTextBlock_OnlyProd}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sADDED,
@@ -29,7 +32,7 @@
UpdateSourceTrigger=Explicit}"
Style="{StaticResource Qty_TextBox}"/>
</UniformGrid>
<UniformGrid Grid.Row="2" Columns="2">
<UniformGrid Grid.Row="1" Columns="2" Margin="10,5,5,5">
<TextBlock Text="W"
Style="{StaticResource OptionTextBlock_OnlyProd}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sW,
@@ -37,7 +40,7 @@
UpdateSourceTrigger=Explicit}"
Style="{StaticResource Dimension_TextBox}"/>
</UniformGrid>
<UniformGrid Grid.Row="3" Columns="2">
<UniformGrid Grid.Row="1" Grid.Column="1" Columns="2" Margin="5">
<TextBlock Text="H"
Style="{StaticResource OptionTextBlock_OnlyProd}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sH,
@@ -45,7 +48,7 @@
UpdateSourceTrigger=Explicit}"
Style="{StaticResource Dimension_TextBox}"/>
</UniformGrid>
<UniformGrid Grid.Row="4" Columns="2">
<UniformGrid Grid.Row="1" Grid.Column="2" Columns="2" Margin="5,5,13,5">
<TextBlock Text="L"
Style="{StaticResource OptionTextBlock_OnlyProd}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sL,
@@ -95,7 +95,7 @@
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<EgtBEAMWALL:OnlyProdFreeContourManagerV DataContext="{StaticResource FreeContourManagerVM}"
Visibility="{Binding DataContext.FreeContourManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdProjectV}}}"/>
Visibility="{Binding DataContext.FreeContourManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdProjectV}}}"/>
<EgtBEAMWALL:RawPartManagerWndV Grid.Column="1"
Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdProjectV}}}"/>
@@ -107,6 +107,7 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@@ -115,12 +116,10 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Grid.RowSpan="2" Grid.ColumnSpan="3" Style="{StaticResource OnlyProdPage_Border}"/>
<Border Grid.RowSpan="3" Grid.ColumnSpan="3" Style="{StaticResource OnlyProdPage_Border}"/>
<Border Grid.Row="1" Grid.RowSpan="2" Margin="10,5,10,5" Style="{StaticResource OnlyProdPage_Border}">
<EgtBEAMWALL:OnlyProdPartManagerV DataContext="{StaticResource PartManagerVM}"
Tag="{Binding DataContext.BTLStructureVM.SelBTLPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdProjectV}}}"/>
</Border>
<EgtBEAMWALL:OnlyProdPartManagerV Grid.Row="1" DataContext="{StaticResource PartManagerVM}"
Tag="{Binding DataContext.BTLStructureVM.SelBTLPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdProjectV}}}"/>
<Border Grid.ColumnSpan="2" Margin="10,5,10,5" Background="{StaticResource BeamWall_Glacier}" Style="{StaticResource OnlyProdPage_Border}">
<TextBlock Grid.ColumnSpan="2"
@@ -129,7 +128,7 @@
Foreground="{StaticResource BeamWall_White}"
Style="{StaticResource Macro_TextBlock}"/>
</Border>
<Button Grid.Column="2"
Command="{Binding Parameter_Command}"
ToolTip="{Binding Parameters_ToolTip}" Margin="10"
@@ -137,7 +136,7 @@
<Image Source="/Resources/InstrumentPanel/Analyze.png" Stretch="Uniform"/>
</Button>
<Image Grid.RowSpan="2"
<Image Grid.RowSpan="3"
Grid.Column="1" Margin="5"
Source="/Resources/NewPage/pezzo.png" Stretch="Uniform"/>
@@ -300,6 +300,17 @@ Public Class ProjectVM
NotifyPropertyChanged(NameOf(ManagerTabVisibility))
End Sub
Private m_PieceParametersList As New ObservableCollection(Of ProjectParameters)
Public Property PieceParametersList As ObservableCollection(Of ProjectParameters)
Get
Return m_PieceParametersList
End Get
Set(value As ObservableCollection(Of ProjectParameters))
m_PieceParametersList = value
NotifyPropertyChanged(NameOf(PieceParametersList))
End Set
End Property
#Region "Messages"
Public ReadOnly Property Statistics_Msg As String
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -19,6 +19,6 @@ Public Class SaveAsStrategyV
Me.Close()
End Sub
#End Region
#End Region ' Events
End Class
@@ -183,6 +183,7 @@ Public Class JsonAvailableStrategy
.nIndexInList = StrategyIndex}
' Recupero file StrategyJson
Dim StrategyPath As String = Map.refMainWindowVM.MainWindowM.GetStandardDirPath(StrategyType) & "\" & sStrategyId & "\" & sStrategyId & ".json"
' Controllo se il file esiste
If Not File.Exists(StrategyPath) Then
EgtOutLog("Error! Strategy file not found! " & m_sStrategyId)
@@ -336,6 +337,17 @@ Public Class JsonDefaultStrategyParameter
End Set
End Property
Private m_sSource As String
Public Property sSource As String
Get
Return m_sSource
End Get
Set(value As String)
m_sSource = value
NotifyPropertyChanged(NameOf(sSource))
End Set
End Property
Private m_sSubType As String
Public Property sSubType As String
Get
@@ -385,13 +397,14 @@ Public Class JsonDefaultStrategyParameter
#Region "CONSTRUCTOR"
<JsonConstructor>
Sub New(sName As String, sNameNge As String, sValue As String, sDescriptionShort As String, sDescriptionLong As String, sType As String, sSubType As String, sMessageId As String, sMinUserLevel As Integer)
Sub New(sName As String, sNameNge As String, sValue As String, sDescriptionShort As String, sDescriptionLong As String, sType As String, sSource As String, sSubType As String, sMessageId As String, sMinUserLevel As Integer)
m_sName = sName
m_sNameNge = sNameNge
m_sValue = sValue
m_sDescriptionShort = sDescriptionShort
m_sDescriptionLong = sDescriptionLong
m_sType = sType
m_sSource = sSource
m_sSubType = sSubType
m_sMessageId = sMessageId
m_sMinUserLevel = sMinUserLevel
@@ -412,6 +425,7 @@ Public Class JsonDefaultStrategyParameter
Case GetType(ListStrategyParameter)
m_sValue = DirectCast(StrategyParameter, ListStrategyParameter).SelValue.sName
End Select
m_sSource = StrategyParameter.sSource
m_sSubType = StrategyParameter.sSubType
m_sDescriptionShort = StrategyParameter.sDescriptionShort
m_sDescriptionLong = StrategyParameter.sDescriptionLong
@@ -447,6 +461,7 @@ Public Class JsonDefaultStrategyParameter
End If
Case "tool"
StrategyParameter = New ListStrategyParameter(m_sSubType)
DirectCast(StrategyParameter, ListStrategyParameter).CreateToolsViews()
If m_sMinUserLevel = 1 Then
DirectCast(StrategyParameter, ListStrategyParameter).SetbListBoxVisibility(Visibility.Visible)
End If
@@ -1,9 +1,8 @@
Imports Newtonsoft.Json
'----------- Classe che fa riferimento alle Feature del file Json -----------
Imports EgtWPFLib5
Imports System.Collections.ObjectModel
'----------- Classe che fa riferimento alle Feature del file Json -----------
Public Class JsonStrategyFeature
Inherits VMBase
@@ -12,10 +12,18 @@
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal"
<Button Command="{Binding ConfigurationParametersCommand}"
ToolTip="Parametri Configurazione"
Margin="10,0,10,0"
Style="{StaticResource SaveOptionPanel_Button}">
<Image Source="/Resources/NewPage/adjustment.png" Stretch="Uniform"/>
</Button>
<StackPanel Grid.Column="1"
Orientation="Horizontal"
HorizontalAlignment="Center"
Margin="0,5,0,5">
<ComboBox ItemsSource="{Binding StrategyTypeList}"
@@ -47,7 +55,7 @@
<Image Source="{Binding SaveImage}" Stretch="Uniform"/>
</Button>
</StackPanel>
<Optimizer:UserAdminV Grid.Column="1"
<Optimizer:UserAdminV Grid.Column="2"
HorizontalAlignment="Right"
Tag="{Binding SelTreeItem.SelParamStrategy}"/>
</Grid>
@@ -60,6 +60,7 @@ Public Class StrategyManagerVM
m_SelStrategySetup = value
If Not IsNothing(m_SelStrategySetup) Then
m_SelStrategySetup.Read()
SetDefaultConfig_IsChecked(False)
End If
NotifyPropertyChanged(NameOf(SelStrategySetup))
End Set
@@ -296,6 +297,7 @@ Public Class StrategyManagerVM
Private m_MoveDownSelectedStrategyCommand As ICommand
Private m_cmdOk As ICommand
Private m_cmdCancel As ICommand
Private m_cmdConfigurationParametersCommand As ICommand
#End Region ' Field & Properties
@@ -359,6 +361,7 @@ Public Class StrategyManagerVM
End If
If Not IsNothing(DefaultConfigFile) Then
SelStrategySetup = DefaultConfigFile
SetDefaultConfig_IsChecked(True)
Else
SelStrategySetup = m_StrategySetupList(0)
SetDefaultConfig_IsChecked(False)
@@ -698,6 +701,25 @@ Public Class StrategyManagerVM
#End Region ' Cancel_Command
#Region "ConfigurationParametersCommand"
Public ReadOnly Property ConfigurationParametersCommand As ICommand
Get
If m_cmdConfigurationParametersCommand Is Nothing Then
m_cmdConfigurationParametersCommand = New Command(AddressOf ConfigurationParameters)
End If
Return m_cmdConfigurationParametersCommand
End Get
End Property
Public Sub ConfigurationParameters()
Map.refOnlyProdManagerVM.GeneralParametersStrategyVM = New GeneralParametersStrategyVM()
Dim GeneralParametersStrategyWnd As New GeneralParametersStrategyV(Application.Current.MainWindow, Map.refOnlyProdManagerVM.GeneralParametersStrategyVM)
GeneralParametersStrategyWnd.ShowDialog()
End Sub
#End Region ' ConfigurationParametersCommand
#End Region ' Commands
End Class
@@ -767,8 +789,21 @@ Public Class StrategySetup
Dim sStrategyConfigurationFilePath As String = sAISetupDirPath & "\" & sName & ".json"
If File.Exists(sStrategyConfigurationFilePath) Then
Dim sReadedFile As String = File.ReadAllText(sStrategyConfigurationFilePath)
Dim JsonStrategyFeatureList As List(Of JsonStrategyFeature) = JsonConvert.DeserializeObject(Of List(Of JsonStrategyFeature))(sReadedFile)
For Each Feature In JsonStrategyFeatureList
Dim JsonRoot As CustomJsonRoot = Nothing
Try
JsonRoot = JsonConvert.DeserializeObject(Of CustomJsonRoot)(sReadedFile)
Catch ex As Exception
JsonRoot = Nothing
End Try
Dim JsonStrategyFeatureList As ObservableCollection(Of JsonStrategyFeature) = Nothing
If Not IsNothing(JsonRoot) Then
JsonStrategyFeatureList = JsonRoot.FEATURE
Else
JsonStrategyFeatureList = JsonConvert.DeserializeObject(Of ObservableCollection(Of JsonStrategyFeature))(sReadedFile)
End If
For Each Feature As JsonStrategyFeature In JsonStrategyFeatureList
Dim DefaultFeature As StrategyFeature = m_StrategyFeatureList.FirstOrDefault(Function(x) x.nPrc = Feature.nPrc AndAlso x.nGrp = Feature.nGrp)
' gestire caso non venga trovata perchè non esiste più in default??'
If Not IsNothing(DefaultFeature) Then
@@ -797,16 +832,56 @@ Public Class StrategySetup
For Each StrategyFeature In m_StrategyFeatureList
JsonFromStrategyManager.Add(StrategyFeature.Serialize())
Next
Dim JsonFromStrategy As String = JsonConvert.SerializeObject(JsonFromStrategyManager, Formatting.Indented)
' Dim JsonFromStrategy As String = JsonConvert.SerializeObject(JsonFromStrategyManager, Formatting.Indented)
Dim JsonProjectParameters As New List(Of JsonParametersHelper)
For Each ParamItem In Map.refGeneralParametersStrategyVM.GeneralParametersList
JsonProjectParameters.Add(ParamItem.Serialize())
Next
' Unisco i quattro json in un solo file
Dim CombinedJson = New With {.GENERAL = JsonProjectParameters,
.FEATURE = JsonFromStrategyManager}
Dim JsonFromGenericParameters As String = JsonConvert.SerializeObject(CombinedJson, Formatting.Indented)
Dim sAISetupDirPath As String = Map.refMainWindowVM.MainWindowM.GetAISetupDirPath(Map.refStrategyManagerVM.SelStrategyType.Id, False)
Dim sStrategyConfigurationFilePath As String = sAISetupDirPath & "\" & sName & ".json"
File.WriteAllText(sStrategyConfigurationFilePath, JsonFromStrategy)
File.WriteAllText(sStrategyConfigurationFilePath, JsonFromGenericParameters)
End Sub
#End Region ' Methods
End Class
Public Class CustomJsonRoot
#Region "FIELDS & PROPETIES"
Private m_GENERAL As New ObservableCollection(Of JsonParameters)
Public Property GENERAL As ObservableCollection(Of JsonParameters)
Get
Return m_GENERAL
End Get
Set(value As ObservableCollection(Of JsonParameters))
m_GENERAL = value
End Set
End Property
Private m_FEATURE As New ObservableCollection(Of JsonStrategyFeature)
Public Property FEATURE As ObservableCollection(Of JsonStrategyFeature)
Get
Return m_FEATURE
End Get
Set(value As ObservableCollection(Of JsonStrategyFeature))
m_FEATURE = value
End Set
End Property
#End Region ' Fields & Propeties
End Class
'----------- Classe che fa riferimento alle Feature -----------
Public Class StrategyFeature
Inherits VMBase
@@ -1245,6 +1320,17 @@ Public MustInherit Class StrategyParameter
End Set
End Property
Private m_sSource As String
Public Property sSource As String
Get
Return m_sSource
End Get
Set(value As String)
m_sSource = value
NotifyPropertyChanged(NameOf(sSource))
End Set
End Property
Private m_sDescriptionShort As String
Public Property sDescriptionShort As String
Get
@@ -1301,6 +1387,7 @@ Public MustInherit Class StrategyParameter
If IsNothing(JsonGenericParameter) Then Return
m_sName = JsonGenericParameter.sName
m_sNameNge = JsonGenericParameter.sNameNge
m_sSource = JsonGenericParameter.sSource
m_sSubType = JsonGenericParameter.sSubType
m_sDescriptionShort = JsonGenericParameter.sDescriptionShort
m_sDescriptionLong = JsonGenericParameter.sDescriptionLong
@@ -53,6 +53,7 @@
<EgtBEAMWALL:SpecialPanelVM x:Key="SpecialPanelVM"/>
<EgtBEAMWALL:StrategyManagerVM x:Key="StrategyManagerVM"/>
<EgtBEAMWALL:ForcedStrategyPanelVM x:Key="ForcedStrategyPanelVM"/>
<EgtBEAMWALL:GeneralParametersStrategyVM x:Key="GeneralParametersStrategyVM"/>
<!--<EgtBEAMWALL:ForcedStrategyBTLVM x:Key="ForcedStrategyBTLVM"/>-->
<!--#endregion Panel ViewModel-->
+13 -1
View File
@@ -35,6 +35,7 @@ Module Map
Private m_refSpecialPanelVM As SpecialPanelVM
Private m_refStrategyManagerVM As StrategyManagerVM
Private m_refForcedStrategyPanelVM As ForcedStrategyPanelVM
Private m_refGeneralParametersStrategyVM As GeneralParametersStrategyVM
'Private m_refForcedStrategyBTLVM As ForcedStrategyBTLVM
#Region "Get"
@@ -261,6 +262,12 @@ Module Map
End Get
End Property
Public ReadOnly Property refGeneralParametersStrategyVM As GeneralParametersStrategyVM
Get
Return m_refGeneralParametersStrategyVM
End Get
End Property
'Public ReadOnly Property refForcedStrategyBTLVM As ForcedStrategyBTLVM
' Get
' Return m_refForcedStrategyBTLVM
@@ -451,6 +458,11 @@ Module Map
Return Not IsNothing(m_refForcedStrategyPanelVM)
End Function
Friend Function SetRefGeneralParametersStrategyVM(GeneralParametersStrategyVM As GeneralParametersStrategyVM) As Boolean
m_refGeneralParametersStrategyVM = GeneralParametersStrategyVM
Return Not IsNothing(m_refGeneralParametersStrategyVM)
End Function
'Friend Function SetRefForcedStrategyBTLVM(ForcedStrategyBTLVM As ForcedStrategyBTLVM) As Boolean
' m_refForcedStrategyBTLVM = ForcedStrategyBTLVM
' Return Not IsNothing(m_refForcedStrategyBTLVM)
@@ -483,7 +495,7 @@ Module Map
Not IsNothing(m_refBTLPartManagerVM) AndAlso Not IsNothing(m_refRawPartManagerVM) AndAlso
Not IsNothing(m_refFeatureListManagerVM) AndAlso Not IsNothing(m_refSpecialPanelVM) AndAlso
Not IsNothing(m_refStrategyManagerVM) AndAlso Not IsNothing(m_refForcedStrategyPanelVM) AndAlso
LibMap.EndInit()
Not IsNothing(m_refGeneralParametersStrategyVM) AndAlso Not LibMap.EndInit()
End Function
#End Region ' Init