private void OnDownloadCompleted(object sender, DownloadFileCompletedEventArgs e) { var downloadedPicture = DownloadablePictures.FirstOrDefault(elem => elem.PictureName == e.DownloadedFileName); if (downloadedPicture != null) { downloadedPicture.IsDownloaded = true; } }
private void OnDownloadStarted(object sender, DownloadFileStartedEventArgs e) { if (DownloadablePictures == null || DownloadablePictures.Count == 0) { return; } var downloadablePicture = DownloadablePictures.FirstOrDefault(elem => elem.PictureName == e.DownloadedFileName); if (downloadablePicture != null) { _dropBoxCloudStorageManager.DownloadProgressChangedCallback = downloadablePicture.OnDownloadProgressChanged; } }
private async void Download(object parameter) { DownloadablePictureViewModel.Cancel = false; foreach (var downloadablePicture in DownloadablePictures) { downloadablePicture.DownloadProgress = 0; downloadablePicture.IsDownloaded = false; } IsDownloading = true; var downloadedCount = await _dropBoxCloudStorageManager .DownloadFilesAsync(DownloadablePictures .Where(elem => elem.ReadyForDownload) .Select(p => p.PictureName), _targetFolder); IsDownloading = false; }