diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/MachiningOpListBoxItem.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/MachiningOpListBoxItem.vb index bd7587c..b31e65e 100644 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/MachiningOpListBoxItem.vb +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/MachiningOpListBoxItem.vb @@ -1,4 +1,5 @@ -Imports EgtUILib +Imports System.Collections.ObjectModel +Imports EgtUILib Public Class MachiningOpListBoxItem Inherits OperationListBoxItem @@ -124,6 +125,7 @@ Public Class MachiningOpListBoxItem End Get End Property + Private m_bOnOff As Boolean = True Public Property OnOff As Boolean Get @@ -132,14 +134,16 @@ Public Class MachiningOpListBoxItem Set(value As Boolean) If m_bOnOff <> value Then m_bOnOff = value + Dim bOldEnMod As Boolean = EgtGetEnableModified() + EgtDisableModified() ' se abilitato, eseguo operazione + Dim status As Integer = GDB_ST.OFF If value Then - ModifyStatus() - EgtSetStatus(Id, GDB_ST.ON_) - Else - ModifyStatus() - EgtSetStatus(Id, GDB_ST.OFF) + status = GDB_ST.ON_ End If + ModifyStatusLamp() + EgtSetStatus(Id, status) + If bOldEnMod Then EgtEnableModified() EgtDraw() End If NotifyPropertyChanged(NameOf(OnOff)) @@ -198,7 +202,7 @@ Public Class MachiningOpListBoxItem End Select End Function - Private Sub ModifyStatus() + Private Sub ModifyStatusLamp() ' Recupero l'indice dell'operazione a cui abbiamo appena modificato lo Status e l'indice della Disposizione che la contiene Dim DispIndex As Integer = 0 Dim OpIndex As Integer = 0 diff --git a/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb index 3217d73..9982d79 100644 --- a/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb +++ b/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb @@ -84,11 +84,7 @@ Public Class OperationsListExpanderVM Set(value As Boolean) If value <> m_ListIsExpanded Then Map.refMachiningOptionPanelVM.Set_IsExpanded(MachiningOptionPanelVM.MachiningOptionPanelExpander.OPERATIONLIST, value) - If Not IsNothing(tmpOperationList) Then - For Each ItemOp As MachiningOpListBoxItem In tmpOperationList - If ItemOp.Status Then ItemOp.OnOff = False - Next - End If + SetStatusOnLamp() End If End Set End Property @@ -273,7 +269,7 @@ Public Class OperationsListExpanderVM #Region "CONSTRUCTOR" Sub New() - m_bMoveThroughDisps = ( GetPrivateProfileInt( S_MACH, K_MOVETHROUGHDISPS, 0) <> 0) + m_bMoveThroughDisps = (GetPrivateProfileInt(S_MACH, K_MOVETHROUGHDISPS, 0) <> 0) ' Creo riferimento a questa classe in Map Map.SetRefOperationsListExpanderVM(Me) Me.ListIsExpanded = True @@ -348,7 +344,7 @@ Public Class OperationsListExpanderVM For Each nId As Integer In vRawId EgtKeepRawPart(nId, nLastPhase) Next - EgtKeepAllDispAxes( nLastPhase) + EgtKeepAllDispAxes(nLastPhase) For Each nId As Integer In vFxtId EgtKeepFixture(nId, nLastPhase) Next @@ -450,7 +446,7 @@ Public Class OperationsListExpanderVM If EgtGetOperationMode(selOperation.Id) Then Map.refOperationParametersExpanderVM.ParametersIsExpanded = True If EgtGetOperationType(selOperation.Id) <> MCH_OY.DISP Then - Map.refMachiningParameterExpanderVM.SetSliderScale( EgtGetPreviewMachiningToolStepCount()) + Map.refMachiningParameterExpanderVM.SetSliderScale(EgtGetPreviewMachiningToolStepCount()) Map.refMachiningParameterExpanderVM.ResetSliderValue() End If End If @@ -477,55 +473,55 @@ Public Class OperationsListExpanderVM ''' Public Sub MoveUp() ' Verifico il numero di elementi selezionati - Dim indexes As New List( Of Integer)() + Dim indexes As New List(Of Integer)() For index As Integer = 0 To OperationList.Count - 1 ' Verifico gli elementi selezionati - If OperationList.Item( index).IsSelected Then + If OperationList.Item(index).IsSelected Then ' Se presente una disposizione esco - If EgtGetOperationType( OperationList.Item( index).Id) = MCH_OY.DISP Then Return + If EgtGetOperationType(OperationList.Item(index).Id) = MCH_OY.DISP Then Return ' Aggiungo l'operazione - indexes.Add( index) + indexes.Add(index) End If Next Dim lenIndexes As Integer = indexes.Count ' Recupero Id ultima entità selezionata e precedente a quelle selezionate - Dim LastSelectedId As Integer = OperationList( indexes( lenIndexes - 1)).Id - Dim PreviousId As Integer = OperationList( indexes( 0) - 1).Id + Dim LastSelectedId As Integer = OperationList(indexes(lenIndexes - 1)).Id + Dim PreviousId As Integer = OperationList(indexes(0) - 1).Id ' Sposto l'operazione precedente a quelle selezionate nell'ambiente Egt - If EgtRelocate( PreviousId, LastSelectedId, GDB_POS.AFTER) Then + If EgtRelocate(PreviousId, LastSelectedId, GDB_POS.AFTER) Then ' Sposto l'operazione precedente a quelle selezionate nella grafica - OperationList.Move( indexes(0) - 1, indexes( lenIndexes - 1)) ' + 1) + OperationList.Move(indexes(0) - 1, indexes(lenIndexes - 1)) ' + 1) ' Ricalcolo le lavorazioni selezionate e quella che era precedente (e ora è seguente) If Not m_bMoveThroughDisps Then For index As Integer = 0 To indexes.Count - 1 - EgtSetCurrMachining( OperationList( indexes( index)).Id) - EgtApplyMachining( False) + EgtSetCurrMachining(OperationList(indexes(index)).Id) + EgtApplyMachining(False) Next - EgtSetCurrMachining( PreviousId) - EgtApplyMachining( False) + EgtSetCurrMachining(PreviousId) + EgtApplyMachining(False) EgtDraw() - OnPropertyChanged( "MoveUp_IsEnabled") - OnPropertyChanged( "MoveDown_IsEnabled") + OnPropertyChanged("MoveUp_IsEnabled") + OnPropertyChanged("MoveDown_IsEnabled") Map.refProjectVM.EmitTitle() Else Dim nCurrPhase As Integer = EgtGetOperationPhase(LastSelectedId) For index As Integer = 0 To indexes.Count - 1 - Dim nOpeId As Integer = OperationList( indexes( index) - 1).Id - If EgtGetOperationType( nOpeId) <> MCH_OY.DISP Then - EgtAdjustOperationPhase( nOpeId) - EgtSetCurrMachining( nOpeId) - EgtApplyMachining( False) + Dim nOpeId As Integer = OperationList(indexes(index) - 1).Id + If EgtGetOperationType(nOpeId) <> MCH_OY.DISP Then + EgtAdjustOperationPhase(nOpeId) + EgtSetCurrMachining(nOpeId) + EgtApplyMachining(False) End If Next - If EgtGetOperationType( PreviousId) <> MCH_OY.DISP Then - EgtSetCurrMachining( PreviousId) - EgtApplyMachining( False) + If EgtGetOperationType(PreviousId) <> MCH_OY.DISP Then + EgtSetCurrMachining(PreviousId) + EgtApplyMachining(False) End If Dim nNewPhase As Integer = EgtGetOperationPhase(LastSelectedId) - If nNewPhase <> nCurrPhase Then EgtSetCurrPhase( nNewPhase) + If nNewPhase <> nCurrPhase Then EgtSetCurrPhase(nNewPhase) EgtDraw() - OnPropertyChanged( NameOf(MoveUp_IsEnabled)) - OnPropertyChanged( NameOf(MoveDown_IsEnabled)) + OnPropertyChanged(NameOf(MoveUp_IsEnabled)) + OnPropertyChanged(NameOf(MoveDown_IsEnabled)) Map.refProjectVM.EmitTitle() End If End If @@ -552,52 +548,52 @@ Public Class OperationsListExpanderVM ''' Public Sub MoveDown() ' Verifico il numero di elementi selezionati - Dim indexes As New List( Of Integer)() + Dim indexes As New List(Of Integer)() For index As Integer = 0 To OperationList.Count - 1 ' Verifico gli elementi selezionati - If OperationList.Item( index).IsSelected Then + If OperationList.Item(index).IsSelected Then ' Se presente una disposizione esco - If EgtGetOperationType( OperationList.Item( index).Id) = MCH_OY.DISP Then Return + If EgtGetOperationType(OperationList.Item(index).Id) = MCH_OY.DISP Then Return ' Aggiungo l'operazione - indexes.Add( index) + indexes.Add(index) End If Next Dim lenIndexes As Integer = indexes.Count ' Recupero Id prima entità selezionata e successiva a quelle selezionate - Dim FirstSelectedId As Integer = OperationList( indexes( 0)).Id - Dim NextId As Integer = OperationList( indexes( lenIndexes - 1) + 1).Id + Dim FirstSelectedId As Integer = OperationList(indexes(0)).Id + Dim NextId As Integer = OperationList(indexes(lenIndexes - 1) + 1).Id ' Sposto l'operazione successiva a quelle selezionate nell'ambiente Egt - If EgtRelocate( NextId, FirstSelectedId, GDB_POS.BEFORE) Then + If EgtRelocate(NextId, FirstSelectedId, GDB_POS.BEFORE) Then ' Sposto l'operazione successiva a quelle selezionate nella grafica - OperationList.Move( indexes( lenIndexes - 1) + 1, indexes( 0)) + OperationList.Move(indexes(lenIndexes - 1) + 1, indexes(0)) ' Ricalcolo la lavorazioni selezionate e quella che era seguente (e ora è precedente) If Not m_bMoveThroughDisps Then - EgtSetCurrMachining( NextId) - EgtApplyMachining( False) + EgtSetCurrMachining(NextId) + EgtApplyMachining(False) For index As Integer = 0 To indexes.Count - 1 - EgtSetCurrMachining( OperationList( indexes( index)).Id) - EgtApplyMachining( False) + EgtSetCurrMachining(OperationList(indexes(index)).Id) + EgtApplyMachining(False) Next EgtDraw() - OnPropertyChanged( "MoveUp_IsEnabled") - OnPropertyChanged( "MoveDown_IsEnabled") + OnPropertyChanged("MoveUp_IsEnabled") + OnPropertyChanged("MoveDown_IsEnabled") Map.refProjectVM.EmitTitle() Else - If EgtGetOperationType( NextId) <> MCH_OY.DISP Then - EgtSetCurrMachining( NextId) - EgtApplyMachining( False) + If EgtGetOperationType(NextId) <> MCH_OY.DISP Then + EgtSetCurrMachining(NextId) + EgtApplyMachining(False) End If For index As Integer = 0 To indexes.Count - 1 - Dim nOpeId As Integer = OperationList( indexes( index) + 1).Id - If EgtGetOperationType( nOpeId) <> MCH_OY.DISP Then - EgtAdjustOperationPhase( nOpeId) - EgtSetCurrMachining( nOpeId) - EgtApplyMachining( False) + Dim nOpeId As Integer = OperationList(indexes(index) + 1).Id + If EgtGetOperationType(nOpeId) <> MCH_OY.DISP Then + EgtAdjustOperationPhase(nOpeId) + EgtSetCurrMachining(nOpeId) + EgtApplyMachining(False) End If Next EgtDraw() - OnPropertyChanged( NameOf( MoveUp_IsEnabled)) - OnPropertyChanged( NameOf( MoveDown_IsEnabled)) + OnPropertyChanged(NameOf(MoveUp_IsEnabled)) + OnPropertyChanged(NameOf(MoveDown_IsEnabled)) Map.refProjectVM.EmitTitle() End If End If @@ -1022,6 +1018,7 @@ Public Class OperationsListExpanderVM Dim OpType As Integer = 0 Dim OpTool As String = String.Empty Dim OpMach As String = String.Empty + Dim bTemp As Boolean = False Id = EgtGetFirstOperation() While Id <> GDB_ID.NULL EgtGetOperationName(Id, OpName) @@ -1032,8 +1029,11 @@ Public Class OperationsListExpanderVM EgtGetStatus(Id, OpStatusOnOff) EgtGetMachiningParam(MCH_MP.TOOL, OpTool) EgtGetMachiningParam(MCH_MP.NAME, OpMach) - OperationList.Add(New MachiningOpListBoxItem(Id, OpStatus, OpName, OpType, OpTool, OpMach, True)) - tmpOperationList.Add(New MachiningOpListBoxItem(Id, OpStatus, OpName, OpType, OpTool, OpMach, True)) + ' Dichiarato per far si che le due liste operino in contemporaneo + Dim local_MachiningOpListBoxItem As New MachiningOpListBoxItem(Id, OpStatus, OpName, OpType, OpTool, OpMach, True) + OperationList.Add(local_MachiningOpListBoxItem) + ' Lista creata per lavorare solo su le operazioni di macchina, utilizzata per la gestione dello spegnimento e accensione delle lamp + tmpOperationList.Add(local_MachiningOpListBoxItem) ElseIf IsValidDispositionType(OpType) Then OpStatus = True OpTool = String.Empty @@ -1275,7 +1275,7 @@ Public Class OperationsListExpanderVM If m_NewMachining Then EndNewMachining(GDB_ID.NULL) ' Disabilito visualizzazione utensile If Not IsNothing(m_MachiningParameterExpander) Then - Map.refMachiningParameterExpanderVM.SetViewTool( False) + Map.refMachiningParameterExpanderVM.SetViewTool(False) End If ' Deseleziono le operazioni correnti per eliminare il mark For Each Operation In OperationList @@ -1285,6 +1285,17 @@ Public Class OperationsListExpanderVM Next End Sub + Private Sub SetStatusOnLamp() + If Not IsNothing(m_tmpOperationList) Then + For Each ItemOp As MachiningOpListBoxItem In m_tmpOperationList + If Not ItemOp.OnOff Then + EgtSetStatus(ItemOp.Id, GDB_ST.OFF) + End If + Next + End If + EgtDraw() + End Sub + #End Region ' Methods End Class \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb index 156511f..ae73c02 100644 --- a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb +++ b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb @@ -1,5 +1,4 @@ -Imports System.Collections.ObjectModel -Imports System.IO +Imports System.IO Imports EgtUILib Imports EgtWPFLib5