Imports System.ComponentModel Imports EgtUILib Public Class OperationListBoxItem Implements INotifyPropertyChanged Friend m_Type As Integer Public ReadOnly Property Type As Integer Get Return m_Type End Get End Property Friend m_Id As Integer Public ReadOnly Property Id As Integer Get Return m_Id End Get End Property Private m_Name As String Public Property Name As String Get Return m_Name End Get Set(value As String) m_Name = value End Set End Property Private m_IsSelected As Boolean Public Property IsSelected As Boolean Get Return m_IsSelected End Get Set(value As Boolean) If Not IsNothing(value) Then Dim indexes As List(Of OperationListBoxItem) = New List(Of OperationListBoxItem) Dim Count As Integer = 0 For Each OperationListBoxItem In Map.refOperationsListExpanderVM.OperationList If OperationListBoxItem.IsSelected And OperationListBoxItem.Id <> m_Id Then Count = Count + 1 indexes.Add(OperationListBoxItem) End If Next If indexes.Count > 0 Then If EgtGetOperationPhase(Id) <> EgtGetOperationPhase(indexes(0).Id) Then Return End If End If m_IsSelected = value ' Verifico se c'è l'operazione precedente If Not value Or indexes.Any(Function(i) i.Type = MCH_OY.DISP) Or (Not indexes.Any(Function(i) i.Type = MCH_OY.DISP) And Type = MCH_OY.DISP And Count > 0) Then m_IsSelected = False ' La de-evidenzio Dim bEnabModif As Boolean = EgtGetEnableModified() EgtDisableModified() EgtResetMark(EgtGetFirstNameInGroup(Id, MCH_MGR_CL)) EgtResetMark(EgtGetFirstNameInGroup(Id, MCH_MGR_DBL)) EgtSetStatus(EgtGetFirstNameInGroup(Id, MCH_MGR_AUXVIEW), GDB_ST.OFF) SelData.ClearIdSub() If bEnabModif Then EgtEnableModified() ' Ne deseleziono la geometria EgtDeselectAll() Map.refOperationsListExpanderVM.OnPropertyChanged(NameOf(Map.refOperationsListExpanderVM.MoveUp_IsEnabled)) Map.refOperationsListExpanderVM.OnPropertyChanged(NameOf(Map.refOperationsListExpanderVM.MoveDown_IsEnabled)) NotifyPropertyChanged(NameOf(IsSelected)) ' Aggiorno visualizzazione EgtDraw() Return End If ' Imposto la fase di lavorazione corrente EgtSetCurrPhase(EgtGetOperationPhase(Id)) ' Abilito la selezione dei Percorsi di Lavorazione Map.refProjectVM.SceneSelType = SceneSelTypeOpt.MACHPATH ' Abilito la selezione delle curve Map.refProjectVM.SceneSelMode = SceneSelModeOpt.ALL ' Se l'operazione è una disposizione If EgtGetOperationType(Id) = MCH_OY.DISP Then ' Altrimenti è una lavorazione Else ' Imposto come corrente la lavorazione selezionata EgtSetCurrMachining(Id) ' Evidenzio la lavorazione(operazione) selezionata Dim bEnabModif As Boolean = EgtGetEnableModified() EgtDisableModified() EgtSetMark(EgtGetFirstNameInGroup(Id, MCH_MGR_CL)) EgtSetMark(EgtGetFirstNameInGroup(Id, MCH_MGR_DBL)) EgtSetStatus(EgtGetFirstNameInGroup(Id, MCH_MGR_AUXVIEW), GDB_ST.ON_) If bEnabModif Then EgtEnableModified() ' Seleziono la geometria della lavorazione SelData.ClearIdSub() Dim CountIndex As Integer = 0 Dim EntityIndex As Integer = 0 Dim SubEntityIndex As Integer = 0 While EgtGetMachiningGeometry(CountIndex, EntityIndex, SubEntityIndex) EgtSelectObj( EntityIndex) If EgtGetType( EntityIndex) = GDB_TY.SRF_MESH Or EgtGetType( EntityIndex) = GDB_TY.SRF_FRGN Then SelData.AddIdSub(EntityIndex, SubEntityIndex) End If CountIndex += 1 End While End If ' Notifico al contentcontrol OperationParameter di aggiornarsi If Not IsNothing( Map.refOperationParametersExpanderVM) Then Map.refOperationParametersExpanderVM.OnPropertyChanged(NameOf(Map.refOperationParametersExpanderVM.OperationParameters)) End If Map.refOperationsListExpanderVM.OnPropertyChanged(NameOf(Map.refOperationsListExpanderVM.MoveUp_IsEnabled)) Map.refOperationsListExpanderVM.OnPropertyChanged(NameOf(Map.refOperationsListExpanderVM.MoveDown_IsEnabled)) ' Notifico l'operazione selezionata all'expander con l'albero delle lavorazioni aggiungibili If Not IsNothing( Map.refMachiningTreeExpanderVM) Then Map.refMachiningTreeExpanderVM.nSelectedOperationId = Me.Id End If ' Aggiorno visualizzazione EgtDraw() End If Map.refOperationsListExpanderVM.OnPropertyChanged(NameOf(Map.refOperationsListExpanderVM.DuplicateCmd_IsEnabled)) Map.refOperationsListExpanderVM.OnPropertyChanged(NameOf(Map.refOperationsListExpanderVM.MachToDb_IsEnabled)) Map.refOperationsListExpanderVM.OnPropertyChanged(NameOf(Map.refOperationsListExpanderVM.Rename_IsEnabled)) NotifyPropertyChanged(NameOf(IsSelected)) End Set End Property Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged Public Sub NotifyPropertyChanged(propName As String) RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) End Sub End Class