Imports System.Collections.ObjectModel Imports System.IO Imports System.Windows.Threading Imports EgtBEAMWALL.Core Imports EgtUILib Imports EgtWPFLib5 Imports Newtonsoft.Json Public Class ProjectVM Inherits VMBase #Region "FIELDS & PROPERTIES" 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 Visibility) m_FeatureList_Visibility = bVisible 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 Visibility) m_RawPartManagerVisibility = bVisible 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 Visibility) m_StrategyManagerVisibility = bVisible 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 Visibility) m_SceneShowBuldingVisibility = bVisible 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 Visibility) m_ManagerTabVisibility = bVisible 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(Visibility.Visible) Else SetGeneralParametersIsEnable(False) Map.refProjectVM.BTLStructureVM.SelBTLPart.SetStrategyModify_Visibility(Visibility.Collapsed) 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 EgtSetInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, AI_SETUP, value) Map.refStrategyManagerVM.SelStrategySetup.sName = value Map.refStrategyManagerVM.SelStrategySetup.Read() Map.refSceneHostVM.SaveProject() End If m_SelStrategySetup = value NotifyPropertyChanged(NameOf(SelStrategySetup)) End Set End Property #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) 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() Dim IdAsseBase As Integer = Map.refProdManagerVM.ListProjAsseBase(Map.refProjectVM.BTLStructureVM.SelBTLPart.nPROJ) Dim IdPart As Integer = Map.refSceneShowBuldingVM.MapInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId) ' Setto il nuovo contesto EgtSetCurrentContext(Map.refSceneShowBuldingVM.SceneShowBulding.GetCtx()) If EgtBeamGetBuildingIsOn(IdAsseBase) Then EgtBeamShowBuilding(IdAsseBase, False) EgtErase(IdPart) Dim NewId As Integer = EgtCopyEx(Map.refSceneHostVM.MainScene.GetCtx(), Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, Map.refSceneShowBuldingVM.SceneShowBulding.GetCtx(), 0) EgtChangeId(NewId, IdPart) EgtBeamCalcSolid(IdPart) EgtBeamShowSolid(IdPart, True) EgtBeamShowBuilding(IdAsseBase, True) ' 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 Map.refProjectVM.BTLStructureVM.BTLPartVMList For Each GeneralParameter In m_GeneralParametersList Select Case GeneralParameter.GetType() Case GetType(BooleanGenericParameter) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(DoubleGenericParameter) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(ComboGenericParameter) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(StringGenericParameter) 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 & ";" EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge) End If Next EgtRemoveInfo(PartItem.nPartId, GeneralParameter.sNameNge & "_FORCED") End Select Next Next 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() Map.refProjectVM.SetRawPartManagerVisibility(Visibility.Visible) If Not IsNothing(Map.refProjectVM.MachGroupPanelVM) Then Map.refProjectVM.SetFeatureListVisibility(Visibility.Visible) Map.refProjectVM.SetStrategyManagerVisibility(Visibility.Collapsed) Map.refProjectVM.SetSelManagerTab(ProjectVM.StrategyManagerTab.RAWPARTMANAGER) Map.refProjectVM.SetSelFeatureManagerTab(ProjectVM.FeatureManagerTab.FEATURERAWPARTMANAGER) ' Abilito LeftPanel Map.refProjectVM.SetLeftPanel_IsEnabled(True) Map.refProjectVM.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() Dim sInfo As String = String.Empty If m_bSaveGeneralParameters Then For Each GeneralParameter In m_GeneralParametersList Select Case GeneralParameter.GetType() Case GetType(BooleanGenericParameter) EgtSetInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, BooleanGenericParameter).bValue) EgtSetInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, BooleanGenericParameter).bIsBooleanModify) Case GetType(DoubleGenericParameter) EgtSetInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, DoubleGenericParameter).sValue) EgtSetInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, DoubleGenericParameter).bIsDoubleModify) Case GetType(ComboGenericParameter) EgtSetInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, ComboGenericParameter).SelValue.sValue) EgtSetInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, ComboGenericParameter).bIsComboBoxModify) Case GetType(StringGenericParameter) EgtSetInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, StringGenericParameter).sValue) EgtSetInfo(Map.refProjectVM.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(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge, sInfo) End If Next EgtSetInfo(Map.refProjectVM.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(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(DoubleGenericParameter) EgtRemoveInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(ComboGenericParameter) EgtRemoveInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED") Case GetType(StringGenericParameter) EgtRemoveInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) EgtRemoveInfo(Map.refProjectVM.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(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge) End If Next EgtRemoveInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, GeneralParameter.sNameNge & "_FORCED") End Select Next Map.refProjectVM.BTLStructureVM.SelBTLPart.SetStrategyModify_Visibility(Visibility.Collapsed) End If Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM.ResetCalcFeature() Map.refProjectVM.BTLStructureVM.SelBTLPart.ResetCalcPart() If Map.refProdManagerVM.ListProjAsseBase.Count > 0 Then UpdatePart() Map.refProjectVM.SetRawPartManagerVisibility(Visibility.Visible) Map.refProjectVM.SetStrategyManagerVisibility(Visibility.Collapsed) Map.refProjectVM.SetSelManagerTab(ProjectVM.StrategyManagerTab.RAWPARTMANAGER) Map.refProjectVM.SetSelFeatureManagerTab(ProjectVM.FeatureManagerTab.FEATURERAWPARTMANAGER) ' Abilito LeftPanel Map.refProjectVM.SetLeftPanel_IsEnabled(True) Map.refProjectVM.SetLeftPanel_Opacity(1) Map.refSceneHostVM.SaveProject() End Sub #End Region ' Ok_Command #End Region ' Command End Class