- aggiunto splashscreen

- aggiunta gestione chiave di protezione con limite macchine utilizzabili
- impostata cartella dati da programma per script lua
This commit is contained in:
Emmanuele Sassi
2024-11-08 13:14:07 +01:00
parent f47809379d
commit 71a280e41d
16 changed files with 263 additions and 44 deletions
+106 -1
View File
@@ -1,8 +1,46 @@
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Security
Imports System.Windows.Threading
Imports Effector.Plugin.Interface
Public Module EgtInterface
#If DEBUG Then
Const EgtIntDll32 As String = "EgtBasisD32.dll"
#Else
Const EgtIntDll32 As String = "EgtBasisR32.dll"
#End If
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtSetKey"), SuppressUnmanagedCodeSecurity()>
Public Function EgtSetKey(sKey As String) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtGetKeyLevel"), SuppressUnmanagedCodeSecurity()>
Public Function EgtGetKeyLevel(nProd As Integer, nVer As Integer, nLev As Integer, ByRef nKLev As Integer) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtGetKeyOptions"), SuppressUnmanagedCodeSecurity()>
Public Function EgtGetKeyOptions(nProd As Integer, nVer As Integer, nLev As Integer,
ByRef nOpt1 As UInteger, ByRef nOpt2 As UInteger) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtGetKeyLeftDays"), SuppressUnmanagedCodeSecurity()>
Public Function EgtGetKeyLeftDays(ByRef nLeftDays As Integer) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtGetKeyAssLeftDays"), SuppressUnmanagedCodeSecurity()>
Public Function EgtGetKeyAssLeftDays(ByRef nAssLeftDays As Integer) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtGetKeyOptLeftDays"), SuppressUnmanagedCodeSecurity()>
Public Function EgtGetKeyOptLeftDays(ByRef nOptLeftDays As Integer) As Boolean
End Function
End Module
Public Class MainWindowVM
Inherits vmbase
Friend m_PluginTestInfo As Integer = 764
@@ -22,7 +60,6 @@ Public Class MainWindowVM
End Get
End Property
' Riferimento al gestore del della comunicazione macchine
Private m_MachineManager As MachineManager
Friend ReadOnly Property MachineManager As MachineManager
@@ -53,12 +90,58 @@ Public Class MainWindowVM
End Get
End Property
Private m_SplashScreen_Timer As New DispatcherTimer
Private m_WaitAfterRender As Integer = 0
Private m_Window_Opacity As Double = 0.2
Public ReadOnly Property Window_Opacity As Double
Get
Return m_Window_Opacity
End Get
End Property
' Titolo
Public ReadOnly Property sTitle As String
Get
Return "Effector"
End Get
End Property
Sub New()
' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM
Map.BeginInit(Me)
' imposto e avvio contatore SplashScreen
m_SplashScreen_Timer.Interval = New TimeSpan(0, 0, 0, 0, 500)
AddHandler m_SplashScreen_Timer.Tick, AddressOf SplashScreenTimer_Tick
If Not IsNothing(Map.refSplashScreen) Then
m_SplashScreen_Timer.Start()
End If
' Creo Model della MainWindow
m_MainWindowM = New MainWindowM
'' Gestione della chiave di protezione
'Dim sLicFileName As String = ""
'GetMainPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName)
'Dim sLicFile As String = m_MainWindowM.sConfigDir & "\" & sLicFileName
'Dim sKey As String = ""
'GenInterface.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
'EgtSetKey( sKey)
'' Recupero livello e opzioni della chiave
'Dim nKeyLevel As Integer = 0
'Dim nKeyOpt1 As Integer = 0
'Dim nKeyOpt2 As Integer = 0
'Dim bKey As Boolean = EgtGetKeyLevel(7375, 2610, 1, nKeyLevel) And
' EgtGetKeyOptions(7375, 2610, 1, nKeyOpt1, nKeyOpt2)
'If Not bKey Then
' EgtOutLog("Key or Licence Problem (" & (-nKeyLevel).ToString() & ")")
' MessageBox.Show("Key or Licence Problem (" & (-nKeyLevel).ToString() & ")", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
' EgtOutLog("Exit")
' End
'End If
' creo gestore della comunicazione
m_MachineManager = New MachineManager
m_MachineManager.Init()
@@ -80,6 +163,10 @@ Public Class MainWindowVM
m_ContentPanel = ProjectPlugin
End If
' creo variabile globale Effector per dati programma
LuaManager.CreateGlobTable("EFFECTOR")
LuaManager.SetGlobVar("EFFECTOR.INIPATH", Map.refMainWindowVM.MainWindowM.sConfigDir & "\" & INI_FILE_NAME)
' creo gestore delle macchine a stati
m_FiniteStateMachineManager = New FiniteStateMachineManager
If GetMainPrivateProfileInt(S_REDIS, K_ENABLED, 0) = 1 Then
@@ -88,6 +175,24 @@ Public Class MainWindowVM
End Sub
Friend Sub ContentRendered()
' segno su contatore splashscreen render finito
m_WaitAfterRender = 1
End Sub
Private Sub SplashScreenTimer_Tick()
If m_WaitAfterRender > 1 Then
m_Window_Opacity = 1
NotifyPropertyChanged(NameOf(Window_Opacity))
' chiudo SplashScreen
Map.refSplashScreen.Close()
Map.SetRefSplashScreen(Nothing)
m_SplashScreen_Timer.Stop()
ElseIf m_WaitAfterRender > 0 Then
m_WaitAfterRender += 1
End If
End Sub
#Region "Plugin"
Private m_Loader As MEFLoader = New MEFLoader()