Instead of relying on concreate tasks to do chores, create method in abstract class that calls the BL in concrete class and does chores before and after execution

This commit is contained in:
2023-06-01 10:35:23 +02:00
parent 48b7371a18
commit 8bc23f7c69
3 changed files with 21 additions and 23 deletions

View File

@ -8,9 +8,8 @@ public class DownloadNewChaptersTask : TrangaTask
{
}
public override void Execute(TaskManager taskManager, Logger? logger)
protected override void ExecuteTask(TaskManager taskManager, Logger? logger)
{
StartExecutionChores(logger);
Publication pub = (Publication)this.publication!;
Connector connector = taskManager.GetConnector(this.connectorName);
@ -26,8 +25,6 @@ public class DownloadNewChaptersTask : TrangaTask
foreach(Chapter newChapter in newChapters)
connector.DownloadChapter(pub, newChapter);
EndExecutionChores(logger);
}
/// <summary>

View File

@ -8,9 +8,8 @@ public class UpdateKomgaLibraryTask : TrangaTask
{
}
public override void Execute(TaskManager taskManager, Logger? logger)
protected override void ExecuteTask(TaskManager taskManager, Logger? logger)
{
StartExecutionChores(logger);
if (taskManager.komga is null)
return;
Komga komga = taskManager.komga;
@ -18,6 +17,5 @@ public class UpdateKomgaLibraryTask : TrangaTask
Komga.KomgaLibrary[] allLibraries = komga.GetLibraries();
foreach (Komga.KomgaLibrary lib in allLibraries)
komga.UpdateLibrary(lib.id);
EndExecutionChores(logger);
}
}