diff --git a/EgtBEAMWALL.Optimizer/BTLViewModel/BTLFeatureVM.vb b/EgtBEAMWALL.Optimizer/BTLViewModel/BTLFeatureVM.vb index cdc77806..ff820fc1 100644 --- a/EgtBEAMWALL.Optimizer/BTLViewModel/BTLFeatureVM.vb +++ b/EgtBEAMWALL.Optimizer/BTLViewModel/BTLFeatureVM.vb @@ -637,7 +637,8 @@ Public Class BTLFeatureVM ''' Friend Sub EditFeature() If Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM) Then - Map.refForcedStrategyBTLVM.Init(Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM.BTLFeatureM) + 'Map.refForcedStrategyBTLVM.Init(Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM.BTLFeatureM) + Map.refForcedStrategyPanelVM.Init(Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM.BTLFeatureM) End If Map.refProjectVM.SetRawPartManagerVisibility(Visibility.Collapsed) 'Map.refProjectVM.SetStrategyManagerVisibility(Visibility.Visible) diff --git a/EgtBEAMWALL.Optimizer/BTLViewModel/BTLPartVM.vb b/EgtBEAMWALL.Optimizer/BTLViewModel/BTLPartVM.vb index dd313fce..623b7637 100644 --- a/EgtBEAMWALL.Optimizer/BTLViewModel/BTLPartVM.vb +++ b/EgtBEAMWALL.Optimizer/BTLViewModel/BTLPartVM.vb @@ -1561,7 +1561,8 @@ Public Class BTLPartVM Map.refFeatureManagerVM.SetVariant_Visibility(Visibility.Collapsed) End If ' Forzo strategia - Map.refForcedStrategyBTLVM.Init(m_SelBTLFeatureVM.BTLFeatureM) + 'Map.refForcedStrategyBTLVM.Init(m_SelBTLFeatureVM.BTLFeatureM) + Map.refForcedStrategyPanelVM.Init(m_SelBTLFeatureVM.BTLFeatureM) 'Else ' EgtDeselectAll() End If diff --git a/EgtBEAMWALL.Optimizer/ConfigurationPage/OnlyProdConfigurationPageV.xaml b/EgtBEAMWALL.Optimizer/ConfigurationPage/OnlyProdConfigurationPageV.xaml index fbcb6f5d..e5e5f3c4 100644 --- a/EgtBEAMWALL.Optimizer/ConfigurationPage/OnlyProdConfigurationPageV.xaml +++ b/EgtBEAMWALL.Optimizer/ConfigurationPage/OnlyProdConfigurationPageV.xaml @@ -7,63 +7,4 @@ - diff --git a/EgtBEAMWALL.Optimizer/EgtBEAMWALL.Optimizer.vbproj b/EgtBEAMWALL.Optimizer/EgtBEAMWALL.Optimizer.vbproj index 87229d52..90e869aa 100644 --- a/EgtBEAMWALL.Optimizer/EgtBEAMWALL.Optimizer.vbproj +++ b/EgtBEAMWALL.Optimizer/EgtBEAMWALL.Optimizer.vbproj @@ -147,7 +147,6 @@ ForcedStrategyBTLV.xaml - ForcedStrategyPanelV.xaml @@ -1127,6 +1126,21 @@ + + + + + + + + + + + + + + + IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtBEAMWALL\EgtBEAMWALL.OptimizerR32.exe diff --git a/EgtBEAMWALL.Optimizer/ForcedStrategyBTL/ForcedStrategyBTLVM.vb b/EgtBEAMWALL.Optimizer/ForcedStrategyBTL/ForcedStrategyBTLVM.vb index dd575011..5bb7e31c 100644 --- a/EgtBEAMWALL.Optimizer/ForcedStrategyBTL/ForcedStrategyBTLVM.vb +++ b/EgtBEAMWALL.Optimizer/ForcedStrategyBTL/ForcedStrategyBTLVM.vb @@ -1,7 +1,6 @@ Imports System.Collections.ObjectModel Imports System.IO Imports EgtBEAMWALL.Core -Imports EgtBEAMWALL.Optimizer.StrategyManagerVM Imports EgtUILib Imports EgtWPFLib5 Imports Newtonsoft.Json @@ -82,10 +81,36 @@ Public Class ForcedStrategyBTLVM NotifyPropertyChanged(NameOf(AdminFontWeight)) End Sub - Private m_CurrentFeature As BTLFeatureM + Private m_UnloackImage As String = "pack://application:,,,/Resources/NewPage/padlock.png" + Public ReadOnly Property UnloackImage As String + Get + Return m_UnloackImage + End Get + End Property + Friend Sub SetUnloackImage(value As String) + m_UnloackImage = value + NotifyPropertyChanged(NameOf(UnloackImage)) + End Sub - ' Definizione Comandi - Private m_UnlockAllCommand As ICommand + Private m_bUnlockAllIsChecked As Boolean = False + Public Property UnlockAllIsChecked As Boolean + Get + Return m_bUnlockAllIsChecked + End Get + Set(value As Boolean) + m_bUnlockAllIsChecked = value + If m_bUnlockAllIsChecked Then + Map.refStrategyManagerVM.UnlockAll(m_SelStrategy) + SetUnloackImage("pack://application:,,,/Resources/NewPage/padlock-unlock.png") + Else + Map.refStrategyManagerVM.LockAll(m_SelStrategy) + SetUnloackImage("pack://application:,,,/Resources/NewPage/padlock.png") + End If + NotifyPropertyChanged(NameOf(UnlockAllIsChecked)) + End Set + End Property + + Private m_CurrentFeature As BTLFeatureM #Region "Messages" @@ -95,7 +120,7 @@ Public Class ForcedStrategyBTLVM End Get End Property - Public ReadOnly Property AdminMsg As String + Public ReadOnly Property AdvanceMsg As String Get Return EgtMsg(61749) End Get @@ -286,35 +311,4 @@ Public Class ForcedStrategyBTLVM #End Region ' Methods -#Region "COMMANDS" - -#Region "UnlockAllCommand" - - Public ReadOnly Property UnlockAllCommand As ICommand - Get - If m_UnlockAllCommand Is Nothing Then - m_UnlockAllCommand = New Command(AddressOf UnlockAll) - End If - Return m_UnlockAllCommand - End Get - End Property - - ''' - ''' Funzione sblocca tutti paramatri delle strategie con una password - ''' - Public Sub UnlockAll() - Map.refStrategyManagerVM.UnLockParameter(m_SelStrategy) - For Each Param As StrategyParameter In m_SelStrategy.ParameterList - If Param.sMinUserLevel >= UserLevel.MEDIUM Then - ' Rendo visibili i parametri che hanno sMinUserLevel a 10 - SetUserAdmin_IsChecked(True) - Map.refStrategyManagerVM.UserLevelVisibility(Param, Visibility.Visible) - End If - Next - End Sub - -#End Region ' UnlockAllCommand - -#End Region ' Commands - End Class diff --git a/EgtBEAMWALL.Optimizer/ForcedStrategyPanel/ForcedStrategyPanelVM.vb b/EgtBEAMWALL.Optimizer/ForcedStrategyPanel/ForcedStrategyPanelVM.vb index c2c202cd..315dc284 100644 --- a/EgtBEAMWALL.Optimizer/ForcedStrategyPanel/ForcedStrategyPanelVM.vb +++ b/EgtBEAMWALL.Optimizer/ForcedStrategyPanel/ForcedStrategyPanelVM.vb @@ -1,7 +1,6 @@ Imports System.Collections.ObjectModel Imports System.IO Imports EgtBEAMWALL.Core -Imports EgtBEAMWALL.Optimizer.StrategyManagerVM Imports EgtUILib Imports EgtWPFLib5 Imports Newtonsoft.Json @@ -82,12 +81,40 @@ Public Class ForcedStrategyPanelVM NotifyPropertyChanged(NameOf(AdminFontWeight)) End Sub + Private m_UnloackImage As String = "pack://application:,,,/Resources/NewPage/padlock.png" + Public ReadOnly Property UnloackImage As String + Get + Return m_UnloackImage + End Get + End Property + Friend Sub SetUnloackImage(value As String) + m_UnloackImage = value + NotifyPropertyChanged(NameOf(UnloackImage)) + End Sub + + Private m_bUnlockAllIsChecked As Boolean = False + Public Property UnlockAllIsChecked As Boolean + Get + Return m_bUnlockAllIsChecked + End Get + Set(value As Boolean) + m_bUnlockAllIsChecked = value + If m_bUnlockAllIsChecked Then + Map.refStrategyManagerVM.UnlockAll(m_SelStrategy) + SetUnloackImage("pack://application:,,,/Resources/NewPage/padlock-unlock.png") + Else + Map.refStrategyManagerVM.LockAll(m_SelStrategy) + SetUnloackImage("pack://application:,,,/Resources/NewPage/padlock.png") + End If + NotifyPropertyChanged(NameOf(UnlockAllIsChecked)) + End Set + End Property + Private m_CurrentFeature As BTLFeatureM ' Definizione Comandi Private m_cmdOk As ICommand Private m_cmdCancel As ICommand - Private m_UnlockAllCommand As ICommand #Region "Messages" @@ -97,7 +124,7 @@ Public Class ForcedStrategyPanelVM End Get End Property - Public ReadOnly Property AdminMsg As String + Public ReadOnly Property AdvanceMsg As String Get Return EgtMsg(61749) End Get @@ -245,6 +272,47 @@ Public Class ForcedStrategyPanelVM Return -1 End Function + Friend Sub ForcedStrategy() + ' cancello precedenti valori + Dim sPrecStrategyID As String = "" + EgtGetInfo(m_CurrentFeature.nFeatureId, "STRATEGY", sPrecStrategyID) + If Not String.IsNullOrWhiteSpace(sPrecStrategyID) Then + Dim PrecInfo As String() = {} + EgtGetAllInfo(m_CurrentFeature.nFeatureId, PrecInfo) + Dim PrecStrategyInfo As String() = PrecInfo.Where(Function(x) x.StartsWith(sPrecStrategyID)).ToArray() + For Each Info In PrecStrategyInfo + EgtRemoveInfo(m_CurrentFeature.nFeatureId, Info.Split("="c)(0)) + Next + End If + If Not IsNothing(m_SelStrategy) Then + If m_SelStrategy.sStrategyId = AUTOMATICSTRATEGYID Then + EgtRemoveInfo(m_CurrentFeature.nFeatureId, "STRATEGY") + Else + EgtSetInfo(m_CurrentFeature.nFeatureId, "STRATEGY", SelStrategy.sStrategyId) + Dim sInfo As String = String.Empty + For Each Param In SelStrategy.ParameterList + Select Case Param.GetType() + Case GetType(BooleanStrategyParameter) + EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, DirectCast(Param, BooleanStrategyParameter).bValue) + Case GetType(DoubleStrategyParameter) + EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, DirectCast(Param, DoubleStrategyParameter).sValue) + Case GetType(ComboStrategyParameter) + EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, DirectCast(Param, ComboStrategyParameter).SelValue.sValue) + Case GetType(StringStrategyParameter) + EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, DirectCast(Param, StringStrategyParameter).sValue) + Case GetType(ListStrategyParameter) + For Each Item As ToolParameter In DirectCast(Param, ListStrategyParameter).ListValue + If Item.bIsActive Then + sInfo &= Item.sUUID & "," & Item.sName & ";" + EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, sInfo) + End If + Next + End Select + Next + End If + End If + End Sub + #End Region ' Methods #Region "COMMANDS" @@ -261,42 +329,43 @@ Public Class ForcedStrategyPanelVM End Property Public Sub Ok() - ' cancello precedenti valori - Dim sPrecStrategyID As String = "" - EgtGetInfo(m_CurrentFeature.nFeatureId, "STRATEGY", sPrecStrategyID) - If Not String.IsNullOrWhiteSpace(sPrecStrategyID) Then - Dim PrecInfo As String() = {} - EgtGetAllInfo(m_CurrentFeature.nFeatureId, PrecInfo) - Dim PrecStrategyInfo As String() = PrecInfo.Where(Function(x) x.StartsWith(sPrecStrategyID)).ToArray() - For Each Info In PrecStrategyInfo - EgtRemoveInfo(m_CurrentFeature.nFeatureId, Info.Split("="c)(0)) - Next - End If - If m_SelStrategy.sStrategyId = AUTOMATICSTRATEGYID Then - EgtRemoveInfo(m_CurrentFeature.nFeatureId, "STRATEGY") - Else - EgtSetInfo(m_CurrentFeature.nFeatureId, "STRATEGY", SelStrategy.sStrategyId) - Dim sInfo As String = String.Empty - For Each Param In SelStrategy.ParameterList - Select Case Param.GetType() - Case GetType(BooleanStrategyParameter) - EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, DirectCast(Param, BooleanStrategyParameter).bValue) - Case GetType(DoubleStrategyParameter) - EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, DirectCast(Param, DoubleStrategyParameter).sValue) - Case GetType(ComboStrategyParameter) - EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, DirectCast(Param, ComboStrategyParameter).SelValue.sValue) - Case GetType(StringStrategyParameter) - EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, DirectCast(Param, StringStrategyParameter).sValue) - Case GetType(ListStrategyParameter) - For Each Item As ToolParameter In DirectCast(Param, ListStrategyParameter).ListValue - If Item.bIsActive Then - sInfo &= Item.sUUID & "," & Item.sName & ";" - EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, sInfo) - End If - Next - End Select - Next - End If + '' cancello precedenti valori + 'Dim sPrecStrategyID As String = "" + 'EgtGetInfo(m_CurrentFeature.nFeatureId, "STRATEGY", sPrecStrategyID) + 'If Not String.IsNullOrWhiteSpace(sPrecStrategyID) Then + ' Dim PrecInfo As String() = {} + ' EgtGetAllInfo(m_CurrentFeature.nFeatureId, PrecInfo) + ' Dim PrecStrategyInfo As String() = PrecInfo.Where(Function(x) x.StartsWith(sPrecStrategyID)).ToArray() + ' For Each Info In PrecStrategyInfo + ' EgtRemoveInfo(m_CurrentFeature.nFeatureId, Info.Split("="c)(0)) + ' Next + 'End If + 'If m_SelStrategy.sStrategyId = AUTOMATICSTRATEGYID Then + ' EgtRemoveInfo(m_CurrentFeature.nFeatureId, "STRATEGY") + 'Else + ' EgtSetInfo(m_CurrentFeature.nFeatureId, "STRATEGY", SelStrategy.sStrategyId) + ' Dim sInfo As String = String.Empty + ' For Each Param In SelStrategy.ParameterList + ' Select Case Param.GetType() + ' Case GetType(BooleanStrategyParameter) + ' EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, DirectCast(Param, BooleanStrategyParameter).bValue) + ' Case GetType(DoubleStrategyParameter) + ' EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, DirectCast(Param, DoubleStrategyParameter).sValue) + ' Case GetType(ComboStrategyParameter) + ' EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, DirectCast(Param, ComboStrategyParameter).SelValue.sValue) + ' Case GetType(StringStrategyParameter) + ' EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, DirectCast(Param, StringStrategyParameter).sValue) + ' Case GetType(ListStrategyParameter) + ' For Each Item As ToolParameter In DirectCast(Param, ListStrategyParameter).ListValue + ' If Item.bIsActive Then + ' sInfo &= Item.sUUID & "," & Item.sName & ";" + ' EgtSetInfo(m_CurrentFeature.nFeatureId, m_SelStrategy.sStrategyId & "_" & Param.sNameNge, sInfo) + ' End If + ' Next + ' End Select + ' Next + 'End If + ForcedStrategy() Map.refProjectVM.SetSelManagerTab(ProjectVM.StrategyManagerTab.RAWPARTMANAGER) ' Abilito LeftPanel Map.refProjectVM.SetOnlyProdLeftPanel_IsEnabled(True) @@ -325,33 +394,6 @@ Public Class ForcedStrategyPanelVM #End Region ' Cancel_Command -#Region "UnlockAllCommand" - - Public ReadOnly Property UnlockAllCommand As ICommand - Get - If m_UnlockAllCommand Is Nothing Then - m_UnlockAllCommand = New Command(AddressOf UnlockAll) - End If - Return m_UnlockAllCommand - End Get - End Property - - ''' - ''' Funzione sblocca tutti paramatri delle strategie con una password - ''' - Public Sub UnlockAll() - Map.refStrategyManagerVM.UnLockParameter(m_SelStrategy) - For Each Param As StrategyParameter In m_SelStrategy.ParameterList - If Param.sMinUserLevel >= UserLevel.MEDIUM Then - ' Rendo visibili i parametri che hanno sMinUserLevel a 10 - SetUserAdmin_IsChecked(True) - Map.refStrategyManagerVM.UserLevelVisibility(Param, Visibility.Visible) - End If - Next - End Sub - -#End Region ' UnlockAllCommand - #End Region ' Commands End Class diff --git a/EgtBEAMWALL.Optimizer/ItemParamList/FeatureListVM.vb b/EgtBEAMWALL.Optimizer/ItemParamList/FeatureListVM.vb index 844b2046..029ea437 100644 --- a/EgtBEAMWALL.Optimizer/ItemParamList/FeatureListVM.vb +++ b/EgtBEAMWALL.Optimizer/ItemParamList/FeatureListVM.vb @@ -100,7 +100,8 @@ Public Class FeatureListVM End Property Public Sub Ok() - Map.refForcedStrategyBTLVM.ForcedStrategy() + 'Map.refForcedStrategyBTLVM.ForcedStrategy() + Map.refForcedStrategyPanelVM.ForcedStrategy() Map.refProjectVM.SetRawPartManagerVisibility(Visibility.Visible) Map.refProjectVM.SetStrategyManagerVisibility(Visibility.Collapsed) Map.refProjectVM.SetSelManagerTab(ProjectVM.StrategyManagerTab.RAWPARTMANAGER) diff --git a/EgtBEAMWALL.Optimizer/ItemParamList/OnlyProdBTLPartListV.xaml b/EgtBEAMWALL.Optimizer/ItemParamList/OnlyProdBTLPartListV.xaml index cf58512a..6f699db1 100644 --- a/EgtBEAMWALL.Optimizer/ItemParamList/OnlyProdBTLPartListV.xaml +++ b/EgtBEAMWALL.Optimizer/ItemParamList/OnlyProdBTLPartListV.xaml @@ -392,6 +392,9 @@ SelectedItem="{Binding SelBTLFeatureVM, UpdateSourceTrigger=PropertyChanged}" PreviewMouseWheel="ListBox_PreviewMouseWheel" Grid.IsSharedSizeScope="True" + ScrollViewer.HorizontalScrollBarVisibility="Auto" + ScrollViewer.VerticalScrollBarVisibility="Auto" + Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALLCORE:EgtDataGrid}}}" Style="{StaticResource BTL_ListBox}"> diff --git a/EgtBEAMWALL.Optimizer/ItemParamList/PParameterListVM.vb b/EgtBEAMWALL.Optimizer/ItemParamList/PParameterListVM.vb index f1d60c44..3ae5e2fb 100644 --- a/EgtBEAMWALL.Optimizer/ItemParamList/PParameterListVM.vb +++ b/EgtBEAMWALL.Optimizer/ItemParamList/PParameterListVM.vb @@ -139,7 +139,8 @@ Public Class PParameterListVM End Property Public Sub Ok() - Map.refForcedStrategyBTLVM.ForcedStrategy() + 'Map.refForcedStrategyBTLVM.ForcedStrategy() + Map.refForcedStrategyPanelVM.ForcedStrategy() Map.refProjectVM.SetRawPartManagerVisibility(Visibility.Visible) Map.refProjectVM.SetStrategyManagerVisibility(Visibility.Collapsed) Map.refProjectVM.SetSelManagerTab(ProjectVM.StrategyManagerTab.RAWPARTMANAGER) diff --git a/EgtBEAMWALL.Optimizer/MainMenu/MainMenuVM.vb b/EgtBEAMWALL.Optimizer/MainMenu/MainMenuVM.vb index 7247031e..ad8971b7 100644 --- a/EgtBEAMWALL.Optimizer/MainMenu/MainMenuVM.vb +++ b/EgtBEAMWALL.Optimizer/MainMenu/MainMenuVM.vb @@ -209,6 +209,8 @@ Public Class MainMenuVM EgtSetCurrMachine(Map.refMachinePanelVM.SelectedMachine.Name) Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage)) Map.refMainMenuVM.NotifyPropertyChanged(NameOf(Map.refMainMenuVM.SendFeedbackIsEnabled)) + Map.refStrategyManagerVM.UserAdmin_IsChecked = False + Map.refStrategyManagerVM.SetUnloackImage("pack://application:,,,/Resources/NewPAge/padlock.png") Return True End Function diff --git a/EgtBEAMWALL.Optimizer/OnlyProdManager/OnlyProdManagerV.xaml b/EgtBEAMWALL.Optimizer/OnlyProdManager/OnlyProdManagerV.xaml index 8e54f8c3..60dcf02b 100644 --- a/EgtBEAMWALL.Optimizer/OnlyProdManager/OnlyProdManagerV.xaml +++ b/EgtBEAMWALL.Optimizer/OnlyProdManager/OnlyProdManagerV.xaml @@ -6,10 +6,11 @@ Style="{StaticResource OnlyProdPartManager_StackPanel}"> - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/EgtBEAMWALL.Optimizer/Project/OnlyProdProjectV.xaml b/EgtBEAMWALL.Optimizer/Project/OnlyProdProjectV.xaml index 12ed28da..2b804fcf 100644 --- a/EgtBEAMWALL.Optimizer/Project/OnlyProdProjectV.xaml +++ b/EgtBEAMWALL.Optimizer/Project/OnlyProdProjectV.xaml @@ -110,27 +110,39 @@ + - + - - - - + + - + + + + - - - + + + + + + + + + + + + + + - @@ -52,11 +60,13 @@ - - - + Grid.RowSpan="2"/> - - diff --git a/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerVM.vb b/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerVM.vb index b5db4a3c..60b287de 100644 --- a/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerVM.vb +++ b/EgtBEAMWALL.Optimizer/StrategyManager/StrategyManagerVM.vb @@ -3,7 +3,6 @@ Imports System.ComponentModel Imports System.Globalization Imports System.IO Imports EgtBEAMWALL.Core -Imports EgtBEAMWALL.Optimizer.StrategyManagerVM Imports EgtUILib Imports EgtWPFLib5 Imports Newtonsoft.Json @@ -14,9 +13,9 @@ Public Class StrategyManagerVM #Region "FIELDS & PROPERTIES" Public Enum UserLevel As Integer - BASE = 1 - MEDIUM = 5 - FULL = 10 + USER = 1 + ADVANCED = 5 + ADMINISTRATOR = 10 End Enum Private m_StrategyTypeList As New List(Of IdNameStruct)({New IdNameStruct(BWType.BEAM, "Beam"), New IdNameStruct(BWType.WALL, "Wall")}) @@ -36,7 +35,6 @@ Public Class StrategyManagerVM ' deseleziono eventuale strategia selezionata If Not IsNothing(m_SelTreeItem) Then m_SelTreeItem.IsSelected = False - 'SelTreeItem = Nothing End If End Set End Property @@ -58,7 +56,6 @@ Public Class StrategyManagerVM If Not IsNothing(m_SelTreeItem) Then m_SelTreeItem.IsSelected = False m_SelTreeItem.StrategyList.Clear() - 'SelTreeItem = Nothing End If m_SelStrategySetup = value m_SelStrategySetup.Read() @@ -162,7 +159,9 @@ Public Class StrategyManagerVM End Get Set(value As Boolean) m_bUserAdmin_IsChecked = value - ShowParamStrategy(m_SelTreeItem.SelParamStrategy) + If Not IsNothing(m_SelTreeItem) Then + ShowParamStrategy(m_SelTreeItem.SelParamStrategy) + End If NotifyPropertyChanged(NameOf(UserAdmin_IsChecked)) End Set End Property @@ -204,6 +203,35 @@ Public Class StrategyManagerVM NotifyPropertyChanged(NameOf(bOK)) End Sub + Private m_UnloackImage As String = "pack://application:,,,/Resources/NewPage/padlock.png" + Public ReadOnly Property UnloackImage As String + Get + Return m_UnloackImage + End Get + End Property + Friend Sub SetUnloackImage(value As String) + m_UnloackImage = value + NotifyPropertyChanged(NameOf(UnloackImage)) + End Sub + + Private m_bUnlockAllIsChecked As Boolean = False + Public Property UnlockAllIsChecked As Boolean + Get + Return m_bUnlockAllIsChecked + End Get + Set(value As Boolean) + m_bUnlockAllIsChecked = value + If m_bUnlockAllIsChecked Then + UnlockAll(m_SelTreeItem.SelParamStrategy) + SetUnloackImage("pack://application:,,,/Resources/NewPage/padlock-unlock.png") + Else + LockAll(m_SelTreeItem.SelParamStrategy) + SetUnloackImage("pack://application:,,,/Resources/NewPage/padlock.png") + End If + NotifyPropertyChanged(NameOf(UnlockAllIsChecked)) + End Set + End Property + #Region "Messages" Public ReadOnly Property SaveToolTip As String @@ -230,7 +258,7 @@ Public Class StrategyManagerVM End Get End Property - Public ReadOnly Property AdminMsg As String + Public ReadOnly Property AdvanceMsg As String Get Return EgtMsg(61749) End Get @@ -248,7 +276,6 @@ Public Class StrategyManagerVM Private m_MoveDownSelectedStrategyCommand As ICommand Private m_cmdOk As ICommand Private m_cmdCancel As ICommand - Private m_UnlockAllCommand As ICommand #End Region ' Field & Properties @@ -325,19 +352,20 @@ Public Class StrategyManagerVM Friend Sub ShowParamStrategy(Strategy As Strategy) SetAdminFontWeight(If(m_bUserAdmin_IsChecked, FontWeights.Bold, FontWeights.Normal)) SetUserFontWeight(If(m_bUserAdmin_IsChecked, FontWeights.Normal, FontWeights.Bold)) - For Each Param As StrategyParameter In m_SelTreeItem.SelParamStrategy.ParameterList + For Each Param As StrategyParameter In Strategy.ParameterList Select Case Param.sMinUserLevel - Case UserLevel.MEDIUM + Case UserLevel.ADVANCED UserLevelVisibility(Param, If(m_bUserAdmin_IsChecked, Visibility.Visible, Visibility.Collapsed)) Case Else If Not m_bUserAdmin_IsChecked Then - UserLevelVisibility(Param, If(Param.sMinUserLevel = UserLevel.BASE, Visibility.Visible, Visibility.Collapsed)) + UserLevelVisibility(Param, If(Param.sMinUserLevel = UserLevel.USER, Visibility.Visible, Visibility.Collapsed)) + SetUnloackImage("pack://application:,,,/Resources/NewPAge/padlock.png") End If End Select Next End Sub - Friend Sub UnLockParameter(Strategy As Strategy) + Friend Sub UnLockParameter() Dim InputPwdWndVM As New InputPwdWndVM() Dim InputPwdWnd As New OnlyProdInputPwdWndV(Application.Current.MainWindow, InputPwdWndVM) Dim sPwdIni As String = String.Empty @@ -366,6 +394,33 @@ Public Class StrategyManagerVM End If End Sub + ''' + ''' Funzione sblocca tutti paramatri delle strategie con una password + ''' + Public Sub UnlockAll(Strategy As Strategy) + UnLockParameter() + For Each Param As StrategyParameter In Strategy.ParameterList + If Param.sMinUserLevel >= UserLevel.ADVANCED Then + ' Rendo visibili i parametri che hanno sMinUserLevel a 10 + Map.refStrategyManagerVM.SetUserAdmin_IsChecked(True) + UserLevelVisibility(Param, Visibility.Visible) + End If + Next + End Sub + + ''' + ''' Funzione blocca tutti paramatri delle strategie con una password + ''' + Public Sub LockAll(Strategy As Strategy) + For Each Param As StrategyParameter In Strategy.ParameterList + If Param.sMinUserLevel >= UserLevel.ADVANCED Then + ' Rendo visibili i parametri che hanno sMinUserLevel a 10 + Map.refStrategyManagerVM.SetUserAdmin_IsChecked(False) + UserLevelVisibility(Param, Visibility.Collapsed) + End If + Next + End Sub + #End Region ' Methods #Region "COMMANDS" @@ -606,33 +661,6 @@ Public Class StrategyManagerVM #End Region ' Cancel_Command -#Region "UnlockAllCommand" - - Public ReadOnly Property UnlockAllCommand As ICommand - Get - If m_UnlockAllCommand Is Nothing Then - m_UnlockAllCommand = New Command(AddressOf UnlockAll) - End If - Return m_UnlockAllCommand - End Get - End Property - - ''' - ''' Funzione sblocca tutti paramatri delle strategie con una password - ''' - Public Sub UnlockAll() - UnLockParameter(m_SelTreeItem.SelParamStrategy) - For Each Param As StrategyParameter In m_SelTreeItem.SelParamStrategy.ParameterList - If Param.sMinUserLevel >= UserLevel.MEDIUM Then - ' Rendo visibili i parametri che hanno sMinUserLevel a 10 - Map.refStrategyManagerVM.SetUserAdmin_IsChecked(True) - UserLevelVisibility(Param, Visibility.Visible) - End If - Next - End Sub - -#End Region ' UnlockAllCommand - #End Region ' Commands End Class diff --git a/EgtBEAMWALL.Optimizer/StrategyManager/UserAdminV.xaml b/EgtBEAMWALL.Optimizer/StrategyManager/UserAdminV.xaml index 93a404e3..54eaa8c5 100644 --- a/EgtBEAMWALL.Optimizer/StrategyManager/UserAdminV.xaml +++ b/EgtBEAMWALL.Optimizer/StrategyManager/UserAdminV.xaml @@ -1,8 +1,7 @@  + HorizontalAlignment="Right"> @@ -19,16 +18,15 @@ IsChecked="{Binding UserAdmin_IsChecked}" Style="{StaticResource Parameter_ToggleButton}"/> - + + + diff --git a/EgtBEAMWALL.Optimizer/Utility/Dictionary.xaml b/EgtBEAMWALL.Optimizer/Utility/Dictionary.xaml index 55e936d6..7152a466 100644 --- a/EgtBEAMWALL.Optimizer/Utility/Dictionary.xaml +++ b/EgtBEAMWALL.Optimizer/Utility/Dictionary.xaml @@ -53,7 +53,7 @@ - + @@ -410,7 +410,7 @@ + + @@ -3677,9 +3715,10 @@