public async Task Loop(List <Task> tasks) { ulong currentProgress; ulong fullProgress; while (!IsPartAllComplete() || FullProgress != CurrentProgress) { if (isCanceled) { return; } currentProgress = 0; fullProgress = 0; foreach (var part in PartList) { currentProgress += part.Task.DownloadedBytes; fullProgress += part.Task.TotalBytes; } if (currentProgress == 0)//防止进度条卡满 { this.FullProgress = 100; this.CurrentProgress = 0; await Task.Delay(1000); continue; } CurrentProgress = currentProgress; FullProgress = fullProgress; CurrentSpeed = PartList.Sum(x => (long)x.Task.DeltaBytes).ToString(); await Task.Delay(1000); } await Task.WhenAll(tasks); ChineseStatus = "合并中"; await OnCompleteAsync(); }