Lettura messaggi da script lua

This commit is contained in:
Nicola Pievani
2021-06-09 12:50:32 +02:00
parent df22725f1a
commit d99a1ea62b
2 changed files with 31 additions and 7 deletions
+1
View File
@@ -40,6 +40,7 @@ Module ConstIni
Public Const K_INVERTBEVEL As String = "DisableInvertBevel"
Public Const K_ASKMEAGAINCONFIRM As String = "AskMeAgainConfirm"
Public Const K_EGTCAMEXE As String = "EgtCam5Exe"
Public Const K_REFRESHTIME As String = "RefreshTime"
Public Const S_LANGUAGES As String = "Languages"
Public Const K_LANGUAGE As String = "Language"
+30 -7
View File
@@ -3,16 +3,21 @@ Imports System.Runtime.InteropServices
Imports System.IO
Imports EgtUILib
Imports System.Threading
Imports System.Windows.Threading
Imports System.ComponentModel
Imports EgtWPFLib5
Public Class StatusBarVM
Implements INotifyPropertyChanged
Inherits EgtWPFLib5.StatusBarVM
#Region "FIELDS & PROPERTIES"
' Funzioni di callback per output in interfaccia da LUA
' Funzioni di callback per output In interfaccia da LUA
'Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents)
'Private m_OutTextCallback As New OutTextCallback(AddressOf OutText)
Private m_OutTextCallback As New OutTextCallback(AddressOf OutText)
Private m_RefreshTimer As New DispatcherTimer
' tempo di cancellazione messaggio
Private m_nRefreshTime As Integer = 5000
' GRAPHICAL ELEMENTS
Private m_StatusOutput As String
@@ -69,14 +74,31 @@ Public Class StatusBarVM
Sub New()
Map.SetRefStatusBarVM(Me)
'' Installo funzione gestione eventi per lua
'EgtSetProcessEvents(m_ProcEventsCallback)
' Installo funzione output testo su status per lua
EgtSetOutText(m_OutTextCallback)
m_nRefreshTime = GetMainPrivateProfileInt(S_GENERAL, K_REFRESHTIME, 5000)
End Sub
#End Region ' Constructor
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
' riceve le stringhe dei messaggi lua EgtOutText
Public Function OutText(ByRef psText As IntPtr) As Boolean
' Assegno stringa
OutputMessage = (Marshal.PtrToStringUni(psText))
m_StatusOutput = OutputMessage
NotifyPropertyChanged("StatusOutput")
AddHandler m_RefreshTimer.Tick, AddressOf RefreshTimer_tick
m_RefreshTimer.Interval = TimeSpan.FromMilliseconds(m_nRefreshTime)
m_RefreshTimer.Start()
Return True
End Function
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
' dopo m_nRefreshTime pulisco il messaggio
Private Sub RefreshTimer_tick()
m_StatusOutput = String.Empty
NotifyPropertyChanged("StatusOutput")
End Sub
End Class
@@ -100,4 +122,5 @@ Public Class SPItem
m_SPMessage = Message
End Sub
End Class
End Class