2
0

Added TrangaTask.RemoveChildTask

This commit is contained in:
glax 2023-06-15 18:22:59 +02:00
parent 8b58e7dd13
commit 93de471836

View File

@ -76,11 +76,8 @@ public abstract class TrangaTask
public void ReplaceFailedChildTask(DownloadChapterTask failed, DownloadChapterTask newTask)
{
if (!this.childTasks.Contains(failed))
throw new ArgumentException($"Task {failed} is not childTask of {this}");
this.childTasks.Remove(failed);
this.childTasks.Add(newTask);
this.DecrementProgress(failed.progress);
this.RemoveChildTask(failed);
this.AddChildTask(newTask);
}
public void AddChildTask(TrangaTask childTask)
@ -88,6 +85,12 @@ public abstract class TrangaTask
this.childTasks.Add(childTask);
}
public void RemoveChildTask(TrangaTask childTask)
{
this.childTasks.Remove(childTask);
this.DecrementProgress(childTask.progress);
}
public void IncrementProgress(double amount)
{
this.lastChange = DateTime.Now;