TestEIn 1.6r7 :

- modifiche per uscire dal programma in modo sicuro mentre uno script è in esecuzione.
This commit is contained in:
Dario Sassi
2016-05-30 08:57:08 +00:00
parent 3e8d8c93c4
commit 3147a8399b
2 changed files with 22 additions and 9 deletions
+20 -7
View File
@@ -40,7 +40,8 @@ Public Class Form1
Private WithEvents m_Controller As New Controller
Private m_MruFiles As New MruList
Private m_MruScripts As New MruList
Private m_bStopExec As Boolean = False
Private m_bScriptRunning As Boolean = False
Private m_bStopScript As Boolean = False
Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents)
Private m_OutTextCallback As New OutTextCallback(AddressOf OutText)
@@ -395,7 +396,13 @@ Public Class Form1
End Sub
Private Sub Form1_FormClosing(sender As System.Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
' gestisco eventuale file corrente modificato
' Impedisco uscita se script in esecuzione
If m_bScriptRunning Then
m_bStopScript = True
e.Cancel = True
Return
End If
' Gestisco eventuale file corrente modificato
If Not m_Controller.ManageModified() Then
e.Cancel = True
Return
@@ -573,12 +580,15 @@ Public Class Form1
Private Sub OnExecutingScript(ByVal sender As Object) Handles m_Controller.OnExecutingScript
ClearObjTree()
' Abilito progress e bottone stop
m_bStopExec = False
tsStatusStop.Enabled = True
tsStatusProgress.Value = 0
tsStatusStop.Enabled = True
m_bStopScript = False
' Dichiaro script in esecuzione
m_bScriptRunning = True
End Sub
Private Sub OnExecutedScript(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean, ByVal sError As String) Handles m_Controller.OnExecutedScript
' Salvo path dello script in lista recenti
WritePrivateProfileString(S_GENERAL, K_LASTLUADIR, Path.GetDirectoryName(sFile), m_sIniFile)
If bOk Then
m_MruScripts.Add(sFile)
@@ -587,8 +597,10 @@ Public Class Form1
MessageBox.Show(sError, EgtMsg(10001), MessageBoxButtons.OK, MessageBoxIcon.Error) ' Error
End If
' Disabilito progress e bottone stop
tsStatusStop.Enabled = False
tsStatusProgress.Value = 0
tsStatusStop.Enabled = False
' Dichiaro terminata esecuzione script
m_bScriptRunning = False
End Sub
Private Sub OnPrepareInputBox(ByVal sTitle As String, ByVal sLabel As String, ByVal sCheckLabel As String,
@@ -796,7 +808,8 @@ Public Class Form1
' Eventuale attesa
Thread.Sleep(nPause)
' Ritorno eventuale stop
If m_bStopExec Then
If m_bStopScript Then
m_bStopScript = False
Return 0
Else
Return 1
@@ -1863,7 +1876,7 @@ Public Class Form1
End Sub
Private Sub ToolStripStatusStop_Click() Handles tsStatusStop.Click
m_bStopExec = True
m_bStopScript = True
End Sub
+2 -2
View File
@@ -46,5 +46,5 @@ Imports System.Runtime.InteropServices
' utilizzando l'asterisco (*) come descritto di seguito:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.6.18.3")>
<Assembly: AssemblyFileVersion("1.6.18.3")>
<Assembly: AssemblyVersion("1.6.18.7")>
<Assembly: AssemblyFileVersion("1.6.18.7")>