EgtCAM5 2.1g2 .

- correzioni nella gestione della lista lavorazioni (tolta virtualizzazione).
This commit is contained in:
Dario Sassi
2019-07-08 07:20:31 +00:00
parent 257a4490c4
commit b5b9e459eb
6 changed files with 120 additions and 149 deletions
@@ -110,7 +110,7 @@ Public Class OperationExpanderVM
If value <> m_ParametersIsExpanded Then
m_ParametersIsExpanded = value
' Cerco l'operazione selezionata all'interno di OperationList
Dim selOperation As OperationListBoxItem
Dim selOperation As OperationListBoxItem = Nothing
For Each Operation In OperationList
If (Operation.IsSelected) Then
selOperation = Operation
@@ -327,55 +327,43 @@ Public Class OperationExpanderVM
Public ReadOnly Property DuplicateCmd_IsEnabled As Boolean
Get
Dim dummyOperation As OperationListBoxItem
Dim Count As Integer = 0
Dim SelType As Integer = MCH_OY.NONE
For Each Operation In OperationList
If (Operation.IsSelected) Then
dummyOperation = Operation
Count = Count + 1
If Operation.IsSelected Then
If SelType <> MCH_OY.NONE Then Return False
SelType = Operation.Type
If SelType = MCH_OY.DISP Then Return False
End If
Next
If Count = 1 Then
Return Not dummyOperation.Type = MCH_OY.DISP
Else
Return False
End If
Return SelType <> MCH_OY.NONE
End Get
End Property
Public ReadOnly Property MachToDb_IsEnabled As Boolean
Get
Dim dummyOperation As OperationListBoxItem
Dim Count As Integer = 0
Dim SelType As Integer = MCH_OY.NONE
For Each Operation In OperationList
If (Operation.IsSelected) Then
dummyOperation = Operation
Count = Count + 1
If Operation.IsSelected Then
If SelType <> MCH_OY.NONE Then Return False
SelType = Operation.Type
If SelType = MCH_OY.DISP Then Return False
End If
Next
If Count = 1 Then
Return Not dummyOperation.Type = MCH_OY.DISP
Else
Return False
End If
Return SelType <> MCH_OY.NONE
End Get
End Property
Public ReadOnly Property Rename_IsEnabled As Boolean
Get
Dim dummyOperation As OperationListBoxItem
Dim Count As Integer = 0
Dim SelType As Integer = MCH_OY.NONE
For Each Operation In OperationList
If (Operation.IsSelected) Then
dummyOperation = Operation
Count = Count + 1
If Operation.IsSelected Then
If SelType <> MCH_OY.NONE Then Return False
SelType = Operation.Type
If SelType = MCH_OY.DISP Then Return False
End If
Next
If Count = 1 Then
Return Not dummyOperation.Type = MCH_OY.DISP
Else
Return False
End If
Return SelType <> MCH_OY.NONE
End Get
End Property
@@ -394,10 +382,11 @@ Public Class OperationExpanderVM
Public ReadOnly Property OperationParameters As ContentControl
Get
' Cerco l'operazione selezionata all'interno di OperationList
Dim selOperation As OperationListBoxItem
Dim selOperation As OperationListBoxItem = Nothing
For Each Operation In OperationList
If (Operation.IsSelected) Then
If Operation.IsSelected Then
selOperation = Operation
Exit For
End If
Next
If selOperation.m_Type = MCH_OY.DISP Then
@@ -511,13 +500,6 @@ Public Class OperationExpanderVM
Me.ListIsExpanded = True
OperationListBoxItem.m_RefOperationExpanderVM = Me
SimulationExpanderVM.m_RefOperationExpanderVM = Me
' Cerco l'operazione selezionata all'interno di OperationList
Dim selOperation As OperationListBoxItem
For Each Operation In OperationList
If (Operation.IsSelected) Then
selOperation = Operation
End If
Next
Application.Msn.Register(Application.LOADOPERATIONLIST, Sub(nSelectedOperation As Integer)
LoadOperationList()
SelectOperation(nSelectedOperation)
@@ -538,39 +520,37 @@ Public Class OperationExpanderVM
End Sub)
Application.Msn.Register(Application.SIMULATIONEXPANDER_GET_ISEXPANDED, Sub(bValue As Boolean)
If m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION Then
ListIsExpanded = True
End If
If bValue Then
If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
ListIsExpanded = False
ParametersIsExpanded = False
m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION
Else
' Deseleziono e riseleziono la lavorazione corrente per fargli riselezionare la geometria
' di lavorazione che è stata deselezionata dalla simulazione
Dim CurrSelectedOperation As OperationListBoxItem
CurrSelectedOperation = selOperation
selOperation = Nothing
selOperation = CurrSelectedOperation
ListIsExpanded = True
' Deseleziono e riseleziono le operazioni correnti per ripristinare il mark
For Each Operation In OperationList
If Operation.IsSelected Then
Operation.IsSelected = False
Operation.IsSelected = True
End If
Next
End If
End Sub)
Application.Msn.Register(Application.ESTIMATIONEXPANDER_GET_ISEXPANDED, Sub(bValue As Boolean)
If m_CurrExpandedExpander = MachiningOptionPanelExpander.ESTIMATIONS Then
ListIsExpanded = True
End If
If bValue Then
If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
ListIsExpanded = False
ParametersIsExpanded = False
m_CurrExpandedExpander = MachiningOptionPanelExpander.ESTIMATIONS
Else
' Deseleziono e riseleziono la lavorazione corrente per fargli riselezionare la geometria
' di lavorazione che è stata deselezionata dalla simulazione
Dim CurrSelectedOperation As OperationListBoxItem
CurrSelectedOperation = selOperation
selOperation = Nothing
selOperation = CurrSelectedOperation
ListIsExpanded = True
' Deseleziono e riseleziono le operazioni correnti per ripristinare il mark
For Each Operation In OperationList
If Operation.IsSelected Then
Operation.IsSelected = False
Operation.IsSelected = True
End If
Next
End If
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
@@ -580,6 +560,12 @@ Public Class OperationExpanderVM
If Not IsNothing(m_MachiningParameterExpander) Then
DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderVM).ViewTool = False
End If
' Deseleziono le operazioni correnti per eliminare il mark
For Each Operation In OperationList
If Operation.IsSelected Then
Operation.IsSelected = False
End If
Next
End Sub)
Application.Msn.Register(Application.CANCELOPERATIONCOMMAND, Sub()
CancelOperation(String.Empty)
@@ -743,9 +729,9 @@ Public Class OperationExpanderVM
''' </summary>
Public Sub OperationListDoubleClick()
' Cerco l'operazione selezionata all'interno di OperationList
Dim selOperation As OperationListBoxItem
Dim selOperation As OperationListBoxItem = Nothing
For Each Operation In OperationList
If (Operation.IsSelected) Then
If Operation.IsSelected Then
selOperation = Operation
End If
Next
@@ -980,9 +966,9 @@ Public Class OperationExpanderVM
''' </summary>
Public Sub DuplicateMach()
' Cerco l'operazione selezionata all'interno di OperationList
Dim selOperation As OperationListBoxItem
Dim selOperation As OperationListBoxItem = Nothing
For Each Operation In OperationList
If (Operation.IsSelected) Then
If Operation.IsSelected Then
selOperation = Operation
End If
Next
@@ -1021,14 +1007,16 @@ Public Class OperationExpanderVM
''' </summary>
Public Sub MachToDb()
' Cerco l'operazione selezionata all'interno di OperationList
Dim selOperation As OperationListBoxItem
Dim selOperation As OperationListBoxItem = Nothing
For Each Operation In OperationList
If (Operation.IsSelected) Then
If Operation.IsSelected Then
selOperation = Operation
Exit For
End If
Next
'verifico che l'operazione selezionata sia una lavorazione
If IsNothing(selOperation) Or selOperation.m_Type = MCH_OY.NONE Or
If IsNothing(selOperation) OrElse
selOperation.m_Type = MCH_OY.NONE OrElse
selOperation.m_Type = MCH_OY.DISP Then Return
' apro la finetra che chiede il nome e verifica che non sia già utilizzato (Nome lavorazione nel Db)
Dim NameDialogVM As New EgtWPFLib5.NameDialogVM With {
@@ -1171,14 +1159,16 @@ Public Class OperationExpanderVM
''' </summary>
Public Sub Rename()
' Cerco l'operazione selezionata all'interno di OperationList
Dim selOperation As OperationListBoxItem
Dim selOperation As OperationListBoxItem = Nothing
For Each Operation In OperationList
If (Operation.IsSelected) Then
If Operation.IsSelected Then
selOperation = Operation
Exit For
End If
Next
'verifico che l'operazione selezionata sia una lavorazione
If IsNothing(selOperation) Or selOperation.m_Type = MCH_OY.NONE Or
' verifico che l'operazione selezionata sia una lavorazione
If IsNothing(selOperation) OrElse
selOperation.m_Type = MCH_OY.NONE OrElse
selOperation.m_Type = MCH_OY.DISP Then Return
' lancio modalità rinomina
If Not TypeOf selOperation Is MachiningOpListBoxItem Then Return
@@ -1279,88 +1269,60 @@ Public Class OperationExpanderVM
' Abilita/Disabilita il bottone MoveUp in base agli elementi selezionati
Private Function MoveUp_SelectionOperation() As Boolean
' Inserisco in una lista le operazioni selezionate
Dim indexes As New List(Of Integer)()
For index As Integer = 0 To OperationList.Count - 1
If (OperationList.Item(index).IsSelected) Then
' Aggiungo l'indice ad una lista per verificarne successivamente la consecuitività con altri indici
If OperationList.Item(index).IsSelected Then
indexes.Add(index)
End If
Next
Dim flag = False
Dim len As Integer = indexes.Count
' Caso in cui più ci sono più indici selezionati
If len > 1 Then
For index As Integer = 1 To len - 1
' Verfico se gli indici degli elementi selezionati siano consecutivi
If (indexes(index) - indexes(index - 1) = 1) Then
flag = True
Else
Return False
Exit For
End If
Next
End If
' Se non ci sono operazioni selezionate, non va bene
If indexes.Count = 0 Then Return False
' Verifico se prima del primo indice selezionato ci sia ancora qualcosa
If Not (indexes(0) = 0) Then
' Verifico se appena prima del primo indice selezionato ci sia una Disposizione o esso stesso lo sia
' Questa è anche l'unica condizione affrontata in caso di singolo elemento selezionato
For index As Integer = 0 To len - 1
If (EgtGetOperationType(OperationList.Item(indexes(0) - 1).Id).Equals(MCH_OY.DISP) Or
EgtGetOperationType(OperationList.Item(indexes(index)).Id).Equals(MCH_OY.DISP)) Then
Return False
Else
flag = True
End If
Next
Else
Return False
End If
' Se le operazioni non sono consecutive, non va bene
For index As Integer = 1 To indexes.Count - 1
If indexes(index) - indexes(index - 1) <> 1 Then Return False
Next
Return flag
' Se tra le operazioni c'è una disposizione, non va bene
For index As Integer = 1 To indexes.Count - 1
If EgtGetOperationType(OperationList.Item(indexes(index)).Id) = MCH_OY.DISP Then Return False
Next
' Se prima della prima selezionata c'è una disposizione, non va bene
If indexes(0) = 0 OrElse EgtGetOperationType(OperationList.Item(indexes(0) - 1).Id) = MCH_OY.DISP Then Return False
Return True
End Function
' Abilita/Disabilita il bottone MoveDown in base agli elementi selezionati
Private Function MoveDown_SelectionOperation() As Boolean
' Inserisco in una lista le operazioni selezionate
Dim indexes As New List(Of Integer)()
For index As Integer = 0 To OperationList.Count - 1
If (OperationList.Item(index).IsSelected) Then
' Aggiungo l'indice ad una lista per verificarne successivamente la consecuitività con altri indici
If OperationList.Item(index).IsSelected Then
indexes.Add(index)
End If
Next
Dim flag = False
Dim len As Integer = indexes.Count
' Caso in cui più ci sono più indici selezionati
If len > 1 Then
For index As Integer = 1 To len - 1
' Verfico se gli indici degli elementi selezionati siano consecutivi
If (indexes(index) - indexes(index - 1) = 1) Then
flag = True
Else
Return False
Exit For
End If
Next
End If
' Se non ci sono operazioni selezionate, non va bene
If indexes.Count = 0 Then Return False
' Verifico se dopo l'ultimo indice selezionato ci sia ancora qualcosa
If Not (indexes(len - 1) = OperationList.Count - 1) Then
' Verifico se appena dopo l'ultimo indice selezionato ci sia una Disposizione
' Questa è anche l'unica condizione affrontata in caso di singolo elemento selezionato
For index As Integer = 0 To len - 1
If (EgtGetOperationType(OperationList.Item(indexes(len - 1) + 1).Id).Equals(MCH_OY.DISP) Or
EgtGetOperationType(OperationList.Item(indexes(index)).Id).Equals(MCH_OY.DISP)) Then
Return False
Else
flag = True
End If
Next
Else
Return False
End If
' Se le operazioni non sono consecutive, non va bene
For index As Integer = 1 To indexes.Count - 1
If indexes(index) - indexes(index - 1) <> 1 Then Return False
Next
Return flag
' Se tra le operazioni c'è una disposizione, non va bene
For index As Integer = 1 To indexes.Count - 1
If EgtGetOperationType(OperationList.Item(indexes(index)).Id) = MCH_OY.DISP Then Return False
Next
' Se dopo l'ultima selezionata c'è una disposizione, non va bene
Dim nLast As Integer = indexes.Count - 1
If indexes(nLast) = OperationList.Count - 1 OrElse
EgtGetOperationType(OperationList.Item(indexes(nLast) + 1).Id) = MCH_OY.DISP Then Return False
Return True
End Function
#End Region ' Methods