Moved sucessstate to taskmanager
This commit is contained in:
parent
98946b4aa3
commit
a1202a875d
@ -88,6 +88,21 @@ public class TaskManager
|
||||
_runningTasks[timedOutTask].Cancel();
|
||||
timedOutTask.state = TrangaTask.ExecutionState.Failed;
|
||||
}
|
||||
|
||||
foreach (TrangaTask finishedTask in _allTasks
|
||||
.Where(taskQuery => taskQuery.state is TrangaTask.ExecutionState.Success).ToArray())
|
||||
{
|
||||
if(finishedTask is DownloadChapterTask)
|
||||
{
|
||||
DeleteTask(finishedTask);
|
||||
finishedTask.state = TrangaTask.ExecutionState.Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
finishedTask.state = TrangaTask.ExecutionState.Waiting;
|
||||
this._runningTasks.Remove(finishedTask);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (TrangaTask failedTask in _allTasks.Where(taskQuery =>
|
||||
taskQuery.state is TrangaTask.ExecutionState.Failed).ToArray())
|
||||
|
@ -100,10 +100,7 @@ public abstract class TrangaTask
|
||||
if ((int)statusCode >= 200 && (int)statusCode < 300)
|
||||
{
|
||||
this.lastExecuted = DateTime.Now;
|
||||
if(this is DownloadChapterTask)
|
||||
this.state = ExecutionState.Success;
|
||||
else
|
||||
this.state = ExecutionState.Waiting;
|
||||
this.state = ExecutionState.Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user