5527a7e316
- aggiornata finestra BtlDataWnd per gestione multiprogetto - fix aggiunta progetto
89 lines
3.7 KiB
VB.net
89 lines
3.7 KiB
VB.net
Imports System.IO
|
|
Imports EgtBEAMWALL.Core
|
|
Imports EgtBEAMWALL.Core.ConstIni
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
Imports EgwMultiEngineManager
|
|
Imports EgwMultiEngineManager.Data
|
|
Imports EgwMultiEngineManager.Data.Constants
|
|
Imports EgwMultiEngineManager.ExecProcessManager
|
|
|
|
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, ReturnModes.EVENT_)
|
|
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)
|
|
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)
|
|
Map.refCALCPanelVM.ProcessResults(sBarPath, nProgramPage, nBarId)
|
|
End Sub
|
|
|
|
Friend Function Close()
|
|
For Each Key In m_ExecProcessManagerList.Keys
|
|
m_ExecProcessManagerList(Key).Dispose()
|
|
Next
|
|
Return True
|
|
End Function
|
|
|
|
End Module
|