Imports System.ComponentModel Imports EgtUILib Public Class OperationListBoxItem Implements INotifyPropertyChanged Friend Shared m_RefOperationExpanderVM As OperationExpanderVM 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 m_RefOperationExpanderVM.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)) If bEnabModif Then EgtEnableModified() ' Ne deseleziono la geometria EgtDeselectAll() m_RefOperationExpanderVM.OnPropertyChanged("MoveUp_IsEnabled") m_RefOperationExpanderVM.OnPropertyChanged("MoveDown_IsEnabled") NotifyPropertyChanged("IsSelected") ' Aggiorno visualizzazione EgtDraw() Return End If ' Imposto la fase di lavorazione corrente EgtSetCurrPhase(EgtGetOperationPhase(Id)) ' Se l'operazione è una disposizione If EgtGetOperationType(Id) = MCH_OY.DISP Then ' Abilito la selezione delle Fixture Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE) ' Abilito la selezione di tutti i tipi di geometria Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.ALL) ' 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)) 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 Then SelData.AddIdSub(EntityIndex, SubEntityIndex) End If CountIndex += 1 End While End If ' Notifico al contentcontrol OperationParameter di aggiornarsi m_RefOperationExpanderVM.OnPropertyChanged("OperationParameters") m_RefOperationExpanderVM.OnPropertyChanged("MoveUp_IsEnabled") m_RefOperationExpanderVM.OnPropertyChanged("MoveDown_IsEnabled") ' Notifico l'operazione selezionata all'expander con l'albero delle lavorazioni aggiungibili Application.Msn.NotifyColleagues(Application.SELECTEDOPERATION, Me) ' Aggiorno visualizzazione EgtDraw() End If 'OnPropertyChanged("ToolExpanderHeader") m_RefOperationExpanderVM.OnPropertyChanged("DuplicateCmd_IsEnabled") m_RefOperationExpanderVM.OnPropertyChanged("MachToDb_IsEnabled") m_RefOperationExpanderVM.OnPropertyChanged("Rename_IsEnabled") NotifyPropertyChanged("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