Files
EgtCAM5/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/OperationListBoxItem.vb
T
Renzo Lanza 7eb8240749 EgtCAM5 2.2i2 :
- MachGroupPanelVM, MachinePanelVM, StatusBarVM spostati in EgtWPFLib5. Ora qua sono presenti le versioni My_ che ereditano quelle della Libreria. 
- ComboBox della Macchina corrente spostata in MachinePanel (accanto a Db Ut./Lav./SetUp). 
- modificato OptionPanel in modo da gestire i nuovi DrawOptionPanel e MachiningOptionPanel in base alle modalità DISEGNA e LAVORA. 
- ogni Expander di MachiningOptionPanel ora ha il suo VM e il suo V. 
- nuova gestione degli Expander di MachiningOptionPanel tramite funzioni Init e Exit. 
- barra TOPTRAY ora può estendersi su una seconda riga in base a larghezza finestra. 
- eliminati molti Application.Msn.Register/NotifyColleagues. Ora le funzioni che chiamavano sono chiamate tramite i riferimenti in Map. 
- corretta selezione superfici quando si sceglie Nuova Lav. in LAVORA.
2020-09-14 09:42:54 +00:00

136 lines
5.6 KiB
VB.net

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))
SelData.ClearIdSub()
If bEnabModif Then EgtEnableModified()
' Ne deseleziono la geometria
EgtDeselectAll()
Map.refOperationsListExpanderVM.OnPropertyChanged("MoveUp_IsEnabled")
Map.refOperationsListExpanderVM.OnPropertyChanged("MoveDown_IsEnabled")
NotifyPropertyChanged("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
'' 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 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
Map.refOperationParametersExpanderVM.OnPropertyChanged("OperationParameters")
Map.refOperationsListExpanderVM.OnPropertyChanged("MoveUp_IsEnabled")
Map.refOperationsListExpanderVM.OnPropertyChanged("MoveDown_IsEnabled")
' Notifico l'operazione selezionata all'expander con l'albero delle lavorazioni aggiungibili
Map.refMachiningTreeExpanderVM.nSelectedOperationId = Me.Id
' Aggiorno visualizzazione
EgtDraw()
End If
'OnPropertyChanged("ToolExpanderHeader")
Map.refOperationsListExpanderVM.OnPropertyChanged("DuplicateCmd_IsEnabled")
Map.refOperationsListExpanderVM.OnPropertyChanged("MachToDb_IsEnabled")
Map.refOperationsListExpanderVM.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