Added CancellationToken to TrangaTask #14

This commit is contained in:
2023-06-10 14:27:09 +02:00
parent 32f89f9dce
commit 1c94625840
9 changed files with 63 additions and 28 deletions

View File

@ -20,10 +20,12 @@ public class DownloadChapterTask : TrangaTask
this.parentTask = parentTask;
}
protected override void ExecuteTask(TaskManager taskManager, Logger? logger)
protected override void ExecuteTask(TaskManager taskManager, Logger? logger, CancellationToken? cancellationToken = null)
{
if (cancellationToken?.IsCancellationRequested??false)
return;
Connector connector = taskManager.GetConnector(this.connectorName);
connector.DownloadChapter(this.publication, this.chapter, this);
connector.DownloadChapter(this.publication, this.chapter, this, cancellationToken);
taskManager.DeleteTask(this);
}