public async void ProgressDownload(ProgressDownload progress) { Console.WriteLine("[Downloadanager] ProgressDownload"); Console.WriteLine("[Downloadanager] ProgressDownload Id : {0}", progress.Id); Console.WriteLine("[Downloadanager] ProgressDownload Written : {0}", progress.Written); Console.WriteLine("[Downloadanager] ProgressDownload Total : {0}", progress.Total); Download download; bool found = _repo.TryById(progress.Id, out download); if (!found) { await _bus.SendAsync <DownloadError> (new DownloadError { Id = progress.Id, Error = ErrorEnum.ProgressDownload_IdentifierNotFound }); return; } bool progressed = download.TryProgress(progress.Written, progress.Total); _repo.Update(download); await _bus.SendAsync <NotifyProgress> (new NotifyProgress { Url = download.Url, Download = download }); if (!progressed) { await _bus.SendAsync <DownloadError> (new DownloadError { Id = progress.Id, Error = ErrorEnum.ProgressDownload_OutOfOrder }); return; } }
public async void ProgressDownload (ProgressDownload progress) { Console.WriteLine("[Downloadanager] ProgressDownload"); Console.WriteLine("[Downloadanager] ProgressDownload Id : {0}", progress.Id); Console.WriteLine("[Downloadanager] ProgressDownload Written : {0}", progress.Written); Console.WriteLine("[Downloadanager] ProgressDownload Total : {0}", progress.Total); Download download; bool found = _repo.TryById (progress.Id, out download); if (!found) { await _bus.SendAsync<DownloadError> (new DownloadError { Id = progress.Id, Error = ErrorEnum.ProgressDownload_IdentifierNotFound }); return; } bool progressed = download.TryProgress (progress.Written, progress.Total); _repo.Update (download); await _bus.SendAsync<NotifyProgress> (new NotifyProgress { Url = download.Url, Download = download }); if (!progressed) { await _bus.SendAsync<DownloadError> (new DownloadError { Id = progress.Id, Error = ErrorEnum.ProgressDownload_OutOfOrder }); return; } }