Cancelling a Scheduled Task
You can cancel a scheduled task in several ways.
- To cancel the current run of a scheduled task, callScheduledTask.RemoveScheduledTask. This method does not cancel subsequent runs of theScheduledTask.
- To cancel an upcoming run of aScheduledTask, callScheduledTask.ReconfigureScheduledTaskwith a newScheduledTaskSpecdata object containing the new specifications for the schedule.
- To cancel aScheduledTaskthat spawns a second task, create aPropertyCollectorto obtain the reference to theTasksand call itsCancelTaskmethod. The task must be cancellable.