Stopping scheduled service run when app eixts

sconlon

Active Member
Licensed User
Longtime User
In activity_create I start a service which reschedules itself to run every 60 secs by using StartServiceAt within the Service_Start sub

When I exit the app I stop the service but if it has already scheduled a rerun of itself that will still run. So in the Service_start sub I check if a restart should be scheduled:

If restart Then
StartServiceAt("", DateTime.Now + 60 * DateTime.TicksPerSecond, True)
End If

where 'restart' is a boolean set to true in the process globals. But I really want to stop the scheduled run when the app exits? Is this possible?
 
Top