EgtCAM5 :
- migliorata differenziazione tra mancanza chiave e problemi con licenza - in caso di problemi con licenza possibilità di sceglierne una nuova con dialogo ApriFile.
This commit is contained in:
@@ -142,25 +142,13 @@ Namespace EgtCAM5
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Loaded(ByVal param As Object)
|
||||
' Verifico sia la prima volta
|
||||
If m_bLoaded Then Return
|
||||
m_bLoaded = True
|
||||
' Creazione scena
|
||||
PreInitializeScene()
|
||||
If Not m_ProjectScene.Init() Then
|
||||
EgtOutLog("Error in Project scene creation")
|
||||
SceneHost.Child = Nothing
|
||||
' Box di avviso chiave mancante
|
||||
MsgBox(EgtMsg(MSG_MISSINGKEYWD + 2) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 3), MsgBoxStyle.OkOnly, EgtMsg(MSG_MISSINGKEYWD + 1))
|
||||
' Chiudo il programma
|
||||
IniFile.m_bFailedRun = True
|
||||
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND)
|
||||
' Verifico abilitazione prodotto
|
||||
ElseIf (IniFile.m_nKeyOptions And KEY_OPT.BASE) = 0 Then
|
||||
MsgBox(EgtMsg(MSG_MISSINGKEYWD + 5), MsgBoxStyle.OkOnly, EgtMsg(MSG_MISSINGKEYWD + 1))
|
||||
' Chiudo il programma
|
||||
IniFile.m_bFailedRun = True
|
||||
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND)
|
||||
Else
|
||||
' Se tutto bene
|
||||
If m_ProjectScene.Init() And (IniFile.m_nKeyOptions And KEY_OPT.BASE) <> 0 Then
|
||||
IniFile.m_ProjectSceneContext = m_ProjectScene.GetCtx
|
||||
PostInitializeScene()
|
||||
' Recupero e imposto handle finestra principale
|
||||
@@ -170,10 +158,46 @@ Namespace EgtCAM5
|
||||
EgtInitMachMgr(IniFile.m_sMachinesRoot)
|
||||
' Apro progetto vuoto
|
||||
EgtCAM5Map.refTopCommandBarVM.NewCmd()
|
||||
' Seleziono la macchina impostata nel file ini
|
||||
Application.Msn.NotifyColleagues(Application.LOADCURRENTMACHINE)
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
Return
|
||||
End If
|
||||
' Seleziono la macchina impostata nel file ini
|
||||
Application.Msn.NotifyColleagues(Application.LOADCURRENTMACHINE)
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
' Problemi
|
||||
SceneHost.Child = Nothing
|
||||
' Se manca la chiave
|
||||
If IniFile.m_nKeyLevel = -1 Or IniFile.m_nKeyLevel = -2 Then
|
||||
EgtOutLog("Missing Dongle")
|
||||
' Box di avviso chiave mancante : "Chiave non presente. \n Inserirla e riavviare il programma." "Errore"
|
||||
Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 2) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 3)
|
||||
Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
|
||||
MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
' Altrimenti manca la licenza
|
||||
Else
|
||||
EgtOutLog("Problems with Licence")
|
||||
' Box di avviso licenza con problemi : "Programma senza licenza. \n Caricala e riavvia il programma." "Errore"
|
||||
Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 5) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 6)
|
||||
Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
|
||||
If MessageBox.Show(sText, sTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) = MessageBoxResult.OK Then
|
||||
' Apro dialogo per richiesta file licenza
|
||||
Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With {
|
||||
.DefaultExt = ".lic",
|
||||
.Filter = "Licences (.lic)|*.lic",
|
||||
.CheckFileExists = True,
|
||||
.ValidateNames = True
|
||||
}
|
||||
If LicDlg.ShowDialog() = True Then
|
||||
' Copio il file nel direttorio di configurazione del programma
|
||||
Dim sDestFile As String = IniFile.m_sConfigDir & "\" & LicDlg.SafeFileName
|
||||
My.Computer.FileSystem.CopyFile(LicDlg.FileName, sDestFile, True)
|
||||
' Imposto il nuovo file di licenza nell'Ini
|
||||
WritePrivateProfileString(S_GENERAL, K_LICENCE, LicDlg.SafeFileName)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
' Chiudo il programma
|
||||
IniFile.m_bFailedRun = True
|
||||
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND)
|
||||
End Sub
|
||||
|
||||
#End Region ' LoadedCommand
|
||||
|
||||
Reference in New Issue
Block a user