EgtCAM5 1.6s3 :
- modifiche varie per gestione chiave, istanze, log e log dei comandi.
This commit is contained in:
@@ -16,9 +16,6 @@ Namespace EgtCAM5
|
||||
'' '' '' '' '' ''Private m_nInstance As Integer = 0
|
||||
Private m_sDataRoot As String = String.Empty
|
||||
Private m_sConfigDir As String = String.Empty
|
||||
Private m_sTempDir As String = String.Empty
|
||||
Private m_sMachinesRoot As String = String.Empty
|
||||
Private m_sIniFile As String = String.Empty
|
||||
Private m_nDebug As Integer = 0
|
||||
' Opzioni abilitate dalla licenza attiva associata alla chiave
|
||||
'Private m_nKeyOptions As UInteger
|
||||
@@ -151,64 +148,6 @@ Namespace EgtCAM5
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "cmdMainWindow_Closing"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that manage the MainWindow_Unloaded command
|
||||
''' </summary>
|
||||
Public ReadOnly Property cmdMainWindow_Closing() As ICommand
|
||||
Get
|
||||
If m_cmdMainWindow_Closing Is Nothing Then
|
||||
m_cmdMainWindow_Closing = New RelayCommand(AddressOf MainWindow_Closing, AddressOf CanMainWindow_Closing)
|
||||
End If
|
||||
Return m_cmdMainWindow_Closing
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
||||
''' </summary>
|
||||
Public Sub MainWindow_Closing(ByVal param As Object)
|
||||
'Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATION)
|
||||
' '' Gestisco eventuale file corrente modificato
|
||||
'Application.Msn.NotifyColleagues(Application.MANAGEMODIFIED)
|
||||
''If m_allowWindowToClose Then
|
||||
'' CloseCommand = New RelayCommand(Nothing, Function() True)
|
||||
''End If
|
||||
'' Salvo posizione Form (se non minimizzato)
|
||||
'If Application.Current.MainWindow.WindowState <> WindowState.Minimized Then
|
||||
' Dim WinPos As New WinPos
|
||||
' WindowToWinPos(Application.Current.MainWindow, WinPos)
|
||||
' WritePrivateProfileWinPos(S_GENERAL, K_WINPLACE, WinPos.nFlag, WinPos.nLeft, WinPos.nTop, WinPos.nWidth, WinPos.nHeight)
|
||||
'End If
|
||||
'' Terminazione generale di EgtInterface
|
||||
'EgtExit()
|
||||
'' Rilascio mutex
|
||||
'm_objMutex.Close()
|
||||
'' Aggiorno istanze usate
|
||||
'Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
|
||||
'nTmp -= (1 << (m_nInstance - 1))
|
||||
'WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
|
||||
' '' Disabilito gestore Idle
|
||||
''RemoveHandler Application.Idle, AddressOf Application_Idle
|
||||
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Returns true if the application can be closed
|
||||
''' </summary>
|
||||
Private Function CanMainWindow_Closing(ByVal param As Object) As Boolean
|
||||
'' Impedisco uscita se script in esecuzione
|
||||
'If m_bScriptRunning Then
|
||||
' m_bStopScript = True
|
||||
' E.Cancel = True
|
||||
' Return
|
||||
'End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#End Region ' Closing Command
|
||||
|
||||
#Region "CloseApplicationCommand"
|
||||
|
||||
''' <summary>
|
||||
@@ -346,6 +285,14 @@ Namespace EgtCAM5
|
||||
|
||||
Private Sub RegisterMyMessages()
|
||||
Application.Msn.Register(Application.CLOSEAPPLICATIONCOMMAND, Sub()
|
||||
' Terminazione generale di EgtInterface
|
||||
EgtExit()
|
||||
' Rilascio mutex
|
||||
m_objMutex.Close()
|
||||
' Aggiorno istanze usate
|
||||
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
|
||||
nTmp -= (1 << (m_nInstance - 1))
|
||||
WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
|
||||
Application.Current.MainWindow.Close()
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.ALLOWWINDOWTOCLOSE, Sub(bBoolean As Boolean)
|
||||
@@ -374,8 +321,6 @@ Namespace EgtCAM5
|
||||
m_sTempDir = m_sDataRoot & "\" & TEMP_DIR
|
||||
' Impostazione path Ini file
|
||||
m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME
|
||||
' Lo riporto nel modulo IniFile
|
||||
IniFile.m_sIniFilePath = m_sIniFile
|
||||
' Impostazione direttorio per le macchine
|
||||
If GetPrivateProfileString(S_MACH, K_MACHINESDIR, "", m_sMachinesRoot) = 0 Then
|
||||
m_sMachinesRoot = m_sDataRoot & "\" & MACHINES_DFL_DIR
|
||||
@@ -383,8 +328,6 @@ Namespace EgtCAM5
|
||||
IniFile.m_sMachinesRoot = m_sMachinesRoot
|
||||
' Verifico indice di istanza
|
||||
ManageIstance()
|
||||
'Imposto nome file log
|
||||
Dim sCmdLogFile As String = CMDLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
|
||||
' Leggo e imposto chiave di protezione
|
||||
Dim sLicFileName As String = String.Empty
|
||||
GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName)
|
||||
@@ -392,12 +335,14 @@ Namespace EgtCAM5
|
||||
Dim sKey As String = String.Empty
|
||||
EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
|
||||
EgtSetKey(sKey)
|
||||
' Recupero opzioni della chiave
|
||||
Dim bKey As Boolean = EgtGetKeyOptions(3279, 16, 1, m_nKeyOptions)
|
||||
' Recupero livello e opzioni della chiave
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(3279, 16, 1, m_nUserLevel) And
|
||||
EgtGetKeyOptions(3279, 16, 1, m_nKeyOptions)
|
||||
' Inizializzazione generale di EgtInterface
|
||||
m_nDebug = GetPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
|
||||
Dim sLogFile As String = m_sTempDir & "\" & GENLOG_FILE_NAME
|
||||
Dim sLogMsg As String = My.Application.Info.Description.ToString() & " ver. " & My.Application.Info.Version.ToString()
|
||||
Dim sLogFile As String = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
|
||||
Dim sLogMsg As String = "User " & Environment.UserName & "\" & Environment.MachineName & " (" & m_nInstance.ToString() & ")" & vbLf &
|
||||
My.Application.Info.Description.ToString() & " ver. " & My.Application.Info.Version.ToString()
|
||||
EgtInit(m_nDebug, sLogFile, sLogMsg)
|
||||
' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione)
|
||||
Dim sMsgDir As String = String.Empty
|
||||
@@ -412,7 +357,8 @@ Namespace EgtCAM5
|
||||
EgtOutLog("Error in EgtLoadMessages")
|
||||
End If
|
||||
' Leggo e imposto livello utilizzatore
|
||||
IniFile.m_nUserLevel = GetPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1)
|
||||
Dim nIniLev = GetPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1)
|
||||
m_nUserLevel = Math.Min(m_nUserLevel, nIniLev)
|
||||
' imposto dir font Nfe e font default
|
||||
Dim sNfeDir As String = String.Empty
|
||||
GetPrivateProfileString(S_GEOMDB, K_NFEFONTDIR, "", sNfeDir)
|
||||
@@ -426,21 +372,10 @@ Namespace EgtCAM5
|
||||
Dim sLuaBaseLib As String = String.Empty
|
||||
GetPrivateProfileString(S_LUA, K_BASELIB, "EgtBase", sLuaBaseLib)
|
||||
EgtLuaRequire(sLuaBaseLib)
|
||||
'' aggiungo voce per about box nel menù di sistema
|
||||
'Dim hSysMenu As IntPtr = GetSystemMenu(Handle, False)
|
||||
'If hSysMenu <> IntPtr.Zero Then
|
||||
' AppendMenu(hSysMenu, MF_SEPARATOR, 0, "")
|
||||
' AppendMenu(hSysMenu, MF_STRING, IDM_ABOUTBOX, "About TestEIn...")
|
||||
'End If
|
||||
' Posizione e dimensioni del Form
|
||||
Dim WinPos As New WinPos
|
||||
GetPrivateProfileWinPos(S_GENERAL, K_WINPLACE, WinPos.nFlag, WinPos.nLeft, WinPos.nTop, WinPos.nWidth, WinPos.nHeight)
|
||||
WinPosToWindow(Application.Current.MainWindow, WinPos)
|
||||
'If m_Controller.GetCommandLog() Then
|
||||
' tsStatusReg.BackColor = Color.Lime
|
||||
'ElseIf bLuaReg Then
|
||||
' tsStatusReg.BackColor = Color.Red
|
||||
'End If
|
||||
'' Impostazioni MruLists
|
||||
'm_MruFiles.Init(m_sIniFile, S_MRUFILES, 8)
|
||||
'm_MruScripts.Init(m_sIniFile, S_MRUSCRIPTS, 8)
|
||||
|
||||
Reference in New Issue
Block a user