Added TrangaTask.RemoveChildTask
This commit is contained in:
parent
8b58e7dd13
commit
93de471836
@ -76,11 +76,8 @@ public abstract class TrangaTask
|
|||||||
|
|
||||||
public void ReplaceFailedChildTask(DownloadChapterTask failed, DownloadChapterTask newTask)
|
public void ReplaceFailedChildTask(DownloadChapterTask failed, DownloadChapterTask newTask)
|
||||||
{
|
{
|
||||||
if (!this.childTasks.Contains(failed))
|
this.RemoveChildTask(failed);
|
||||||
throw new ArgumentException($"Task {failed} is not childTask of {this}");
|
this.AddChildTask(newTask);
|
||||||
this.childTasks.Remove(failed);
|
|
||||||
this.childTasks.Add(newTask);
|
|
||||||
this.DecrementProgress(failed.progress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddChildTask(TrangaTask childTask)
|
public void AddChildTask(TrangaTask childTask)
|
||||||
@ -88,6 +85,12 @@ public abstract class TrangaTask
|
|||||||
this.childTasks.Add(childTask);
|
this.childTasks.Add(childTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveChildTask(TrangaTask childTask)
|
||||||
|
{
|
||||||
|
this.childTasks.Remove(childTask);
|
||||||
|
this.DecrementProgress(childTask.progress);
|
||||||
|
}
|
||||||
|
|
||||||
public void IncrementProgress(double amount)
|
public void IncrementProgress(double amount)
|
||||||
{
|
{
|
||||||
this.lastChange = DateTime.Now;
|
this.lastChange = DateTime.Now;
|
||||||
|
Loading…
Reference in New Issue
Block a user