Imports System.Collections.ObjectModel Imports EgtBEAMWALL.Core Imports EgtUILib Imports EgtWPFLib5 Public Class ElementLayerTreeViewVM Inherits VMBase #Region "FIELDS & PROPERTIES" Friend CodeCommand As Boolean = False Private m_IsEnabled As Boolean Public Property IsEnabled As Boolean Get Return m_IsEnabled End Get Set(value As Boolean) If value <> m_IsEnabled Then 'Map.refMachiningOptionPanelVM.Set_IsExpanded(MachiningOptionPanelVM.MachiningOptionPanelExpander.NEWMACHININGS, value) End If End Set End Property ' Lista delle lavorazioni Private m_ElementLayersList As New ObservableCollection(Of FamilyElementLayerTreeViewItem) Public Property ElementLayersList As ObservableCollection(Of FamilyElementLayerTreeViewItem) Get Return m_ElementLayersList End Get Set(value As ObservableCollection(Of FamilyElementLayerTreeViewItem)) m_ElementLayersList = value End Set End Property Public ReadOnly Property LayersWallPage_Visibility As Visibility Get Return If(Map.refMainMenuVM.SelPage = Pages.LAYERSWALL, Visibility.Visible, Visibility.Collapsed) End Get End Property ' Operazione correntemente selezionata, che permette di aggiungere al posto giusto quella nuova Friend nSelectedOperationId As Integer = GDB_ID.NULL 'Public ReadOnly Property MachListHdr As String ' Get ' Return EgtMsg(MSG_OPERATION + 12) ' Nuove Lavorazioni ' End Get 'End Property ' Definizione comandi Private m_cmdTreeViewDoubleClick As ICommand Private m_cmdCancelNew As ICommand #End Region #Region "CONSTRUCTOR" Sub New() Map.SetRefElementLayerTreeViewVM(Me) ' Per caricare l'albero la prima volta che viene aperto IsEnabled = False 'LoadSelectedMachineMachinings() End Sub #End Region #Region "COMMANDS" #End Region ' Commands #Region "METHODS" Friend Function InitMachiningTreeExpander() As Boolean 'm_IsEnabled = True 'Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = False 'Map.refSimulationExpanderVM.Simulation_IsEnabled = False 'Map.refEstimationsExpanderVM.Estimation_IsEnabled = False '' Abilito la selezione delle geometrie di lavorazione 'Map.refProjectVM.SceneSelType = SceneSelTypeOpt.MACHINING '' Abilito la selezione di curve e superfici del pezzo 'Map.refProjectVM.SceneSelMode = SceneSelModeOpt.ALL 'CodeCommand = False 'OnPropertyChanged("IsEnabled") Return True End Function Friend Function ExitMachiningTreeExpander() As Boolean 'm_IsEnabled = False 'Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = True 'Map.refSimulationExpanderVM.Simulation_IsEnabled = True 'Map.refEstimationsExpanderVM.Estimation_IsEnabled = True 'If Not CodeCommand Then ' Map.refOperationsListExpanderVM.CancelOperationCmd() ' CodeCommand = False ' OnPropertyChanged("IsEnabled") ' Return False 'End If 'CodeCommand = False 'OnPropertyChanged("IsEnabled") Return True End Function ''' ''' Method that search the machines in the correct folder and add to the MachinesList those valid. ''' Private Sub LoadSelectedMachineMachinings() 'Dim ActiveMachiningsTypes() As MachiningsType = MachineModel.ReadActiveMachiningsFamilies() 'For Each MachiningsType In ActiveMachiningsTypes ' Dim FamilyTreeView As New FamilyMachiningTreeViewExpanderItem(MachiningsType.TypeName, MachiningsType.TypeId) ' MachiningsList.Add(FamilyTreeView) ' Dim MachiningName As String = String.Empty ' Dim MachiningToolName As String = String.Empty ' EgtMdbGetFirstMachining(MachiningsType.TypeId, MachiningName) ' While Not String.IsNullOrEmpty(MachiningName) ' EgtMdbSetCurrMachining(MachiningName) ' EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, MachiningToolName) ' FamilyTreeView.Items.Add(New MachiningTreeViewExpanderItem(MachiningName, MachiningsType.TypeId, MachiningToolName)) ' EgtMdbGetNextMachining(MachiningsType.TypeId, MachiningName) ' End While 'Next '' Se esiste almeno una famiglia di lavorazioni, la seleziono 'If MachiningsList.Count > 0 Then ' MachiningsList(0).IsSelected = True ' MachiningsList(0).NotifyPropertyChanged("IsSelected") 'End If Dim ActiveMachiningsTypes() As String = {"A", "B", "C"} For Each MachiningsType In ActiveMachiningsTypes Dim FamilyTreeView As New FamilyElementLayerTreeViewItem(MachiningsType) ElementLayersList.Add(FamilyTreeView) Dim MachiningName As String = "1" FamilyTreeView.Items.Add(New ElementLayerTreeViewItem(MachiningName, MachiningsType)) Next ' Se esiste almeno una famiglia di lavorazioni, la seleziono If ElementLayersList.Count > 0 Then ElementLayersList(0).IsSelected = True ElementLayersList(0).NotifyPropertyChanged("IsSelected") End If End Sub Friend Sub UpdateOperationMachiningList() m_ElementLayersList.Clear() LoadSelectedMachineMachinings() End Sub #End Region End Class