Correzioni e migliorie

This commit is contained in:
Emmanuele Sassi
2021-05-26 14:46:11 +02:00
parent 0b5ae544a5
commit 31a06ab64a
8 changed files with 58 additions and 50 deletions
@@ -301,6 +301,44 @@ Public Class OpenProjectFileDialogVM
End If
' cancello progetto
DbControllers.m_ProdController.DeleteProd(SelProject.nProdId)
' riporto prod in proj
Dim nCurrCtx As Integer = EgtGetCurrentContext()
Dim nTempCtx As Integer = EgtInitContext()
If nTempCtx <> 0 Then
' inizializzo gestore lavorazioni
EgtInitMachMgr(Map.refMainWindowVM.MainWindowM.sMachinesRoot, Map.refMainWindowVM.MainWindowM.sToolMakersDir)
EgtOpenFile(SelProject.sProdPath)
' cancello tutti i gruppi di lavorazione
Dim nMachGroupId As Integer = EgtGetFirstMachGroup()
While nMachGroupId <> GDB_ID.NULL
EgtSetCurrMachGroup(nMachGroupId)
Dim nRawPartId As Integer = EgtGetFirstRawPart()
While nRawPartId <> GDB_ID.NULL
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
While nPartId <> GDB_ID.NULL
EgtRemovePartFromRawPart(nPartId)
' elimino pezzo copia
EgtErase(nPartId)
nPartId = EgtGetFirstPartInRawPart(nRawPartId)
End While
nRawPartId = EgtGetNextRawPart(nRawPartId)
End While
EgtRemoveMachGroup(nMachGroupId)
nMachGroupId = EgtGetFirstMachGroup()
End While
' lo salvo in tutti i proj correlati
Dim ProdFile As ProdFileVM = DirectCast(SelProject, ProdFileVM)
For Each nProjId In ProdFile.nProjIdList
EgtSaveFile(ProdFile.GetProjPath(nProjId), NGE.BIN)
Next
' torno sul contesto corrente
EgtSetCurrentContext(nCurrCtx)
EgtDeleteContext(nTempCtx)
End If
' se proj corrente era il prod cancellato, aggiorno proj corrente
If Not IsNothing(Map.refProjManagerVM.CurrProj) AndAlso Map.refProjManagerVM.CurrProj.nProdId = SelProject.nProdId Then
Map.refProjManagerVM.UpdateCurrProj()
End If
' aggiorno lista progetti
m_ProjectList.Clear()
Dim DbProjectList As New List(Of ProdFileM)