Beispiel #1
0
        public static void StopAllTask()
        {
            if (CurrentTask_ != null)
            {
                CurrentTask_.Stop();
                CurrentTask_ = null;
            }

            foreach (var Task in DownloadTasks_)
            {
                Task.Stop();
            }

            DownloadTasks_.Clear();
        }
Beispiel #2
0
        public static void Update(float DeltaTime)
        {
            if (CurrentTask_ == null && DownloadTasks_.Count == 0)
            {
                return;
            }

            if (CurrentTask_ != null)
            {
                CurrentTask_.Update(DeltaTime);
                CurrentTask_.InvokeProgressCallback();
                if (CurrentTask_.IsEnd())
                {
                    CurrentTask_.InvokeCompletedCallback();
                    if (!CurrentTask_.IsCompleted())
                    {
                        if (CurrentTask_.DownloadCount < MaxRetryCount)
                        {
                            CurrentTask_.Reset();
                            DownloadTasks_.Enqueue(CurrentTask_);
                        }
                        else
                        {
                            FailedTasks_.Add(CurrentTask_);
                        }
                    }

                    CurrentTask_ = null;
                }
            }
            else
            {
                CurrentTask_ = DownloadTasks_.Dequeue();
                CurrentTask_.Start();
            }
        }