- corretto indici lista macchine

- eliminate chiamate di test da gestore macchine a stati
- anticipata caricamento comunicazione macchine rispetto alle macchine a stati
- allungato counter di esecuzione processi lanciati
- aggiunto dictionary
- iniziata gestione finestra custom
This commit is contained in:
Emmanuele Sassi
2024-08-23 19:08:06 +02:00
parent cf6e28662f
commit 84f191782b
11 changed files with 645 additions and 457 deletions
@@ -16,36 +16,36 @@ Public Class FiniteStateMachineManager
If GetMainPrivateProfileString(S_GENERAL, K_INITLUA, "", sLuaInitPath) > 0 Then
LuaManager.ExecFile(Map.refMainWindowVM.MainWindowM.sScriptDir & "\" & sLuaInitPath)
End If
' leggo configurazioni
Dim sPreProcName As String = ""
If GetMainPrivateProfileString(S_GENERAL, K_PREPROC, "", sPreProcName) > 0 AndAlso
Not String.IsNullOrWhiteSpace(sPreProcName) Then
m_PreProcPath = Map.refMainWindowVM.MainWindowM.sScriptDir & "\" & sPreProcName
If File.Exists(m_PreProcPath) Then
' lancio esecuzione file preprocessore
LuaManager.SetGlobVar("PREPROC.ERROR", 0)
LuaManager.SetGlobVar("PREPROC.ERROR_MSG", "")
LuaManager.ExecFile(m_PreProcPath)
Dim nError As Integer = 0
If Not LuaManager.GetGlobVar("PREPROC.ERROR", nError) Then
nError = 1
End If
If nError > 0 Then
Dim sErrorMsg As String = ""
If LuaManager.GetGlobVar("PREPROC.ERROR_MSG", sErrorMsg) Then
EgtOutLog("Error in PreProc! #" & nError & ":" & sErrorMsg)
End If
End If
End If
End If
Dim sPostProcName As String = ""
If GetMainPrivateProfileString(S_GENERAL, K_POSTPROC, "", sPostProcName) > 0 AndAlso
Not String.IsNullOrWhiteSpace(m_PostProcPath) Then
m_PostProcPath = Map.refMainWindowVM.MainWindowM.sScriptDir & "\" & sPostProcName
If File.Exists(m_PostProcPath) Then
LuaManager.ExecFile(m_PostProcPath)
End If
End If
'' leggo configurazioni
'Dim sPreProcName As String = ""
'If GetMainPrivateProfileString(S_GENERAL, K_PREPROC, "", sPreProcName) > 0 AndAlso
' Not String.IsNullOrWhiteSpace(sPreProcName) Then
' m_PreProcPath = Map.refMainWindowVM.MainWindowM.sScriptDir & "\" & sPreProcName
' If File.Exists(m_PreProcPath) Then
' ' lancio esecuzione file preprocessore
' LuaManager.SetGlobVar("PREPROC.ERROR", 0)
' LuaManager.SetGlobVar("PREPROC.ERROR_MSG", "")
' LuaManager.ExecFile(m_PreProcPath)
' Dim nError As Integer = 0
' If Not LuaManager.GetGlobVar("PREPROC.ERROR", nError) Then
' nError = 1
' End If
' If nError > 0 Then
' Dim sErrorMsg As String = ""
' If LuaManager.GetGlobVar("PREPROC.ERROR_MSG", sErrorMsg) Then
' EgtOutLog("Error in PreProc! #" & nError & ":" & sErrorMsg)
' End If
' End If
' End If
'End If
'Dim sPostProcName As String = ""
'If GetMainPrivateProfileString(S_GENERAL, K_POSTPROC, "", sPostProcName) > 0 AndAlso
' Not String.IsNullOrWhiteSpace(m_PostProcPath) Then
' m_PostProcPath = Map.refMainWindowVM.MainWindowM.sScriptDir & "\" & sPostProcName
' If File.Exists(m_PostProcPath) Then
' LuaManager.ExecFile(m_PostProcPath)
' End If
'End If
Dim nIndex As Integer = 1
Dim sMachineState As String = ""
While GetMainPrivateProfileString(S_GENERAL, K_MACHINESTATE & nIndex.ToString(), "", sMachineState) > 0
@@ -59,27 +59,32 @@ Public Class FiniteStateMachineManager
m_FiniteStateMachineTimer.Start()
End Sub
'Private m_bFiniteStateMachineExecuting As Boolean = False
Private Sub FiniteStateMachineTimer_Tick(sender As Object, e As EventArgs)
'If m_bFiniteStateMachineExecuting Then Return
'm_bFiniteStateMachineExecuting = True
' lancio esecuzione macchine a stati
For Each FiniteStateMachine In m_FiniteStateMachineList
LuaManager.ExecLuaFunction("MACHINE1_Tick", -1, Nothing)
For nMachineIndex = 0 To m_FiniteStateMachineList.Count - 1
LuaManager.ExecLuaFunction("MACHINE" & (nMachineIndex + 1).ToString() & "_Tick", -1, Nothing)
Next
' lancio esecuzione preprocessore
LuaManager.SetGlobVar("PREPROC.ERROR", 0)
LuaManager.SetGlobVar("PREPROC.ERROR_MSG", "")
LuaManager.ExecLuaFunction("PREPROC_Tick", -1, Nothing)
Dim nError As Integer = 0
If Not LuaManager.GetGlobVar("PREPROC.ERROR", nError) Then
nError = 1
End If
If nError > 0 Then
Dim sErrorMsg As String = ""
If LuaManager.GetGlobVar("PREPROC.ERROR_MSG", sErrorMsg) Then
EgtOutLog("Error in PreProc! #" & nError & ":" & sErrorMsg)
End If
End If
'' lancio esecuzione preprocessore
'LuaManager.SetGlobVar("PREPROC.ERROR", 0)
'LuaManager.SetGlobVar("PREPROC.ERROR_MSG", "")
'LuaManager.ExecLuaFunction("PREPROC_Tick", -1, Nothing)
'Dim nError As Integer = 0
'If Not LuaManager.GetGlobVar("PREPROC.ERROR", nError) Then
' nError = 1
'End If
'If nError > 0 Then
' Dim sErrorMsg As String = ""
' If LuaManager.GetGlobVar("PREPROC.ERROR_MSG", sErrorMsg) Then
' EgtOutLog("Error in PreProc! #" & nError & ":" & sErrorMsg)
' End If
'End If
' lancio esecuzione postprocessore
'LuaManager.ExecLuaFunction("Tick", -1, Nothing)
'm_bFiniteStateMachineExecuting = False
End Sub
Friend Sub ResetFiniteStateMachineTimer()