1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
StrCommandLine = FILE_ANSUR + " /r " + FILE_RESULT + FILE_JOBORDER + " /h"
Call Shell(StrCommandLine, 1)
Catch ex As Exception
'Code exécuté en cas d'exception
MsgBox("Erreur")
End Try
'Controle fermeture processus ansur.exe
Dim p As Process = Process.GetProcessesByName("ansur")(0)
AddHandler p.Exited, AddressOf Fermeture
p.EnableRaisingEvents = True
Me.ToolStripProgressBar2.Value = 90
Me.ToolStripStatusLabel3.Text = "Contôle du résultat de test..."
End Sub
Private Sub Fermeture(ByVal sender As Object, ByVal e As EventArgs)
Dim num As Integer = 0
Dim FichierALire As String
Dim i As Integer = 0
FichierALire = FILE_RESULT & dossiertable & ".mtr"
Try
Dim sr As StreamReader = New StreamReader(FichierALire, System.Text.Encoding.Default)
Dim ligne As String
'--- Traitement du fichier ligne par ligne
While Not sr.EndOfStream()
ligne = sr.ReadLine()
If ligne = " <Status>Passed</Status>" Then
i = (i + 1)
End If
End While
'--- Referme StreamReader
sr.Close()
If i = 14 Then
'MsgBox("Test passé !")
num = 1
Else
'MsgBox("Test échoué !")
num = 2
End If
Catch ex As Exception
'traitement de l'exception sinon :
Throw ex
End Try
Call resultattest(num)
End Sub
Private Sub resultattest(ByVal num As Integer)
'MsgBox(num)
Me.ToolStripProgressBar2.Value = 100
Me.ToolStripStatusLabel3.Text = "Terminé."
If num = 1 Then
Me.PictureBox24.Visible = True
Else
Me.PictureBox23.Visible = True
End If
End Sub |
Partager