diff --git a/Supervisor/Application.xaml b/Supervisor/Application.xaml
index 344fc45..a60316d 100644
--- a/Supervisor/Application.xaml
+++ b/Supervisor/Application.xaml
@@ -2,7 +2,9 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Supervisor">
+
-
-
+
+
+
diff --git a/Supervisor/Comms/MachineManager.vb b/Supervisor/Comms/MachineManager.vb
index 48151b9..7a511e7 100644
--- a/Supervisor/Comms/MachineManager.vb
+++ b/Supervisor/Comms/MachineManager.vb
@@ -11,28 +11,14 @@ Public Class MachineManager
End Get
End Property
- Private m_Machine1 As NC.NC_generic
- Public ReadOnly Property Machine1 As NC.NC_generic
- Get
- Return m_Machine1
- End Get
- End Property
-
- Private m_Machine2 As NC.NC_generic
- Public ReadOnly Property Machine2 As NC.NC_generic
- Get
- Return m_Machine2
- End Get
- End Property
-
Sub New()
End Sub
Sub Init()
If GetMainPrivateProfileInt(S_NC, K_NC_SIMULATE, 0) = 1 Then
- Dim nMachineIndex As Integer = 1
+ Dim nMachineIndex As Integer = 0
Dim sMachine As String = ""
- While GetMainPrivateProfileString(S_NC, K_MACHINE & nMachineIndex.ToString(), "", sMachine) > 0
+ While GetMainPrivateProfileString(S_NC, K_MACHINE & (nMachineIndex + 1).ToString(), "", sMachine) > 0
Dim NewSimulatedMachine As New NC.Simulated
NewSimulatedMachine.Connect("")
m_MachineList(nMachineIndex) = NewSimulatedMachine
@@ -60,8 +46,11 @@ Public Class MachineManager
End Sub
Sub Close()
- m_Machine1.Disconnect()
- m_Machine2.Disconnect()
+ For Each Machine In m_MachineList
+ If Not IsNothing(Machine) Then
+ Machine.Disconnect()
+ End If
+ Next
End Sub
End Class
diff --git a/Supervisor/FiniteStateMachineManager/FiniteStateMachineManager.vb b/Supervisor/FiniteStateMachineManager/FiniteStateMachineManager.vb
index 3c87808..9b4db36 100644
--- a/Supervisor/FiniteStateMachineManager/FiniteStateMachineManager.vb
+++ b/Supervisor/FiniteStateMachineManager/FiniteStateMachineManager.vb
@@ -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()
diff --git a/Supervisor/LUA/Lua_General.vb b/Supervisor/LUA/Lua_General.vb
index d0d72af..91e09a1 100644
--- a/Supervisor/LUA/Lua_General.vb
+++ b/Supervisor/LUA/Lua_General.vb
@@ -4,402 +4,372 @@ Imports System.IO
Public Module Lua_General
- ' Lock per scrittura file di log
- Private m_Lock_OutLog As New Object
+ ' Lock per scrittura file di log
+ Private m_Lock_OutLog As New Object
- Private m_sLogPath As String
- Friend Sub SetLogPath(sPath As String)
- m_sLogPath = sPath
- End Sub
+ Private m_sLogPath As String
+ Friend Sub SetLogPath(sPath As String)
+ m_sLogPath = sPath
+ End Sub
- ' da eliminare quando arriva funzione di libreria!!
- Public Function EgtOutLog(sLogMsg As String) As Boolean
- SyncLock (m_Lock_OutLog)
- Using LogStreamWriter As StreamWriter = File.AppendText(m_sLogPath)
- LogStreamWriter.WriteLine(DateTime.Now.ToLongTimeString() & " " & sLogMsg)
- End Using
- End SyncLock
- Return True
- End Function
+ ' da eliminare quando arriva funzione di libreria!!
+ Public Function EgtOutLog(sLogMsg As String) As Boolean
+ SyncLock (m_Lock_OutLog)
+ Using LogStreamWriter As StreamWriter = File.AppendText(m_sLogPath)
+ LogStreamWriter.WriteLine(DateTime.Now.ToLongTimeString() & " " & sLogMsg)
+ End Using
+ End SyncLock
+ Return True
+ End Function
- Friend func_EntIs64bit As LuaFunction = AddressOf Lua_EntIs64bit
- Friend func_EntOutLog As LuaFunction = AddressOf Lua_EntOutLog
- Friend func_EntExistsDirectory As LuaFunction = AddressOf Lua_EntExistsDirectory
- Friend func_EntCopyFile As LuaFunction = AddressOf Lua_EntCopyFile
- Friend func_EntGetIniFile As LuaFunction = AddressOf Lua_EntGetIniFile
- Friend func_EntGetDataDir As LuaFunction = AddressOf Lua_EntGetDataDir
- Friend func_EntGetNumberFromIni As LuaFunction = AddressOf Lua_EntGetNumberFromIni
- Friend func_EntGetStringFromIni As LuaFunction = AddressOf Lua_EntGetStringFromIni
- Friend func_EntWriteStringToIni As LuaFunction = AddressOf Lua_EntWriteStringToIni
- Friend func_EntExecProcess As LuaFunction = AddressOf Lua_ExecProcess
- Friend func_RdsStringGet As LuaFunction = AddressOf Lua_RdsStringGet
- Friend func_RdsStringSetAsync As LuaFunction = AddressOf Lua_RdsStringSetAsync
- Friend func_RdsPublishAsync As LuaFunction = AddressOf Lua_RdsPublishAsync
- Friend func_ComReadShortVar As LuaFunction = AddressOf Lua_ComReadShortVar
- Friend func_ComWriteShortVar As LuaFunction = AddressOf Lua_ComWriteShortVar
- Friend func_ComReadDoubleVar As LuaFunction = AddressOf Lua_ComReadDoubleVar
- Friend func_ComWriteDoubleVar As LuaFunction = AddressOf Lua_ComWriteDoubleVar
- Friend func_ComReadBitVar As LuaFunction = AddressOf Lua_ComReadBitVar
- Friend func_ComWriteBitVar As LuaFunction = AddressOf Lua_ComWriteBitVar
+ Friend func_EntIs64bit As LuaFunction = AddressOf Lua_EntIs64bit
+ Friend func_EntOutLog As LuaFunction = AddressOf Lua_EntOutLog
+ Friend func_EntExistsDirectory As LuaFunction = AddressOf Lua_EntExistsDirectory
+ Friend func_EntCopyFile As LuaFunction = AddressOf Lua_EntCopyFile
+ Friend func_EntGetIniFile As LuaFunction = AddressOf Lua_EntGetIniFile
+ Friend func_EntGetDataDir As LuaFunction = AddressOf Lua_EntGetDataDir
+ Friend func_EntGetNumberFromIni As LuaFunction = AddressOf Lua_EntGetNumberFromIni
+ Friend func_EntGetStringFromIni As LuaFunction = AddressOf Lua_EntGetStringFromIni
+ Friend func_EntWriteStringToIni As LuaFunction = AddressOf Lua_EntWriteStringToIni
+ Friend func_EntExecProcess As LuaFunction = AddressOf Lua_EntExecProcess
+ Friend func_RdsStringGet As LuaFunction = AddressOf Lua_RdsStringGet
+ Friend func_RdsStringSetAsync As LuaFunction = AddressOf Lua_RdsStringSetAsync
+ Friend func_RdsPublishAsync As LuaFunction = AddressOf Lua_RdsPublishAsync
+ Friend func_ComReadShortVar As LuaFunction = AddressOf Lua_ComReadShortVar
+ Friend func_ComWriteShortVar As LuaFunction = AddressOf Lua_ComWriteShortVar
+ Friend func_ComReadDoubleVar As LuaFunction = AddressOf Lua_ComReadDoubleVar
+ Friend func_ComWriteDoubleVar As LuaFunction = AddressOf Lua_ComWriteDoubleVar
+ Friend func_ComReadBitVar As LuaFunction = AddressOf Lua_ComReadBitVar
+ Friend func_ComWriteBitVar As LuaFunction = AddressOf Lua_ComWriteBitVar
- Private Function Lua_EntIs64bit(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- state.PushBoolean(Not IntPtr.Size = 4)
- Return 1
- End Function
+ Private Function Lua_EntIs64bit(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ state.PushBoolean(Not IntPtr.Size = 4)
+ Return 1
+ End Function
- Private Function Lua_EntOutLog(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- ' 1 o 2 parametri : stringa da emettere [, DebugLevel = 0]
- Dim sLogMsg As String = ""
- Dim nDebugLevel As Integer = 0
- LuaCheckParam(state, 1, sLogMsg)
- LuaGetParam(state, 2, nDebugLevel)
- LuaClearStack(state)
- ' accodo il messaggio nel file di log
- EgtOutLog(sLogMsg)
- ' non c'è risultato
- Return 0
- End Function
+ Private Function Lua_EntOutLog(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ ' 1 o 2 parametri : stringa da emettere [, DebugLevel = 0]
+ Dim sLogMsg As String = ""
+ Dim nDebugLevel As Integer = 0
+ LuaCheckParam(state, 1, sLogMsg)
+ LuaGetParam(state, 2, nDebugLevel)
+ LuaClearStack(state)
+ ' accodo il messaggio nel file di log
+ EgtOutLog(sLogMsg)
+ ' non c'è risultato
+ Return 0
+ End Function
- Private Function Lua_EntExistsDirectory(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- ' 1 parametro : sDir
- Dim sDirectory As String = ""
- LuaCheckParam(state, 1, sDirectory)
- LuaClearStack(state)
- Dim bResult As Boolean
- Try
- ' verifico esistenza direttorio
- bResult = Directory.Exists(sDirectory)
- Catch ex As Exception
- bResult = False
- EgtOutLog("Lua_EntExistsDirectory on " & sDirectory & " failed! " & ex.Message)
- End Try
- ' restituisco il risultato
- LuaSetParam(state, bResult)
- Return 1
- End Function
+ Private Function Lua_EntExistsDirectory(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ ' 1 parametro : sDir
+ Dim sDirectory As String = ""
+ LuaCheckParam(state, 1, sDirectory)
+ LuaClearStack(state)
+ Dim bResult As Boolean
+ Try
+ ' verifico esistenza direttorio
+ bResult = Directory.Exists(sDirectory)
+ Catch ex As Exception
+ bResult = False
+ EgtOutLog("Lua_EntExistsDirectory on " & sDirectory & " failed! " & ex.Message)
+ End Try
+ ' restituisco il risultato
+ LuaSetParam(state, bResult)
+ Return 1
+ End Function
- Private Function Lua_EntCopyFile(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- ' 2 parametri : sFile, sNewFile
- Dim sSourcePath As String = ""
- Dim sDestinationPath As String = ""
- LuaCheckParam(state, 1, sSourcePath)
- LuaCheckParam(state, 2, sDestinationPath)
- LuaClearStack(state)
- Dim bResult As Boolean
- Try
- ' copio il file
- File.Copy(sSourcePath, sDestinationPath, True)
- bResult = True
- Catch ex As Exception
- bResult = False
- EgtOutLog("Lua_EntCopyFile from " & sSourcePath & " to " & sDestinationPath & " failed! " & ex.Message)
- End Try
- ' restituisco il risultato
- LuaSetParam(state, bResult)
- Return 1
- End Function
+ Private Function Lua_EntCopyFile(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ ' 2 parametri : sFile, sNewFile
+ Dim sSourcePath As String = ""
+ Dim sDestinationPath As String = ""
+ LuaCheckParam(state, 1, sSourcePath)
+ LuaCheckParam(state, 2, sDestinationPath)
+ LuaClearStack(state)
+ Dim bResult As Boolean
+ Try
+ ' copio il file
+ File.Copy(sSourcePath, sDestinationPath, True)
+ bResult = True
+ Catch ex As Exception
+ bResult = False
+ EgtOutLog("Lua_EntCopyFile from " & sSourcePath & " to " & sDestinationPath & " failed! " & ex.Message)
+ End Try
+ ' restituisco il risultato
+ LuaSetParam(state, bResult)
+ Return 1
+ End Function
- Private Function Lua_EntGetIniFile(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- ' restituisco il risultato
- LuaSetParam(state, IniFile.sPath)
- Return 1
- End Function
+ Private Function Lua_EntGetIniFile(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ ' restituisco il risultato
+ LuaSetParam(state, IniFile.sPath)
+ Return 1
+ End Function
- Private Function Lua_EntGetDataDir(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- ' restituisco il risultato
- LuaSetParam(state, Map.refMainWindowVM.MainWindowM.sDataRoot)
- Return 1
- End Function
+ Private Function Lua_EntGetDataDir(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ ' restituisco il risultato
+ LuaSetParam(state, Map.refMainWindowVM.MainWindowM.sDataRoot)
+ Return 1
+ End Function
- Private Function Lua_EntGetNumberFromIni(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- ' 4 parametri: sSec, sKey, dDef, sIniFile
- Dim sSec As String = ""
- Dim sKey As String = ""
- Dim dDef As Integer = 0
- Dim sIniFile As String = ""
- LuaCheckParam(state, 1, sSec)
- LuaCheckParam(state, 2, sKey)
- LuaCheckParam(state, 3, dDef)
- LuaCheckParam(state, 4, sIniFile)
- LuaClearStack(state)
- Dim nResult As Integer = GetPrivateProfileInt(sSec, sKey, dDef, sIniFile)
- ' restituisco il risultato
- LuaSetParam(state, nResult)
- Return 1
- End Function
+ Private Function Lua_EntGetNumberFromIni(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ ' 4 parametri: sSec, sKey, dDef, sIniFile
+ Dim sSec As String = ""
+ Dim sKey As String = ""
+ Dim dDef As Integer = 0
+ Dim sIniFile As String = ""
+ LuaCheckParam(state, 1, sSec)
+ LuaCheckParam(state, 2, sKey)
+ LuaCheckParam(state, 3, dDef)
+ LuaCheckParam(state, 4, sIniFile)
+ LuaClearStack(state)
+ Dim nResult As Integer = GetPrivateProfileInt(sSec, sKey, dDef, sIniFile)
+ ' restituisco il risultato
+ LuaSetParam(state, nResult)
+ Return 1
+ End Function
- Private Function Lua_EntGetStringFromIni(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- ' 4 parametri: sSec, sKey, sDef, sIniFile
- Dim sSec As String = ""
- Dim sKey As String = ""
- Dim sDef As String = 0
- Dim sIniFile As String = ""
- LuaCheckParam(state, 1, sSec)
- LuaCheckParam(state, 2, sKey)
- LuaCheckParam(state, 3, sDef)
- LuaCheckParam(state, 4, sIniFile)
- LuaClearStack(state)
- Dim sResult As String = ""
- GetPrivateProfileString(sSec, sKey, sDef, sResult, sIniFile)
- ' restituisco il risultato
- LuaSetParam(state, sResult)
- Return 1
- End Function
+ Private Function Lua_EntGetStringFromIni(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ ' 4 parametri: sSec, sKey, sDef, sIniFile
+ Dim sSec As String = ""
+ Dim sKey As String = ""
+ Dim sDef As String = 0
+ Dim sIniFile As String = ""
+ LuaCheckParam(state, 1, sSec)
+ LuaCheckParam(state, 2, sKey)
+ LuaCheckParam(state, 3, sDef)
+ LuaCheckParam(state, 4, sIniFile)
+ LuaClearStack(state)
+ Dim sResult As String = ""
+ GetPrivateProfileString(sSec, sKey, sDef, sResult, sIniFile)
+ ' restituisco il risultato
+ LuaSetParam(state, sResult)
+ Return 1
+ End Function
- Private Function Lua_EntWriteStringToIni(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- ' 4 parametri: sSec, sKey, sVal, sIniFile
- Dim sSec As String = ""
- Dim sKey As String = ""
- Dim sVal As Integer = 0
- Dim sIniFile As String = ""
- LuaCheckParam(state, 1, sSec)
- LuaCheckParam(state, 2, sKey)
- LuaCheckParam(state, 3, sVal)
- LuaCheckParam(state, 4, sIniFile)
- LuaClearStack(state)
- Dim bResult As Boolean = WritePrivateProfileString(sSec, sKey, sVal, sIniFile)
- ' restituisco il risultato
- LuaSetParam(state, bResult)
- Return 1
- End Function
+ Private Function Lua_EntWriteStringToIni(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ ' 4 parametri: sSec, sKey, sVal, sIniFile
+ Dim sSec As String = ""
+ Dim sKey As String = ""
+ Dim sVal As Integer = 0
+ Dim sIniFile As String = ""
+ LuaCheckParam(state, 1, sSec)
+ LuaCheckParam(state, 2, sKey)
+ LuaCheckParam(state, 3, sVal)
+ LuaCheckParam(state, 4, sIniFile)
+ LuaClearStack(state)
+ Dim bResult As Boolean = WritePrivateProfileString(sSec, sKey, sVal, sIniFile)
+ ' restituisco il risultato
+ LuaSetParam(state, bResult)
+ Return 1
+ End Function
- Private Function Lua_RdsStringGet(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- If IsNothing(Map.refMainWindowVM.RedisManager) OrElse IsNothing(Map.refMainWindowVM.RedisManager.Subscriber) Then
- EgtOutLog("Error! Trying to get string from a non existent redis!")
- LuaSetParam(state)
- Return 1
- End If
- ' 1 parametro: sKey
- Dim sKey As String = ""
- LuaCheckParam(state, 1, sKey)
- LuaClearStack(state)
- Dim Result As RedisValue
- Result = Map.refMainWindowVM.RedisManager.RedisDb.StringGet(sKey)
- ' restituisco il risultato
- LuaSetParam(state, Result)
- Return 1
- End Function
+ Private Function Lua_RdsStringGet(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ If IsNothing(Map.refMainWindowVM.RedisManager) OrElse IsNothing(Map.refMainWindowVM.RedisManager.Subscriber) Then
+ EgtOutLog("Error! Trying to get string from a non existent redis!")
+ LuaSetParam(state)
+ Return 1
+ End If
+ ' 1 parametro: sKey
+ Dim sKey As String = ""
+ LuaCheckParam(state, 1, sKey)
+ LuaClearStack(state)
+ Dim Result As RedisValue
+ Result = Map.refMainWindowVM.RedisManager.RedisDb.StringGet(sKey)
+ ' restituisco il risultato
+ LuaSetParam(state, Result)
+ Return 1
+ End Function
- Private Function Lua_RdsStringSetAsync(ByVal p As IntPtr) As Integer
- If IsNothing(Map.refMainWindowVM.RedisManager) OrElse IsNothing(Map.refMainWindowVM.RedisManager.Subscriber) Then
- EgtOutLog("Error! Trying to set string on a non existent redis!")
- Return 0
- End If
- Dim state = Lua.FromIntPtr(p)
- ' 2 parametri: sKey, sVal
- Dim sKey As String = ""
- Dim sVal As String = 0
- LuaCheckParam(state, 1, sKey)
- LuaCheckParam(state, 2, sVal)
- LuaClearStack(state)
- Map.refMainWindowVM.RedisManager.RedisDb.StringSetAsync(sKey, sVal)
- Return 0
- End Function
+ Private Function Lua_RdsStringSetAsync(ByVal p As IntPtr) As Integer
+ If IsNothing(Map.refMainWindowVM.RedisManager) OrElse IsNothing(Map.refMainWindowVM.RedisManager.Subscriber) Then
+ EgtOutLog("Error! Trying to set string on a non existent redis!")
+ Return 0
+ End If
+ Dim state = Lua.FromIntPtr(p)
+ ' 2 parametri: sKey, sVal
+ Dim sKey As String = ""
+ Dim sVal As String = 0
+ LuaCheckParam(state, 1, sKey)
+ LuaCheckParam(state, 2, sVal)
+ LuaClearStack(state)
+ Map.refMainWindowVM.RedisManager.RedisDb.StringSetAsync(sKey, sVal)
+ Return 0
+ End Function
- Private Function Lua_RdsPublishAsync(ByVal p As IntPtr) As Integer
- If IsNothing(Map.refMainWindowVM.RedisManager) OrElse IsNothing(Map.refMainWindowVM.RedisManager.Subscriber) Then
- EgtOutLog("Error! Trying to publish on a non existent redis!")
- Return 0
- End If
- Dim state = Lua.FromIntPtr(p)
- ' 2 parametri: sKey, sVal
- Dim sChannel As String = ""
- Dim sMessage As String = 0
- LuaCheckParam(state, 1, sChannel)
- LuaCheckParam(state, 2, sMessage)
- LuaClearStack(state)
- Map.refMainWindowVM.RedisManager.Subscriber.PublishAsync(sChannel, sMessage)
- Return 0
- End Function
+ Private Function Lua_RdsPublishAsync(ByVal p As IntPtr) As Integer
+ If IsNothing(Map.refMainWindowVM.RedisManager) OrElse IsNothing(Map.refMainWindowVM.RedisManager.Subscriber) Then
+ EgtOutLog("Error! Trying to publish on a non existent redis!")
+ Return 0
+ End If
+ Dim state = Lua.FromIntPtr(p)
+ ' 2 parametri: sKey, sVal
+ Dim sChannel As String = ""
+ Dim sMessage As String = 0
+ LuaCheckParam(state, 1, sChannel)
+ LuaCheckParam(state, 2, sMessage)
+ LuaClearStack(state)
+ Map.refMainWindowVM.RedisManager.Subscriber.PublishAsync(sChannel, sMessage)
+ Return 0
+ End Function
- Private Function Lua_ComReadShortVar(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- Dim nVarAddr As Integer = 0
- Dim nMachine As Integer = 0
- LuaCheckParam(state, 1, nVarAddr)
- LuaCheckParam(state, 2, nMachine)
- LuaClearStack(state)
- Dim Machine As NGP_COMM_DLL.NC.NC_generic
- If nMachine = 1 Then
- Machine = Map.refMainWindowVM.MachineManager.Machine1
- Else
- Machine = Map.refMainWindowVM.MachineManager.Machine2
- End If
- Dim nResult As Short = 0
- If Machine.ReadShortVar(nVarAddr, nResult) Then
- state.PushNumber(nResult)
- Return 1
- Else
- Return 0
- End If
- End Function
+ Private Function Lua_ComReadShortVar(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim nVarAddr As Integer = 0
+ Dim nMachine As Integer = 0
+ LuaCheckParam(state, 1, nVarAddr)
+ LuaCheckParam(state, 2, nMachine)
+ LuaClearStack(state)
+ Dim Machine As NGP_COMM_DLL.NC.NC_generic = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
+ Dim nResult As Short = 0
+ If Machine.ReadShortVar(nVarAddr, nResult) Then
+ state.PushInteger(nResult)
+ Return 1
+ Else
+ Return 0
+ End If
+ End Function
- Private Function Lua_ComReadBitVar(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- Dim nVarAddr As Integer = 0
- Dim nBit As Integer = 0
- Dim nMachine As Integer = 0
- LuaCheckParam(state, 1, nVarAddr)
- LuaCheckParam(state, 2, nBit)
- LuaCheckParam(state, 3, nMachine)
- LuaClearStack(state)
- Dim Machine As NGP_COMM_DLL.NC.NC_generic
- If nMachine = 1 Then
- Machine = Map.refMainWindowVM.MachineManager.Machine1
- Else
- Machine = Map.refMainWindowVM.MachineManager.Machine2
- End If
- Dim bResult As Boolean = 0
- If Machine.ReadBitVar(nVarAddr, nBit, bResult) Then
- state.PushBoolean(bResult)
- Return 1
- Else
- Return 0
- End If
- End Function
+ Private Function Lua_ComReadBitVar(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim nVarAddr As Integer = 0
+ Dim nBit As Integer = 0
+ Dim nMachine As Integer = 0
+ LuaCheckParam(state, 1, nVarAddr)
+ LuaCheckParam(state, 2, nBit)
+ LuaCheckParam(state, 3, nMachine)
+ LuaClearStack(state)
+ Dim Machine As NGP_COMM_DLL.NC.NC_generic = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
+ Dim bResult As Boolean = 0
+ If Machine.ReadBitVar(nVarAddr, nBit, bResult) Then
+ state.PushBoolean(bResult)
+ Return 1
+ Else
+ Return 0
+ End If
+ End Function
- Private Function Lua_ComReadDoubleVar(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- Dim nVarAddr As Integer = 0
- Dim nMachine As Integer = 0
- LuaCheckParam(state, 1, nVarAddr)
- LuaCheckParam(state, 2, nMachine)
- LuaClearStack(state)
- Dim Machine As NGP_COMM_DLL.NC.NC_generic
- If nMachine = 1 Then
- Machine = Map.refMainWindowVM.MachineManager.Machine1
- Else
- Machine = Map.refMainWindowVM.MachineManager.Machine2
- End If
- Dim dResult As Double = 0
- If Machine.ReadDoubleVar(nVarAddr, dResult) Then
- state.PushBoolean(dResult)
- Return 1
- Else
- Return 0
- End If
- End Function
+ Private Function Lua_ComReadDoubleVar(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim nVarAddr As Integer = 0
+ Dim nMachine As Integer = 0
+ LuaCheckParam(state, 1, nVarAddr)
+ LuaCheckParam(state, 2, nMachine)
+ LuaClearStack(state)
+ Dim Machine As NGP_COMM_DLL.NC.NC_generic = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
+ Dim dResult As Double = 0
+ If Machine.ReadDoubleVar(nVarAddr, dResult) Then
+ state.PushNumber(dResult)
+ Return 1
+ Else
+ Return 0
+ End If
+ End Function
- Private Function Lua_ComWriteShortVar(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- Dim nVarAddr As Integer = 0
- Dim nValue As Integer = 0
- Dim nMachine As Integer = 0
- LuaCheckParam(state, 1, nVarAddr)
- LuaCheckParam(state, 2, nValue)
- LuaCheckParam(state, 3, nMachine)
- LuaClearStack(state)
- Dim Machine As NGP_COMM_DLL.NC.NC_generic
- If nMachine = 1 Then
- Machine = Map.refMainWindowVM.MachineManager.Machine1
- Else
- Machine = Map.refMainWindowVM.MachineManager.Machine2
- End If
- If Machine.WriteShortVar(nVarAddr, nValue) Then
- state.PushBoolean(True)
- Return 1
- Else
- Return 0
- End If
- End Function
+ Private Function Lua_ComWriteShortVar(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim nVarAddr As Integer = 0
+ Dim nValue As Integer = 0
+ Dim nMachine As Integer = 0
+ LuaCheckParam(state, 1, nVarAddr)
+ LuaCheckParam(state, 2, nValue)
+ LuaCheckParam(state, 3, nMachine)
+ LuaClearStack(state)
+ Dim Machine As NGP_COMM_DLL.NC.NC_generic = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
+ If Machine.WriteShortVar(nVarAddr, nValue) Then
+ state.PushBoolean(True)
+ Return 1
+ Else
+ Return 0
+ End If
+ End Function
- Private Function Lua_ComWriteBitVar(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- Dim nVarAddr As Integer = 0
- Dim nBit As Integer = 0
- Dim bValue As Boolean = 0
- Dim nMachine As Integer = 0
- LuaCheckParam(state, 1, nVarAddr)
- LuaCheckParam(state, 2, nBit)
- LuaCheckParam(state, 3, bValue)
- LuaCheckParam(state, 4, nMachine)
- LuaClearStack(state)
- Dim Machine As NGP_COMM_DLL.NC.NC_generic
- If nMachine = 1 Then
- Machine = Map.refMainWindowVM.MachineManager.Machine1
- Else
- Machine = Map.refMainWindowVM.MachineManager.Machine2
- End If
- If Machine.WriteBitVar(nVarAddr, nBit, bValue) Then
- state.PushBoolean(True)
- Return 1
- Else
- Return 0
- End If
- End Function
+ Private Function Lua_ComWriteBitVar(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim nVarAddr As Integer = 0
+ Dim nBit As Integer = 0
+ Dim bValue As Boolean = 0
+ Dim nMachine As Integer = 0
+ LuaCheckParam(state, 1, nVarAddr)
+ LuaCheckParam(state, 2, nBit)
+ LuaCheckParam(state, 3, bValue)
+ LuaCheckParam(state, 4, nMachine)
+ LuaClearStack(state)
+ Dim Machine As NGP_COMM_DLL.NC.NC_generic = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
+ If Machine.WriteBitVar(nVarAddr, nBit, bValue) Then
+ state.PushBoolean(True)
+ Return 1
+ Else
+ Return 0
+ End If
+ End Function
- Private Function Lua_ComWriteDoubleVar(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- Dim nVarAddr As Integer = 0
- Dim dValue As Double = 0
- Dim nMachine As Integer = 0
- LuaCheckParam(state, 1, nVarAddr)
- LuaCheckParam(state, 2, dValue)
- LuaCheckParam(state, 3, nMachine)
- LuaClearStack(state)
- Dim Machine As NGP_COMM_DLL.NC.NC_generic
- If nMachine = 1 Then
- Machine = Map.refMainWindowVM.MachineManager.Machine1
- Else
- Machine = Map.refMainWindowVM.MachineManager.Machine2
- End If
- If Machine.WriteDoubleVar(nVarAddr, dValue) Then
- state.PushBoolean(True)
- Return 1
- Else
- Return 0
- End If
- End Function
+ Private Function Lua_ComWriteDoubleVar(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim nVarAddr As Integer = 0
+ Dim dValue As Double = 0
+ Dim nMachine As Integer = 0
+ LuaCheckParam(state, 1, nVarAddr)
+ LuaCheckParam(state, 2, dValue)
+ LuaCheckParam(state, 3, nMachine)
+ LuaClearStack(state)
+ Dim Machine As NGP_COMM_DLL.NC.NC_generic = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
+ If Machine.WriteDoubleVar(nVarAddr, dValue) Then
+ state.PushBoolean(True)
+ Return 1
+ Else
+ Return 0
+ End If
+ End Function
- Private Function Lua_ExecProcess(ByVal p As IntPtr) As Integer
- Dim state = Lua.FromIntPtr(p)
- Dim sFileName As String = ""
- Dim sMainLuaPath As String = ""
- Dim sArguments As String = ""
- LuaCheckParam(state, 1, sFileName)
- LuaCheckParam(state, 2, sMainLuaPath)
- LuaCheckParam(state, 3, sArguments)
- LuaClearStack(state)
- If ExecProcessManager.ExecProcess(sFileName, sMainLuaPath, sArguments) Then
- state.PushBoolean(True)
- Return 1
- Else
- Return 0
- End If
- End Function
+ Private Function Lua_EntExecProcess(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim sFileName As String = ""
+ Dim sMainLuaPath As String = ""
+ Dim sArguments As String = ""
+ LuaCheckParam(state, 1, sFileName)
+ LuaCheckParam(state, 2, sMainLuaPath)
+ LuaCheckParam(state, 3, sArguments)
+ LuaClearStack(state)
+ If ExecProcessManager.ExecProcess(sFileName, sMainLuaPath, sArguments) Then
+ state.PushBoolean(True)
+ Return 1
+ Else
+ Return 0
+ End If
+ End Function
- Friend Function LuaInstallGeneral(state As Lua) As Boolean
- If IsNothing(state) Then Return False
- state.Register("EntIs64bit", func_EntIs64bit)
- state.Register("EntOutLog", func_EntOutLog)
- state.Register("EntExistsDirectory", func_EntExistsDirectory)
- state.Register("EntCopyFile", func_EntCopyFile)
- state.Register("EntGetIniFile", func_EntGetIniFile)
- state.Register("EntGetDataDir", func_EntGetDataDir)
- state.Register("EntGetNumberFromIni", func_EntGetNumberFromIni)
- state.Register("EntGetStringFromIni", func_EntGetStringFromIni)
- state.Register("EntWriteStringToIni", func_EntWriteStringToIni)
- state.Register("EntExecProcess", func_EntExecProcess)
- state.Register("RdsStringGet", func_RdsStringGet)
- state.Register("RdsStringSetAsync", func_RdsStringSetAsync)
- state.Register("RdsPublishAsync", func_RdsPublishAsync)
- state.Register("ComReadShortVar", func_ComReadShortVar)
- state.Register("ComWriteShortVar", func_ComWriteShortVar)
- state.Register("ComReadDoubleVar", func_ComReadDoubleVar)
- state.Register("ComWriteDoubleVar", func_ComWriteDoubleVar)
- state.Register("ComReadBitVar", func_ComReadBitVar)
- state.Register("ComWriteBitVar", func_ComWriteBitVar)
- Return True
- End Function
+ Friend Function LuaInstallGeneral(state As Lua) As Boolean
+ If IsNothing(state) Then Return False
+ state.Register("EntIs64bit", func_EntIs64bit)
+ state.Register("EntOutLog", func_EntOutLog)
+ state.Register("EntExistsDirectory", func_EntExistsDirectory)
+ state.Register("EntCopyFile", func_EntCopyFile)
+ state.Register("EntGetIniFile", func_EntGetIniFile)
+ state.Register("EntGetDataDir", func_EntGetDataDir)
+ state.Register("EntGetNumberFromIni", func_EntGetNumberFromIni)
+ state.Register("EntGetStringFromIni", func_EntGetStringFromIni)
+ state.Register("EntWriteStringToIni", func_EntWriteStringToIni)
+ state.Register("EntExecProcess", func_EntExecProcess)
+ state.Register("RdsStringGet", func_RdsStringGet)
+ state.Register("RdsStringSetAsync", func_RdsStringSetAsync)
+ state.Register("RdsPublishAsync", func_RdsPublishAsync)
+ state.Register("ComReadShortVar", func_ComReadShortVar)
+ state.Register("ComWriteShortVar", func_ComWriteShortVar)
+ state.Register("ComReadDoubleVar", func_ComReadDoubleVar)
+ state.Register("ComWriteDoubleVar", func_ComWriteDoubleVar)
+ state.Register("ComReadBitVar", func_ComReadBitVar)
+ state.Register("ComWriteBitVar", func_ComWriteBitVar)
+ Return True
+ End Function
End Module
diff --git a/Supervisor/MEFPlugin/SupervisorFunctions.vb b/Supervisor/MEFPlugin/SupervisorFunctions.vb
index 63c5439..38b275e 100644
--- a/Supervisor/MEFPlugin/SupervisorFunctions.vb
+++ b/Supervisor/MEFPlugin/SupervisorFunctions.vb
@@ -33,48 +33,48 @@ Public Class SupervisorFunctions
Return ExecProcessManager.ExecProcess(sFileName, sMainLuaPath, sArguments)
End Function
Public Function ComReadShortVar(nVarAddr As Integer, ByRef nResult As Short, nMachine As Integer) As Boolean Implements IHost.ComReadShortVar
- If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine)) Then
- Return Map.refMainWindowVM.MachineManager.MachineList(nMachine).ReadShortVar(nVarAddr, nResult)
+ If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)) Then
+ Return Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1).ReadShortVar(nVarAddr, nResult)
Else
Return False
End If
End Function
Public Function ComReadBitVar(nVarAddr As Integer, nBit As Integer, ByRef bResult As Boolean, nMachine As Integer) As Boolean Implements IHost.ComReadBitVar
- If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine)) Then
- Return Map.refMainWindowVM.MachineManager.MachineList(nMachine).ReadBitVar(nVarAddr, nBit, bResult)
+ If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)) Then
+ Return Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1).ReadBitVar(nVarAddr, nBit, bResult)
Else
Return False
End If
End Function
Public Function ComReadDoubleVar(nVarAddr As Integer, ByRef dResult As Double, nMachine As Integer) As Boolean Implements IHost.ComReadDoubleVar
- If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine)) Then
- Return Map.refMainWindowVM.MachineManager.MachineList(nMachine).ReadDoubleVar(nVarAddr, dResult)
+ If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)) Then
+ Return Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1).ReadDoubleVar(nVarAddr, dResult)
Else
Return False
End If
End Function
Public Function ComWriteShortVar(nVarAddr As Integer, nValue As Integer, nMachine As Integer) As Boolean Implements IHost.ComWriteShortVar
- If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine)) Then
- Return Map.refMainWindowVM.MachineManager.MachineList(nMachine).WriteShortVar(nVarAddr, nValue)
+ If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)) Then
+ Return Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1).WriteShortVar(nVarAddr, nValue)
Else
Return False
End If
End Function
Public Function ComWriteBitVar(nVarAddr As Integer, nBit As Integer, bValue As Boolean, nMachine As Integer) As Boolean Implements IHost.ComWriteBitVar
- If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine)) Then
- Return Map.refMainWindowVM.MachineManager.MachineList(nMachine).WriteBitVar(nVarAddr, nBit, bValue)
+ If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)) Then
+ Return Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1).WriteBitVar(nVarAddr, nBit, bValue)
Else
Return False
End If
End Function
Public Function ComWriteDoubleVar(nVarAddr As Integer, dValue As Double, nMachine As Integer) As Boolean Implements IHost.ComWriteDoubleVar
- If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine)) Then
- Return Map.refMainWindowVM.MachineManager.MachineList(nMachine).WriteDoubleVar(nVarAddr, dValue)
+ If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)) Then
+ Return Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1).WriteDoubleVar(nVarAddr, dValue)
Else
Return False
End If
diff --git a/Supervisor/MainWindow/MainWindowV.xaml b/Supervisor/MainWindow/MainWindowV.xaml
index 020fcd2..93290fe 100644
--- a/Supervisor/MainWindow/MainWindowV.xaml
+++ b/Supervisor/MainWindow/MainWindowV.xaml
@@ -5,7 +5,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Supervisor"
mc:Ignorable="d"
- Title="MainWindow" Height="450" Width="800">
+ Title="MainWindow" Height="950" Width="1600"
+ Style="{StaticResource MainWindow}">
diff --git a/Supervisor/MainWindow/MainWindowVM.vb b/Supervisor/MainWindow/MainWindowVM.vb
index eb487a9..01147d5 100644
--- a/Supervisor/MainWindow/MainWindowVM.vb
+++ b/Supervisor/MainWindow/MainWindowVM.vb
@@ -55,14 +55,16 @@ Public Class MainWindowVM
' Creo Model della MainWindow
m_MainWindowM = New MainWindowM
+ ' creo gestore della comunicazione
+ m_MachineManager = New MachineManager
+ m_MachineManager.Init()
+
' creo gestore delle macchine a stati
m_FiniteStateMachineManager = New FiniteStateMachineManager
If GetMainPrivateProfileInt(S_REDIS, K_ENABLED, 0) = 1 Then
m_RedisManager = New RedisManager
End If
- m_MachineManager = New MachineManager
- m_MachineManager.Init()
' recuper nome del plugin
Dim sPluginName As String = ""
@@ -72,8 +74,8 @@ Public Class MainWindowVM
Application.Current.Resources.MergedDictionaries.Add(PluginDictionary)
'' aggiungo MainMenu dal plugin
Dim PluginMainMenu As IPluginControl = GetControlByName(Of IPluginControl)(sPluginName, "MainMenu")
- '' aggiungo MainMenu dal plugin
'ContentPanel = PluginMainMenu
+ '' aggiungo manager delle funzioni Lua del Plugin
Dim PluginLuaManager As IPluginLuaManager = Map.refMainWindowVM.GetLuaManager(Of IPluginLuaManager)(sPluginName)
PluginLuaManager.PlgInit(LuaManager.state)
' aggiungo Project dal plugin
diff --git a/Supervisor/Supervisor.vbproj b/Supervisor/Supervisor.vbproj
index 3954c07..cb1b076 100644
--- a/Supervisor/Supervisor.vbproj
+++ b/Supervisor/Supervisor.vbproj
@@ -159,6 +159,9 @@
+
+ Dictionary.xaml
+
@@ -178,6 +181,10 @@
MainWindowV.xaml
Code
+
+ MSBuild:Compile
+ Designer
+
diff --git a/Supervisor/Utility/Dictionary.xaml b/Supervisor/Utility/Dictionary.xaml
new file mode 100644
index 0000000..bfe5035
--- /dev/null
+++ b/Supervisor/Utility/Dictionary.xaml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ None
+
+
+
+
+ 30
+ 2
+ 2
+
+
+
+
diff --git a/Supervisor/Utility/Dictionary.xaml.vb b/Supervisor/Utility/Dictionary.xaml.vb
new file mode 100644
index 0000000..e5471f0
--- /dev/null
+++ b/Supervisor/Utility/Dictionary.xaml.vb
@@ -0,0 +1,108 @@
+Imports System.ComponentModel.Composition
+Imports System.Globalization
+Imports Supervisor.Plugin.Interface
+
+
+
+Public Class Dictionary
+ Inherits ResourceDictionary
+ Implements IPluginControl
+
+ Public Shared ReadOnly MySceneHostVM As String = "MySceneHostVM"
+
+#Region "Colors"
+
+ 'Private m_Omag_Red As SolidColorBrush = Brushes.Red
+ 'Public ReadOnly Property Omag_Red As SolidColorBrush
+ ' Get
+ ' Return m_Omag_Red
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Button_Static_Background As SolidColorBrush = New BrushConverter().ConvertFrom("#FFDDDDDD")
+ 'Public Shared ReadOnly Property Button_Static_Background As SolidColorBrush
+ ' Get
+ ' Return m_Button_Static_Background
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_TabControl_Header_Background As LinearGradientBrush = Application.Current.FindResource("TabItem.Static.Background")
+ 'Public Shared ReadOnly Property TabControl_Header_Background As LinearGradientBrush
+ ' Get
+ ' Return m_TabControl_Header_Background
+ ' End Get
+ 'End Property
+
+
+ 'Private Shared m_Icarus_Gray As SolidColorBrush = Application.Current.FindResource("Icarus_Gray")
+ 'Public Shared ReadOnly Property Icarus_Gray As SolidColorBrush
+ ' Get
+ ' Return m_Icarus_Gray
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Icarus_LightBlue As SolidColorBrush = Application.Current.FindResource("Icarus_LightBlue")
+ 'Public Shared ReadOnly Property Icarus_LightBlue As SolidColorBrush
+ ' Get
+ ' Return m_Icarus_LightBlue
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Icarus_Blue As SolidColorBrush = Application.Current.FindResource("Icarus_Blue")
+ 'Public Shared ReadOnly Property Icarus_Blue As SolidColorBrush
+ ' Get
+ ' Return m_Icarus_Blue
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Icarus_Green As SolidColorBrush = Application.Current.FindResource("Icarus_Green")
+ 'Public Shared ReadOnly Property Icarus_Green As SolidColorBrush
+ ' Get
+ ' Return m_Icarus_Green
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Icarus_Orange As SolidColorBrush = Application.Current.FindResource("Icarus_Orange")
+ 'Public Shared ReadOnly Property Icarus_Orange As SolidColorBrush
+ ' Get
+ ' Return m_Icarus_Orange
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Icarus_Purple As SolidColorBrush = Application.Current.FindResource("Icarus_Purple")
+ 'Public Shared ReadOnly Property Icarus_Purple As SolidColorBrush
+ ' Get
+ ' Return m_Icarus_Purple
+ ' End Get
+ 'End Property
+
+ '
+ '
+ '
+ '
+ '
+ '
+
+#End Region ' Colors
+
+End Class
+
+Public Class CenterToolTipConverter
+ Implements IMultiValueConverter
+
+ Public Function Convert(ByVal values As Object(), ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IMultiValueConverter.Convert
+ For Each value In values
+ If TypeOf (value) IsNot Double Then
+ Return Double.NaN
+ End If
+ Next
+ Dim dPlacementTarget As Double = CDbl(values(0))
+ Dim dToolTip As Double = CDbl(values(1))
+ Return (dPlacementTarget / 2.0) - (dToolTip / 2.0)
+ End Function
+
+ Public Function ConvertBack(ByVal value As Object, ByVal targetTypes As Type(), ByVal parameter As Object, ByVal culture As CultureInfo) As Object() Implements IMultiValueConverter.ConvertBack
+ Throw New NotSupportedException()
+ End Function
+
+End Class
diff --git a/Supervisor/Utility/ExecProcessManager.vb b/Supervisor/Utility/ExecProcessManager.vb
index fe146ee..6facc09 100644
--- a/Supervisor/Utility/ExecProcessManager.vb
+++ b/Supervisor/Utility/ExecProcessManager.vb
@@ -13,7 +13,7 @@
Dim ExecCounter = 0
If Proc.Start Then
While Not Proc.HasExited
- If ExecCounter >= 100 Then
+ If ExecCounter >= 300 Then
bResult = False
Proc.Kill()
Exit While