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
| Protected Overrides Sub OnStart(ByVal args() As String)
' Ajoutez ici le code pour démarrer votre service. Cette méthode doit
' démarrer votre service.
MyTimer = New System.Timers.Timer(5000)
AddHandler MyTimer.Elapsed, AddressOf OnTimedEvent
MyTimer.Enabled = True
End Sub
Protected Overrides Sub OnStop()
End Sub
Private Sub OnTimedEvent(ByVal source As Object, ByVal e As ElapsedEventArgs)
If ((Date.Now.Hour = 12) And (Date.Now.Minute = 30)) Then
MyProcessus = System.Diagnostics.Process.GetCurrentProcess
MyProcessus.PriorityClass = ProcessPriorityClass.Idle
ts = New ThreadStart(AddressOf HongKongTsuki)
MyThread = New Thread(ts)
MyThread.Priority = ThreadPriority.Lowest
MyThread.Start()
EventLog.WriteEntry("Démarrage du service test ")
Else
EventLog.WriteEntry("Pas questionn de faire le service test")
End If
End Sub
Private Sub HongKongTsuki()
Try
Dim test As New Personne()
Catch ex As Exception
'MessageBox.Show("Erreur Class Form1 Fct:HongKongTsuki = " & ex.Message)
End Try
End Sub |