377a6cef07
-cambio versione -aggiunto lettura INFONGEPART_ per pezzo -sistemato combobox parametri generali
132 lines
6.0 KiB
VB.net
132 lines
6.0 KiB
VB.net
Imports System.IO
|
|
Imports EgtBEAMWALL.Core.ConstIni
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
Imports EgwMultiEngineManager.Core
|
|
Imports EgwMultiEngineManager.Data
|
|
Imports EgwMultiEngineManager.Data.Constants
|
|
|
|
Module MyExecProcessManager
|
|
|
|
Private m_ExecProcessManagerList As New Dictionary(Of EXECENVIRONMENTS, ExecProcessManager)
|
|
Public ReadOnly Property ExecProcessManagerList As Dictionary(Of EXECENVIRONMENTS, ExecProcessManager)
|
|
Get
|
|
Return m_ExecProcessManagerList
|
|
End Get
|
|
End Property
|
|
|
|
Friend Function Init() As Boolean
|
|
' creazione manager dei processi
|
|
Dim sCamExePath As String = ""
|
|
GetMainPrivateProfileString(S_GENERAL, K_CAMEXEPATH, "", sCamExePath)
|
|
EgtOutLog("CAMExePath = " & sCamExePath)
|
|
If Not File.Exists(sCamExePath) Then
|
|
Dim sMsg As String = "CAMExePath not found!"
|
|
EgtOutLog(sMsg)
|
|
Return False
|
|
End If
|
|
Dim sPipeLuaDir As String = ""
|
|
GetMainPrivateProfileString(S_GENERAL, K_PIPELUADIR, "", sPipeLuaDir)
|
|
EgtOutLog("PipeLuaDir = " & sPipeLuaDir)
|
|
If Not File.Exists(sCamExePath) Then
|
|
Dim sMsg As String = "PipeLuaDir not found!"
|
|
EgtOutLog(sMsg)
|
|
Return False
|
|
End If
|
|
Dim nGroupIndex As Integer = 1
|
|
Dim sEnvironment As String = ""
|
|
Dim sPipeLuaFile As String = ""
|
|
Dim nMaxCamInstances As Integer = 0
|
|
While GetMainPrivateProfileString(S_EXECGROUP & nGroupIndex.ToString(), K_ENVIRONMENT, "", sEnvironment) > 0 AndAlso
|
|
GetMainPrivateProfileString(S_EXECGROUP & nGroupIndex.ToString(), K_PIPELUAFILE, "", sPipeLuaFile) AndAlso
|
|
GetMainPrivateProfileString(S_EXECGROUP & nGroupIndex.ToString(), K_MAXCAMINSTANCES, "", nMaxCamInstances)
|
|
System.Console.WriteLine("Group" & nGroupIndex.ToString())
|
|
System.Console.WriteLine("Environment = " & sEnvironment)
|
|
System.Console.WriteLine("PipeLuaFile = " & sPipeLuaFile)
|
|
System.Console.WriteLine("MaxCAMInstances = " & nMaxCamInstances)
|
|
Dim Environment As EXECENVIRONMENTS = EXECENVIRONMENTS.NULL
|
|
Select Case sEnvironment
|
|
Case "BEAM"
|
|
Environment = EXECENVIRONMENTS.BEAM
|
|
Case "WALL"
|
|
Environment = EXECENVIRONMENTS.WALL
|
|
End Select
|
|
Dim PipeLuaPath As String = sPipeLuaDir & "\" & sPipeLuaFile
|
|
If nMaxCamInstances <= 0 OrElse Environment = EXECENVIRONMENTS.NULL OrElse Not File.Exists(PipeLuaPath) Then
|
|
System.Console.WriteLine(String.Format("Group{0} not created!", nGroupIndex.ToString()))
|
|
nGroupIndex += 1
|
|
Continue While
|
|
End If
|
|
Dim NewExecProcessManager As New ExecProcessManager(nGroupIndex, Environment, sCamExePath, PipeLuaPath, nMaxCamInstances, ExecProcessManager.ReturnModes.EVENT_, False)
|
|
AddHandler NewExecProcessManager.m_AnswerReceived, AddressOf ExecProcessManager_AnswerReceived
|
|
NewExecProcessManager.StartExecutionThread()
|
|
m_ExecProcessManagerList.Add(Environment, NewExecProcessManager)
|
|
nGroupIndex += 1
|
|
End While
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub ExecProcessManager_AnswerReceived(Answer As AnswerDTO)
|
|
Map.refMyStatusBarVM.SetLoadingProgress_Visibility(True)
|
|
Dim sBarPath As String = Answer.Args("BarPath")
|
|
Dim nProgramPage As Integer = -1
|
|
Integer.TryParse(Answer.Args("ProgramPage"), nProgramPage)
|
|
Dim nBarId As Integer = -1
|
|
Integer.TryParse(Answer.Args("BarId"), nBarId)
|
|
EgtOutLog("Risultato progetto " & nBarId)
|
|
CALCPanelVM.ProcessResults(sBarPath, nProgramPage, nBarId)
|
|
If Answer.Args.Count > 4 Then
|
|
Dim PartItem As BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList.FirstOrDefault(Function(x) x.nPartId = nBarId)
|
|
Dim nPreInvert As Integer = -1
|
|
Dim bPreInvert As Boolean = False
|
|
If Answer.Args.ContainsKey("PREINVERT") Then
|
|
Integer.TryParse(Answer.Args("PREINVERT"), nPreInvert)
|
|
End If
|
|
Dim nPreRotate As Integer = -1
|
|
If Answer.Args.ContainsKey("PREROTATE90") Then
|
|
Integer.TryParse(Answer.Args("PREROTATE90"), nPreRotate)
|
|
End If
|
|
If nPreInvert > 0 Then
|
|
If nPreInvert = 1 Then bPreInvert = True
|
|
If PartItem.IsInverted Then bPreInvert = False
|
|
PartItem.SetInverted(bPreInvert)
|
|
End If
|
|
If nPreRotate > 0 Then
|
|
Dim dAng As Integer = nPreRotate * 90
|
|
PartItem.ForwardRotation(True, True, dAng, False)
|
|
End If
|
|
|
|
Dim prefix As String = "INFONGEPART_"
|
|
|
|
Dim sInfoNgePartList As List(Of String) = Answer.Args.Where(Function(k) k.Key.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)).Select(Function(k) k.Value).ToList()
|
|
|
|
For Each InfoNgePartItem As String In sInfoNgePartList
|
|
Dim sKeyVal() As String = InfoNgePartItem.Trim().Split("="c)
|
|
EgtSetInfo(PartItem.nPartId, sKeyVal(0), sKeyVal(1))
|
|
Next
|
|
|
|
End If
|
|
' Gestione progressbar per verificare l'inizio e la fine della verifica
|
|
Dim BeamManager As ExecProcessManager = m_ExecProcessManagerList(EXECENVIRONMENTS.BEAM)
|
|
Dim nQuestionInQueue As Integer = BeamManager.nQuestionInQueue
|
|
Dim nFreeOrWaitingAnswerProcesses As Integer = BeamManager.nFreeOrWaitingAnswerProcesses
|
|
Dim nRunningProcesses As Integer = BeamManager.nRunningProcesses
|
|
Map.refMyStatusBarVM.SetLoadingProgress(Map.refMyStatusBarVM.MaximumValue - nQuestionInQueue - (nRunningProcesses - nFreeOrWaitingAnswerProcesses))
|
|
If nQuestionInQueue = 0 AndAlso nFreeOrWaitingAnswerProcesses = nRunningProcesses Then
|
|
Map.refMyStatusBarVM.EndLoading(EgtMsg(62577), 2)
|
|
Map.refSceneShowBuldingVM.SceneShowBulding.Enable(True)
|
|
Map.refSceneBuildingVM.SetViewPanel_IsEnable(True)
|
|
Map.refShowBeamPanelVM.ShowBuilding_IsEnabled = True
|
|
Map.refCALCPanelVM.SetCalculating(False)
|
|
End If
|
|
End Sub
|
|
|
|
Friend Function Close()
|
|
For Each Key In m_ExecProcessManagerList.Keys
|
|
m_ExecProcessManagerList(Key).Dispose()
|
|
Next
|
|
Return True
|
|
End Function
|
|
|
|
End Module
|