Imports System.Collections.ObjectModel Imports System.IO Imports System.Windows.Threading Imports EgtBEAMWALL.Core Imports EgtBEAMWALL.Optimizer.MainMenuVM Imports EgtUILib Imports EgtWPFLib5 Imports Newtonsoft.Json Public Class ProjectVM Inherits VMBase #Region "FIELDS & PROPERTIES" Private PADLOCK_IMAGE As String = "pack://application:,,,/Resources/NewPage/padlock.png" Private m_Calc_Timer As New DispatcherTimer Friend Event OnPreControllerExec(sFilePath As String) Friend Event OnPostControllerExec() Private Property m_GridDims As New ObservableCollection(Of GridDimension) Public Property GridDims As ObservableCollection(Of GridDimension) Get Return m_GridDims End Get Set m_GridDims = Value NotifyPropertyChanged(NameOf(GridDims)) End Set End Property Private m_BTLStructureVM As BTLStructureVM Public Property BTLStructureVM As BTLStructureVM Get Return m_BTLStructureVM End Get Set(value As BTLStructureVM) m_BTLStructureVM = value NotifyPropertyChanged(NameOf(BTLStructureVM)) End Set End Property Private m_MachGroupPanelVM As MyMachGroupPanelVM Public Property MachGroupPanelVM As MyMachGroupPanelVM Get Return m_MachGroupPanelVM End Get Set(value As MyMachGroupPanelVM) m_MachGroupPanelVM = value NotifyPropertyChanged(NameOf(MachGroupPanelVM)) End Set End Property Private m_bCalcRunning As Boolean = False Public ReadOnly Property bCalcRunning As Boolean Get Return m_bCalcRunning End Get End Property Private m_bLockUX As Boolean = False Private m_FeatureManager_Visibility As Boolean = True Public Property FeatureManager_Visibility As Visibility Get Return If(m_FeatureManager_Visibility, Visibility.Visible, Visibility.Collapsed) End Get Set(value As Visibility) m_FeatureManager_Visibility = (value = Visibility.Visible) End Set End Property Friend Sub SetFeatureManager_Visibility(IsVisible As Boolean) m_FeatureManager_Visibility = IsVisible End Sub Private m_ShowBeamPanel_Visibility As Boolean = True Public Property ShowBeamPanel_Visibility As Visibility Get Return If(m_ShowBeamPanel_Visibility, Visibility.Visible, Visibility.Collapsed) End Get Set(value As Visibility) m_ShowBeamPanel_Visibility = (value = Visibility.Visible) End Set End Property Friend Sub SetShowBeamPanel_Visibility(IsVisible As Boolean) m_ShowBeamPanel_Visibility = IsVisible End Sub Private m_FreeContourManager_Visibility As Boolean = False Public Property FreeContourManager_Visibility As Visibility Get Return If(m_FreeContourManager_Visibility, Visibility.Visible, Visibility.Collapsed) End Get Set(value As Visibility) m_FreeContourManager_Visibility = (value = Visibility.Visible) End Set End Property Friend Sub SetFreeContourManager_Visibility(IsVisible As Boolean) m_FreeContourManager_Visibility = IsVisible NotifyPropertyChanged(NameOf(FreeContourManager_Visibility)) End Sub Private m_ProdManager_Visibility As Boolean = True Public Property ProdManager_Visibility As Visibility Get Return If(m_ProdManager_Visibility, Visibility.Visible, Visibility.Collapsed) End Get Set(value As Visibility) m_ProdManager_Visibility = (value = Visibility.Visible) End Set End Property Friend Sub SetProdManager_Visibility(IsVisible As Boolean) m_ProdManager_Visibility = IsVisible End Sub Private m_LeftPanel_Visibility As Boolean = True Public Property LeftPanel_Visibility As Visibility Get Return If(m_LeftPanel_Visibility, Visibility.Visible, Visibility.Collapsed) End Get Set(value As Visibility) m_LeftPanel_Visibility = (value = Visibility.Visible) End Set End Property Friend Sub SetLeftPanel_Visibility(IsVisible As Boolean) m_LeftPanel_Visibility = IsVisible End Sub Private m_LeftPanel_IsEnabled As Boolean = True Public Property LeftPanel_IsEnabled As Boolean Get Return m_LeftPanel_IsEnabled End Get Set(value As Boolean) m_LeftPanel_IsEnabled = value End Set End Property Friend Sub SetLeftPanel_IsEnabled(IsEnabled As Boolean) m_LeftPanel_IsEnabled = IsEnabled NotifyPropertyChanged(NameOf(LeftPanel_IsEnabled)) End Sub Private m_LeftPanel_Opacity As Double = 1 Public Property LeftPanel_Opacity As Double Get Return m_LeftPanel_Opacity End Get Set(value As Double) m_LeftPanel_Opacity = value End Set End Property Friend Sub SetLeftPanel_Opacity(Opacity As Double) m_LeftPanel_Opacity = Opacity NotifyPropertyChanged(NameOf(LeftPanel_Opacity)) End Sub Private m_OptimizePanel_Visibility As Boolean = True Public Property OptimizePanel_Visibility As Visibility Get Return If(m_OptimizePanel_Visibility, Visibility.Visible, Visibility.Collapsed) End Get Set(value As Visibility) m_OptimizePanel_Visibility = (value = Visibility.Visible) End Set End Property Friend Sub SetOptimizePanel_Visibility(IsVisible As Boolean) m_OptimizePanel_Visibility = IsVisible NotifyPropertyChanged(NameOf(OptimizePanel_Visibility)) Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.CalcRotFlip_Visibility)) Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.Optimize_Visibility)) Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.OriginType_Visibility)) Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.NestingOption_Visibility)) End Sub Public ReadOnly Property SpecialPanel_Visibility As Visibility Get Return If(Map.refMainWindowVM.MainWindowM.bSpecialPanel AndAlso Map.refMainWindowVM.MainWindowM.nUserLevel > 5, Visibility.Visible, Visibility.Collapsed) End Get End Property Private m_MacroFeature_IsEnabled As Boolean = False Public Property MacroFeature_IsEnabled As Boolean Get Return m_MacroFeature_IsEnabled End Get Set(value As Boolean) m_MacroFeature_IsEnabled = value NotifyPropertyChanged(NameOf(MacroFeature_IsEnabled)) End Set End Property Enum GridSelTypes As Integer PARTLIST = 1 PART = 2 MACHGROUP = 3 End Enum Private m_LastSelGridType As GridSelTypes Public ReadOnly Property LastSelGridType As GridSelTypes Get Return m_LastSelGridType End Get End Property Friend Sub SetLastSelGridType(value As GridSelTypes) m_LastSelGridType = value End Sub ' Gestione Tab con Strategy Friend Enum StrategyManagerTab As Integer NULL = -1 RAWPARTMANAGER = 0 FEATUREMANAGER = 1 STRATEGYMANAGER = 2 FEATUREMANAGERBTL = 3 End Enum Private m_SelManagerTab As StrategyManagerTab Public Property SelManagerTab As Integer Get Return m_SelManagerTab End Get Set(value As Integer) m_SelManagerTab = value End Set End Property Friend Sub SetSelManagerTab(bSelManagerTab As StrategyManagerTab) m_SelManagerTab = bSelManagerTab NotifyPropertyChanged(NameOf(SelManagerTab)) End Sub Friend Enum FeatureManagerTab As Integer NULL = -1 FEATURERAWPARTMANAGER = 0 STRATEGYMANAGERBTL = 1 End Enum Private m_SelFeatureManagerTab As FeatureManagerTab Public Property SelFeatureManagerTab As Integer Get Return m_SelFeatureManagerTab End Get Set(value As Integer) m_SelFeatureManagerTab = value End Set End Property Friend Sub SetSelFeatureManagerTab(bSelFeatureManagerTab As FeatureManagerTab) m_SelFeatureManagerTab = bSelFeatureManagerTab NotifyPropertyChanged(NameOf(SelFeatureManagerTab)) End Sub Private m_FeatureList_Visibility As Visibility = Visibility.Collapsed Public ReadOnly Property FeatureList_Visibility As Visibility Get Return m_FeatureList_Visibility End Get End Property Sub SetFeatureListVisibility(bVisible As Boolean) m_FeatureList_Visibility = If(bVisible, Visibility.Visible, Visibility.Collapsed) NotifyPropertyChanged(NameOf(FeatureList_Visibility)) End Sub Private m_RawPartManagerVisibility As Visibility = Visibility.Collapsed Public ReadOnly Property RawPartManagerVisibility As Visibility Get Return m_RawPartManagerVisibility End Get End Property Sub SetRawPartManagerVisibility(bVisible As Boolean) m_RawPartManagerVisibility = If(bVisible, Visibility.Visible, Visibility.Collapsed) NotifyPropertyChanged(NameOf(RawPartManagerVisibility)) End Sub Private m_StrategyManagerVisibility As Visibility = Visibility.Collapsed Public ReadOnly Property StrategyManagerVisibility As Visibility Get Return m_StrategyManagerVisibility End Get End Property Sub SetStrategyManagerVisibility(bVisible As Boolean) m_StrategyManagerVisibility = If(bVisible, Visibility.Visible, Visibility.Collapsed) NotifyPropertyChanged(NameOf(StrategyManagerVisibility)) End Sub Private m_SceneShowBuldingVisibility As Visibility = Visibility.Collapsed Public ReadOnly Property SceneShowBuldingVisibility As Visibility Get Return m_SceneShowBuldingVisibility End Get End Property Sub SetSceneShowBuldingVisibility(bVisible As Boolean) m_SceneShowBuldingVisibility = If(bVisible, Visibility.Visible, Visibility.Collapsed) NotifyPropertyChanged(NameOf(SceneShowBuldingVisibility)) End Sub Private m_ManagerTabVisibility As Visibility = Visibility.Visible Public ReadOnly Property ManagerTabVisibility As Visibility Get Return m_ManagerTabVisibility End Get End Property Sub SetManagerTabVisibility(bVisible As Boolean) m_ManagerTabVisibility = If(bVisible, Visibility.Visible, Visibility.Collapsed) NotifyPropertyChanged(NameOf(ManagerTabVisibility)) End Sub Private m_GeneralParametersList As New ObservableCollection(Of ProjectParameters) Public Property GeneralParametersList As ObservableCollection(Of ProjectParameters) Get Return m_GeneralParametersList End Get Set(value As ObservableCollection(Of ProjectParameters)) m_GeneralParametersList = value NotifyPropertyChanged(NameOf(GeneralParametersList)) End Set End Property Private m_bSaveGeneralParameters As Boolean Public Property bSaveGeneralParameters As Boolean Get Return m_bSaveGeneralParameters End Get Set(value As Boolean) m_bSaveGeneralParameters = value If m_bSaveGeneralParameters Then SetGeneralParametersIsEnable(True) Map.refProjectVM.BTLStructureVM.SelBTLPart.SetStrategyModify_Visibility(True) Else SetGeneralParametersIsEnable(False) Map.refProjectVM.BTLStructureVM.SelBTLPart.SetStrategyModify_Visibility(False) Dim sStrategiesDirPath As String = Map.refMainWindowVM.MainWindowM.GetStrategiesDirPath(Map.refStrategyManagerVM.SelStrategyType.Id) Dim sGeneralParametersFilePath As String = sStrategiesDirPath & "\" & GENERALPARAMETERS_FILE & ".json" If File.Exists(sGeneralParametersFilePath) Then Dim sReadedFiles As String = File.ReadAllText(sGeneralParametersFilePath) Dim JsonGeneralParametersList As List(Of JsonGeneralParameters) = JsonConvert.DeserializeObject(Of List(Of JsonGeneralParameters))(sReadedFiles) m_GeneralParametersList = New ObservableCollection(Of ProjectParameters)((From JsonGeneralParameter In JsonGeneralParametersList Select JsonGeneralParameter.Deserialize(Map.refStrategyManagerVM.SelStrategyType.Id)).ToList()) End If End If NotifyPropertyChanged(NameOf(bSaveGeneralParameters)) End Set End Property Friend Sub SetbSaveGeneralParameters(value As Boolean) m_bSaveGeneralParameters = value NotifyPropertyChanged(NameOf(bSaveGeneralParameters)) End Sub Private m_GeneralParametersIsEnable As Boolean = False Public ReadOnly Property GeneralParametersIsEnable As Boolean Get Return m_GeneralParametersIsEnable End Get End Property Friend Sub SetGeneralParametersIsEnable(value As Boolean) m_GeneralParametersIsEnable = value NotifyPropertyChanged(NameOf(GeneralParametersIsEnable)) End Sub Private m_StrategySetupList As New ObservableCollection(Of String) Public ReadOnly Property StrategySetupList As ObservableCollection(Of String) Get Return m_StrategySetupList End Get End Property Private m_SelStrategySetup As String Public Property SelStrategySetup As String Get Return m_SelStrategySetup End Get Set(value As String) If Not IsNothing(value) Then Map.refStrategyManagerVM.SelStrategySetup.sName = value Map.refStrategyManagerVM.SelStrategySetup.Read() CustomGeneralParameters(value) End If m_SelStrategySetup = value NotifyPropertyChanged(NameOf(SelStrategySetup)) End Set End Property Friend Sub SetSelStrategy(value As String) m_SelStrategySetup = value Map.refStrategyManagerVM.SelStrategySetup.Read() Map.refSceneHostVM.SaveProject() NotifyPropertyChanged(NameOf(SelStrategySetup)) End Sub #Region "Messages" Public ReadOnly Property Statistics_Msg As String Get Return EgtMsg(61923) End Get End Property Public ReadOnly Property Parameters_ToolTip As String Get Return EgtMsg(61898) End Get End Property #End Region ' Messages ' Definizione Comandi Private m_cmdOptimizer As ICommand Private m_cmdParameter As ICommand Private m_cmdBack As ICommand Private m_cmdOk_Command As ICommand #End Region ' Fields & Properties #Region "CONSTRUCTOR" Sub New() ' Creo riferimento a questa classe in Map Map.SetRefProjectVM(Me) ' imposto timer per aggiornamenti Calc m_Calc_Timer.Interval = TimeSpan.FromMilliseconds(500) AddHandler m_Calc_Timer.Tick, AddressOf Calc_Timer_Tick ' imposto dimensioni colonne/righe della Grid DimensionsIniFile.ReadGridDimensions(ConstDims.PROJECT_AEDIFICA, GridDims) End Sub #End Region ' Constructor #Region "METHODS" Friend Sub SetCalcRunning(value As Boolean) If value Then m_Calc_Timer.Start() m_bCalcRunning = value End Sub Friend Sub ManageIsEnabled(bIsEnabled As Boolean) Map.refInstrumentPanelVM.SetInstrumentPanelIsEnabled(bIsEnabled) Map.refMainMenuVM.SetMainMenuIsEnabled(bIsEnabled) Map.refPartManagerVM.SetPartManagerIsEnabled(bIsEnabled) Map.refLeftPanelVM.SetLeftPanelIsEnabled(bIsEnabled) If Not IsNothing(Map.refBTLPartManagerVM) Then Map.refBTLPartManagerVM.SetBTLPartManagerIsEnabled(bIsEnabled) Map.refRawPartManagerVM.SetRawPartManagerIsEnabled(bIsEnabled) Map.refOptimizePanelVM.SetOptimizePanelIsEnabled(bIsEnabled) Map.refFeatureManagerVM.SetFeatureManagerIsEnabled(bIsEnabled) End Sub Private Sub Calc_Timer_Tick() If m_bCalcRunning <> m_bLockUX Then ' se calcolo iniziato If m_bCalcRunning Then ManageIsEnabled(False) ' aggiungere gestione colonne editabili delle tabelle If Not IsNothing(Map.refPartListVM.colPart_Do) Then Map.refPartListVM.colPart_Do.IsReadOnly = True End If If Not IsNothing(Map.refPParameterListVM.colPParam_Value) Then Map.refPParameterListVM.colPParam_Value.IsReadOnly = True End If If Not IsNothing(Map.refRawPartListVM.colRawPart_StartCut) Then Map.refRawPartListVM.colRawPart_StartCut.IsReadOnly = True End If If Not IsNothing(Map.refRawPartListVM.colRawPart_W) Then Map.refRawPartListVM.colRawPart_W.IsReadOnly = True End If If Not IsNothing(Map.refRawPartListVM.colRawPart_L) Then Map.refRawPartListVM.colRawPart_L.IsReadOnly = True End If If Not IsNothing(Map.refRawPartListVM.colRawPart_PosZ) Then Map.refRawPartListVM.colRawPart_PosZ.IsReadOnly = True End If If Not IsNothing(Map.refRawPartListVM.colPartInRawPart_Offset) Then Map.refRawPartListVM.colPartInRawPart_Offset.IsReadOnly = True End If If Not IsNothing(Map.refRawPartListVM.colPartInRawPart_Rot) Then Map.refRawPartListVM.colPartInRawPart_Rot.IsReadOnly = True End If If Not IsNothing(Map.refRawPartListVM.colPartInRawPart_Flip) Then Map.refRawPartListVM.colPartInRawPart_Flip.IsReadOnly = True End If If Not IsNothing(Map.refRawPartListVM.colPartInRawPart_PosX) Then Map.refRawPartListVM.colPartInRawPart_PosX.IsReadOnly = True End If If Not IsNothing(Map.refRawPartListVM.colPartInRawPart_PosY) Then Map.refRawPartListVM.colPartInRawPart_PosY.IsReadOnly = True End If If Not IsNothing(Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do) Then Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do.IsReadOnly = True End If m_bLockUX = True ' se calcolo finito Else ManageIsEnabled(True) ' aggiungere gestione colonne editabili delle tabelle If Not IsNothing(Map.refPartListVM.colPart_Do) Then Map.refPartListVM.colPart_Do.IsReadOnly = False Map.refPartListVM.colPart_Do.ResetIsReadOnlyToOrig() End If If Not IsNothing(Map.refPParameterListVM.colPParam_Value) Then Map.refPParameterListVM.colPParam_Value.IsReadOnly = False Map.refPParameterListVM.colPParam_Value.ResetIsReadOnlyToOrig() End If If Not IsNothing(Map.refRawPartListVM.colRawPart_StartCut) Then Map.refRawPartListVM.colRawPart_StartCut.IsReadOnly = False Map.refRawPartListVM.colRawPart_StartCut.ResetIsReadOnlyToOrig() End If If m_BTLStructureVM.nPROJTYPE <> BWType.BEAM AndAlso Not IsNothing(Map.refRawPartListVM.colRawPart_W) Then Map.refRawPartListVM.colRawPart_W.IsReadOnly = False Map.refRawPartListVM.colRawPart_W.ResetIsReadOnlyToOrig() End If If Not IsNothing(Map.refRawPartListVM.colRawPart_L) Then Map.refRawPartListVM.colRawPart_L.IsReadOnly = False Map.refRawPartListVM.colRawPart_L.ResetIsReadOnlyToOrig() End If If Not IsNothing(Map.refRawPartListVM.colRawPart_PosZ) Then Map.refRawPartListVM.colRawPart_PosZ.IsReadOnly = False Map.refRawPartListVM.colRawPart_PosZ.ResetIsReadOnlyToOrig() End If If Not IsNothing(Map.refRawPartListVM.colPartInRawPart_Offset) Then Map.refRawPartListVM.colPartInRawPart_Offset.IsReadOnly = False Map.refRawPartListVM.colPartInRawPart_Offset.ResetIsReadOnlyToOrig() End If If Not IsNothing(Map.refRawPartListVM.colPartInRawPart_Rot) Then Map.refRawPartListVM.colPartInRawPart_Rot.IsReadOnly = False Map.refRawPartListVM.colPartInRawPart_Rot.ResetIsReadOnlyToOrig() End If If Not IsNothing(Map.refRawPartListVM.colPartInRawPart_Flip) Then Map.refRawPartListVM.colPartInRawPart_Flip.IsReadOnly = False Map.refRawPartListVM.colPartInRawPart_Flip.ResetIsReadOnlyToOrig() End If If Not IsNothing(Map.refRawPartListVM.colPartInRawPart_PosX) Then Map.refRawPartListVM.colPartInRawPart_PosX.IsReadOnly = False Map.refRawPartListVM.colPartInRawPart_PosX.ResetIsReadOnlyToOrig() End If If Not IsNothing(Map.refRawPartListVM.colPartInRawPart_PosY) Then Map.refRawPartListVM.colPartInRawPart_PosY.IsReadOnly = False Map.refRawPartListVM.colPartInRawPart_PosY.ResetIsReadOnlyToOrig() End If If Not IsNothing(Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do) Then Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do.IsReadOnly = False Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do.ResetIsReadOnlyToOrig() End If ' fermo il timer If Not m_bCalcRunning Then m_Calc_Timer.Stop() m_bLockUX = False End If End If End If End Sub Friend Sub NotifyAllPanelVisibility() NotifyPropertyChanged(NameOf(FeatureManager_Visibility)) NotifyPropertyChanged(NameOf(ShowBeamPanel_Visibility)) End Sub ''' ''' Funzione che permette di eliminare un pezzo modificato e reinserirlo nell'assemblato ''' Friend Sub UpdatePart(nPartId As Integer) Dim IdAsseBase As Integer = Map.refProdManagerVM.ListProjAsseBase(Map.refProjectVM.BTLStructureVM.SelBTLPart.nPROJ) If IdAsseBase < 0 Then Return Dim IdPart As Integer = 0 Dim NewId As Integer = 0 ' Setto il nuovo contesto EgtSetCurrentContext(Map.refSceneShowBuldingVM.SceneShowBulding.GetCtx()) If Map.refSceneShowBuldingVM.MapInfo.TryGetValue(nPartId, IdPart) Then If EgtBeamGetBuildingIsOn(IdAsseBase) Then EgtBeamShowBuilding(IdAsseBase, False) EgtErase(IdPart) NewId = EgtCopyEx(Map.refSceneHostVM.MainScene.GetCtx(), nPartId, Map.refSceneShowBuldingVM.SceneShowBulding.GetCtx(), 0) EgtChangeId(NewId, IdPart) EgtBeamCalcSolid(IdPart) EgtBeamShowSolid(IdPart, True) EgtBeamShowBuilding(IdAsseBase, True) Else NewId = EgtCopyEx(Map.refSceneHostVM.MainScene.GetCtx(), nPartId, Map.refSceneShowBuldingVM.SceneShowBulding.GetCtx(), 0) Map.refSceneShowBuldingVM.MapInfo.Add(nPartId, NewId) EgtBeamCalcSolid(NewId) EgtBeamShowSolid(NewId, True) EgtZoom(ZM.ALL) End If ' Ritorno al contesto corrente EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx()) End Sub Friend Sub ResetGeneralParameters() Dim sInfo As String = String.Empty For Each PartItem As BTLPartVM In m_BTLStructureVM.BTLPartVMList PartItem.SetStrategyModify_Visibility(False) For Each FeatureItem As BTLFeatureVM In PartItem.BTLFeatureVMList FeatureItem.SetbStrategy_Visibility(False) Next For Each GeneralParameter In m_GeneralParametersList Select Case GeneralParameter.GetType() Case GetType(BooleanGenericParameter) SetbSaveGeneralParameters(False) SetGeneralParametersIsEnable(False) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(DoubleGenericParameter) SetbSaveGeneralParameters(False) SetGeneralParametersIsEnable(False) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(ComboGenericParameter) SetbSaveGeneralParameters(False) SetGeneralParametersIsEnable(False) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(StringGenericParameter) SetbSaveGeneralParameters(False) SetGeneralParametersIsEnable(False) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(ListGenericParameter) For Each Item As ToolParameter In DirectCast(GeneralParameter, ListGenericParameter).ListValue If Item.bIsActive Then sInfo &= Item.sUUID & "," & Item.sName & ";" SetbSaveGeneralParameters(False) SetGeneralParametersIsEnable(False) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge) End If Next EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge & "_FORCED") End Select Next Next End Sub Friend Sub Read(nType As BWType) m_GeneralParametersList.Clear() m_StrategySetupList.Clear() ' leggo cartella dei setup delle strategie Dim AISetupDirPath As String = Map.refMainWindowVM.MainWindowM.GetAISetupDirPath(nType, True) Dim AISetupPaths As String() = Directory.GetFiles(AISetupDirPath).Where(Function(f) Path.GetExtension(f).ToLower() <> ".ini").ToArray() GetStrategySetupDir(AISetupPaths, ProjectManagerVM.CurrProd.nType) ' Leggo info se presenti Dim sStrategyBTLSetup As String = String.Empty Dim sStrategyBTLPartSetup As String = String.Empty Dim sStrategyPartSetup As String = String.Empty Dim sTmpStrategySetup As String = String.Empty Dim nBTLInfoLayerId As Integer = 0 nBTLInfoLayerId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO) EgtGetInfo(nBTLInfoLayerId, AI_SETUP, sStrategyBTLSetup) SetSelStrategy(sStrategyBTLSetup) EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, AI_SETUP, sStrategyBTLPartSetup) If String.IsNullOrWhiteSpace(sStrategyBTLSetup) Then If bSaveGeneralParameters Then EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, AI_SETUP, m_SelStrategySetup) Else SetStrategySetup(sStrategyBTLSetup, AISetupDirPath, sTmpStrategySetup) End If Else SetSelStrategy(sStrategyBTLPartSetup) End If GetGeneralParamtersList(nType) ' Leggo info se presenti Dim sInfo As String = String.Empty For Each GeneralParameter In m_GeneralParametersList Select Case GeneralParameter.GetType() Case GetType(BooleanGenericParameter) Dim sTmpBoolValue As Boolean = False EgtGetInfo(nBTLInfoLayerId, GeneralParameter.sNameNge, sTmpBoolValue) If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then SetGeneralParameters(True) EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, BooleanGenericParameter).bValue) Else DirectCast(GeneralParameter, BooleanGenericParameter).bValue = sTmpBoolValue SetGeneralParameters(False) End If Case GetType(DoubleGenericParameter) Dim sTmpDoubleValue As String = String.Empty EgtGetInfo(nBTLInfoLayerId, GeneralParameter.sNameNge, sTmpDoubleValue) If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then SetGeneralParameters(True) EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, DoubleGenericParameter).sValue) Else DirectCast(GeneralParameter, DoubleGenericParameter).sValue = sTmpDoubleValue SetGeneralParameters(False) End If Case GetType(ComboGenericParameter) Dim sTmpComboValue As String = String.Empty EgtGetInfo(nBTLInfoLayerId, GeneralParameter.sNameNge, sTmpComboValue) Dim sTmpValueInfo As String = String.Empty If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then SetGeneralParameters(True) EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, sTmpValueInfo) DirectCast(GeneralParameter, ComboGenericParameter).SelValue = DirectCast(GeneralParameter, ComboGenericParameter).ComboList.FirstOrDefault(Function(x) x.sValue = sTmpValueInfo) Else DirectCast(GeneralParameter, ComboGenericParameter).SelValue = DirectCast(GeneralParameter, ComboGenericParameter).ComboList.FirstOrDefault(Function(x) x.sValue = sTmpComboValue) SetGeneralParameters(False) End If Case GetType(StringGenericParameter) Dim sTmpStringValue As String = String.Empty EgtGetInfo(nBTLInfoLayerId, GeneralParameter.sNameNge, sTmpStringValue) If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then SetGeneralParameters(True) EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, StringGenericParameter).sValue) Else DirectCast(GeneralParameter, StringGenericParameter).sValue = sTmpStringValue SetGeneralParameters(False) End If Case GetType(ListGenericParameter) For Each Item As ToolParameter In DirectCast(GeneralParameter, ListGenericParameter).ListValue If Item.bIsActive Then sInfo &= Item.sUUID & "," & Item.sName & ";" If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then SetGeneralParameters(True) EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, ListGenericParameter).sValue) Else DirectCast(GeneralParameter, ListGenericParameter).sValue = sInfo SetGeneralParameters(False) End If End If Next End Select Next NotifyPropertyChanged(NameOf(GeneralParametersList)) End Sub Friend Sub CustomGeneralParameters(SelStrategySetupCombo As String) GetGeneralParamtersList(Map.refStrategyManagerVM.SelStrategyType.Id) Dim sAISetupDirPath As String = Map.refMainWindowVM.MainWindowM.GetAISetupDirPath(Map.refStrategyManagerVM.SelStrategyType.Id, False) Dim sStrategyConfigurationFilePath As String = sAISetupDirPath & "\" & SelStrategySetupCombo & ".json" If File.Exists(sStrategyConfigurationFilePath) Then Dim sReadedFile As String = File.ReadAllText(sStrategyConfigurationFilePath) Dim JsonRoot As CustomJsonRoot = Nothing Try JsonRoot = JsonConvert.DeserializeObject(Of CustomJsonRoot)(sReadedFile) Catch ex As Exception JsonRoot = Nothing Return End Try For Each ProjectItem In JsonRoot.GENERAL Dim DefaultProject As ProjectParameters = m_GeneralParametersList.FirstOrDefault(Function(x) x.sName = ProjectItem.sName) If Not IsNothing(DefaultProject) Then DefaultProject.ReadConfiguration(ProjectItem, m_GeneralParametersList) Else EgtOutLog("Parametro Generale: " & ProjectItem.sName & " non presente") End If Next End If ' Leggo info se presenti Dim sInfo As String = String.Empty Dim sDefaultConfig As String = String.Empty EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, AI_SETUP, sDefaultConfig) If SelStrategySetupCombo.Equals(sDefaultConfig) Then For Each GeneralParameter In m_GeneralParametersList Select Case GeneralParameter.GetType() Case GetType(BooleanGenericParameter) Dim sTmpBoolValue As Boolean = DirectCast(GeneralParameter, BooleanGenericParameter).bValue If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, BooleanGenericParameter).bValue) Else DirectCast(GeneralParameter, BooleanGenericParameter).bValue = sTmpBoolValue End If Case GetType(DoubleGenericParameter) Dim sTmpDoubleValue As String = DirectCast(GeneralParameter, DoubleGenericParameter).sValue If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, DoubleGenericParameter).sValue) Else DirectCast(GeneralParameter, DoubleGenericParameter).sValue = sTmpDoubleValue End If Case GetType(ComboGenericParameter) Dim sTmpComboValue As String = DirectCast(GeneralParameter, ComboGenericParameter).SelValue.sValue Dim sTmpValueInfo As String = String.Empty If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, sTmpValueInfo) DirectCast(GeneralParameter, ComboGenericParameter).SelValue = DirectCast(GeneralParameter, ComboGenericParameter).ComboList.FirstOrDefault(Function(x) x.sValue = sTmpValueInfo) Else DirectCast(GeneralParameter, ComboGenericParameter).SelValue.sValue = sTmpComboValue End If Case GetType(StringGenericParameter) Dim sTmpStringValue As String = DirectCast(GeneralParameter, StringGenericParameter).sValue If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, StringGenericParameter).sValue) Else DirectCast(GeneralParameter, StringGenericParameter).sValue = sTmpStringValue End If Case GetType(ListGenericParameter) For Each Item As ToolParameter In DirectCast(GeneralParameter, ListGenericParameter).ListValue If Item.bIsActive Then sInfo &= Item.sUUID & "," & Item.sName & ";" If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, ListGenericParameter).sValue) Else DirectCast(GeneralParameter, ListGenericParameter).sValue = sInfo End If End If Next End Select Next End If NotifyPropertyChanged(NameOf(GeneralParametersList)) End Sub Friend Sub GetGeneralParameters(bValuePart As Boolean) m_StrategySetupList.Clear() ' leggo cartella dei setup delle strategie Dim AISetupDirPath As String = Map.refMainWindowVM.MainWindowM.GetAISetupDirPath(ProjectManagerVM.CurrProd.nType, True) Dim AISetupPaths As String() = Directory.GetFiles(AISetupDirPath).Where(Function(f) Path.GetExtension(f).ToLower() <> ".ini").ToArray() GetStrategySetupDir(AISetupPaths, ProjectManagerVM.CurrProd.nType) GetGeneralParamtersList(Map.refStrategyManagerVM.SelStrategyType.Id) ' Leggo info se presenti Dim sInfo As String = String.Empty Dim sStrategyBTLSetup As String = String.Empty Dim sTmpStrategySetup As String = String.Empty Dim nBTLInfoLayerId As Integer = 0 If bValuePart Then If m_SelStrategySetup Is String.Empty Then nBTLInfoLayerId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO) EgtGetInfo(nBTLInfoLayerId, AI_SETUP, m_SelStrategySetup) Else EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, AI_SETUP, m_SelStrategySetup) End If Else nBTLInfoLayerId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO) EgtGetInfo(nBTLInfoLayerId, AI_SETUP, sStrategyBTLSetup) If IsNothing(sStrategyBTLSetup) Then SetStrategySetup(sStrategyBTLSetup, AISetupDirPath, sTmpStrategySetup) Else SetSelStrategy(sStrategyBTLSetup) EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, AI_SETUP, m_SelStrategySetup) End If End If For Each GeneralParameter In m_GeneralParametersList Select Case GeneralParameter.GetType() Case GetType(BooleanGenericParameter) Dim sTmpBoolValue As Boolean = DirectCast(GeneralParameter, BooleanGenericParameter).bValue If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then SetGeneralParameters(True) EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, BooleanGenericParameter).bValue) Else DirectCast(GeneralParameter, BooleanGenericParameter).bValue = sTmpBoolValue SetGeneralParameters(False) End If Case GetType(DoubleGenericParameter) Dim sTmpDoubleValue As String = DirectCast(GeneralParameter, DoubleGenericParameter).sValue If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then SetGeneralParameters(True) EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, DoubleGenericParameter).sValue) Else DirectCast(GeneralParameter, DoubleGenericParameter).sValue = sTmpDoubleValue SetGeneralParameters(False) End If Case GetType(ComboGenericParameter) Dim sTmpComboValue As String = DirectCast(GeneralParameter, ComboGenericParameter).SelValue.sValue Dim sTmpValueInfo As String = String.Empty If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then SetGeneralParameters(True) EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, sTmpValueInfo) DirectCast(GeneralParameter, ComboGenericParameter).SelValue = DirectCast(GeneralParameter, ComboGenericParameter).ComboList.FirstOrDefault(Function(x) x.sValue = sTmpValueInfo) Else DirectCast(GeneralParameter, ComboGenericParameter).SelValue.sValue = sTmpComboValue SetGeneralParameters(False) End If Case GetType(StringGenericParameter) Dim sTmpStringValue As String = DirectCast(GeneralParameter, StringGenericParameter).sValue If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then SetGeneralParameters(True) EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, StringGenericParameter).sValue) Else DirectCast(GeneralParameter, StringGenericParameter).sValue = sTmpStringValue SetGeneralParameters(False) End If Case GetType(ListGenericParameter) For Each Item As ToolParameter In DirectCast(GeneralParameter, ListGenericParameter).ListValue If Item.bIsActive Then sInfo &= Item.sUUID & "," & Item.sName & ";" If EgtExistsInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) Then SetGeneralParameters(True) EgtGetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, ListGenericParameter).sValue) Else DirectCast(GeneralParameter, ListGenericParameter).sValue = sInfo SetGeneralParameters(False) End If End If Next End Select Next NotifyPropertyChanged(NameOf(SelStrategySetup)) NotifyPropertyChanged(NameOf(GeneralParametersList)) End Sub Private Sub GetStrategySetupDir(AISetupPaths As String(), nType As BWType) For Each AiSetup In AISetupPaths m_StrategySetupList.Add(Path.GetFileNameWithoutExtension(AiSetup)) Next End Sub Private Sub GetGeneralParamtersList(nTypeId As BWType) Dim sStrategiesDirPath As String = Map.refMainWindowVM.MainWindowM.GetStrategiesDirPath(nTypeId) Dim sGeneralParametersFilePath As String = sStrategiesDirPath & "\" & GENERALPARAMETERS_FILE & ".json" If File.Exists(sGeneralParametersFilePath) Then Dim sReadedFiles As String = File.ReadAllText(sGeneralParametersFilePath) Dim JsonGeneralParametersList As List(Of JsonGeneralParameters) = JsonConvert.DeserializeObject(Of List(Of JsonGeneralParameters))(sReadedFiles) m_GeneralParametersList = New ObservableCollection(Of ProjectParameters)((From JsonGeneralParameter In JsonGeneralParametersList Select JsonGeneralParameter.Deserialize(Map.refStrategyManagerVM.SelStrategyType.Id)).ToList()) UserLevelControl(m_GeneralParametersList) End If End Sub Private Sub UserLevelControl(GeneralParametersList As ObservableCollection(Of ProjectParameters)) For Each GenericItem As ProjectParameters In GeneralParametersList Select Case GenericItem.sMinUserLevel Case UserLevel.ADVANCED Map.refMainMenuVM.UserLevelGenericVisibility(GenericItem, If(Map.refMainMenuVM.UserAdmin_IsChecked, True, False)) Case UserLevel.ADMINISTRATOR Map.refMainMenuVM.UserLevelGenericVisibility(GenericItem, If(Map.refMainMenuVM.UnlockAllIsChecked, True, False)) Case Else If Not Map.refMainMenuVM.UserAdmin_IsChecked Then Map.refMainMenuVM.UserLevelGenericVisibility(GenericItem, If(GenericItem.sMinUserLevel = UserLevel.USER, True, False)) Map.refMainMenuVM.SetUnloackImage(PADLOCK_IMAGE) End If End Select Next End Sub Private Sub SetGeneralParameters(bValue As Boolean) SetbSaveGeneralParameters(bValue) SetGeneralParametersIsEnable(bValue) End Sub Private Sub SetStrategySetup(sStrategyBTLSetup As String, AISetupDirPath As String, sTmpStrategySetup As String) If EgtUILib.GetPrivateProfileString(S_STRATEGY, K_DEFAULTCONFIG, "", sStrategyBTLSetup, Map.refMainWindowVM.MainWindowM.sDefaultConfig) <> 0 Then SetSelStrategy(sStrategyBTLSetup) EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, AI_SETUP, m_SelStrategySetup) Else ' restituisce la lista dei file presenti nella cartella con le relative informazioni Dim StrategySetupListFile As List(Of FileInfo) = m_StrategySetupList.Where(Function(f) File.Exists(AISetupDirPath & "\" & f & ".json")). Select(Function(f) New FileInfo(AISetupDirPath & "\" & f & ".json")). OrderByDescending(Function(fi) fi.LastWriteTime).ToList() ' restituisce l'ultimo file modificato If StrategySetupListFile.Any() Then sStrategyBTLSetup = Path.GetFileNameWithoutExtension(StrategySetupListFile.First().Name) End If sTmpStrategySetup = m_StrategySetupList.FirstOrDefault(Function(x) x = sStrategyBTLSetup) SetSelStrategy(sTmpStrategySetup) EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, AI_SETUP, m_SelStrategySetup) End If End Sub #End Region ' Methods #Region "COMMAND" #Region "Ottimization" Public ReadOnly Property Optimizer_Command As ICommand Get If m_cmdOptimizer Is Nothing Then m_cmdOptimizer = New Command(AddressOf Optimizer) End If Return m_cmdOptimizer End Get End Property Friend Sub Optimizer() Dim StatisticWndV As New StatisticWndV(Application.Current.MainWindow, New StatisticsVM()) StatisticWndV.ShowDialog() End Sub #End Region ' Ottimization #Region "Parameter" Public ReadOnly Property Parameter_Command As ICommand Get If m_cmdParameter Is Nothing Then m_cmdParameter = New Command(AddressOf Parameter) End If Return m_cmdParameter End Get End Property Friend Sub Parameter() Dim PartParametersWnd As New PartParametersWndV(Application.Current.MainWindow, New PartParametersWndVM()) PartParametersWnd.ShowDialog() End Sub #End Region ' Parameter #Region "Back_Command" Public ReadOnly Property Back_Command As ICommand Get If m_cmdBack Is Nothing Then m_cmdBack = New Command(AddressOf Back) End If Return m_cmdBack End Get End Property Public Sub Back() SetRawPartManagerVisibility(True) If Not IsNothing(m_MachGroupPanelVM) Then Map.refProjectVM.SetFeatureListVisibility(True) SetStrategyManagerVisibility(False) SetSelManagerTab(ProjectVM.StrategyManagerTab.RAWPARTMANAGER) SetSelFeatureManagerTab(ProjectVM.FeatureManagerTab.FEATURERAWPARTMANAGER) ' Abilito LeftPanel SetLeftPanel_IsEnabled(True) SetLeftPanel_Opacity(1) End Sub #End Region ' Cancel_Command #Region "Ok_Command" Public ReadOnly Property Ok_Command As ICommand Get If m_cmdOk_Command Is Nothing Then m_cmdOk_Command = New Command(AddressOf Ok) End If Return m_cmdOk_Command End Get End Property Public Sub Ok() NotifyPropertyChanged(NameOf(GeneralParametersList)) If m_SelStrategySetup Is String.Empty Then Dim nBTLInfoLayerId As Integer = 0 nBTLInfoLayerId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO) EgtGetInfo(nBTLInfoLayerId, AI_SETUP, m_SelStrategySetup) EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, AI_SETUP, m_SelStrategySetup) Else EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, AI_SETUP, m_SelStrategySetup) End If Dim sInfo As String = String.Empty If m_bSaveGeneralParameters Then For Each GeneralParameter In m_GeneralParametersList Select Case GeneralParameter.GetType() Case GetType(BooleanGenericParameter) EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, BooleanGenericParameter).bValue) EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, BooleanGenericParameter).bIsBooleanModify) Case GetType(DoubleGenericParameter) EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, DoubleGenericParameter).sValue) EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, DoubleGenericParameter).bIsDoubleModify) Case GetType(ComboGenericParameter) EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, ComboGenericParameter).SelValue.sValue) EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, ComboGenericParameter).bIsComboBoxModify) Case GetType(StringGenericParameter) EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, StringGenericParameter).sValue) EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, StringGenericParameter).bIsStringModify) Case GetType(ListGenericParameter) For Each Item As ToolParameter In DirectCast(GeneralParameter, ListGenericParameter).ListValue If Item.bIsActive Then sInfo &= Item.sUUID & "," & Item.sName & ";" EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, sInfo) End If Next EgtSetInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, ListGenericParameter).bIsListModify) End Select Next Else For Each GeneralParameter In m_GeneralParametersList Select Case GeneralParameter.GetType() Case GetType(BooleanGenericParameter) EgtRemoveInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(DoubleGenericParameter) EgtRemoveInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(ComboGenericParameter) EgtRemoveInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(StringGenericParameter) EgtRemoveInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(ListGenericParameter) For Each Item As ToolParameter In DirectCast(GeneralParameter, ListGenericParameter).ListValue If Item.bIsActive Then sInfo &= Item.sUUID & "," & Item.sName & ";" EgtRemoveInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) End If Next EgtRemoveInfo(m_BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED") End Select Next m_BTLStructureVM.SelBTLPart.SetStrategyModify_Visibility(False) End If If Map.refProjectVM.BTLStructureVM.SelBTLPart.nGlobalState <> CalcStates.NOTCALCULATED Then ' Resetto info If MyExecProcessManager.sInfoNgePartList.Count > 0 Then For Each InfoNgePart As String In MyExecProcessManager.sInfoNgePartList Dim sInfoNgePart As String() = InfoNgePart.Split("="c) EgtRemoveInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.nPartId, sInfoNgePart(0)) Next End If Map.refProjectVM.BTLStructureVM.SelBTLPart.ResetCalcPart() If Not IsNothing(m_BTLStructureVM.SelBTLPart.SelBTLFeatureVM) Then m_BTLStructureVM.SelBTLPart.SelBTLFeatureVM.ResetCalcFeature() End If If Map.refProdManagerVM.ListProjAsseBase.Count > 0 Then UpdatePart(m_BTLStructureVM.SelBTLPart.nPartId) SetRawPartManagerVisibility(True) SetStrategyManagerVisibility(False) SetSelManagerTab(ProjectVM.StrategyManagerTab.RAWPARTMANAGER) SetSelFeatureManagerTab(ProjectVM.FeatureManagerTab.FEATURERAWPARTMANAGER) ' Abilito LeftPanel SetLeftPanel_IsEnabled(True) SetLeftPanel_Opacity(1) Map.refSceneHostVM.SaveProject() End Sub #End Region ' Ok_Command #End Region ' Command End Class