Created
June 3, 2018 17:12
-
-
Save NMZivkovic/9941be3f29b1fd41e5ab01d84d57ae66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async Task<int> UploadFilesAsync(List<File> listOfFiles, IProgress<int> progress) | |
{ | |
int processCount = await Task.Run<int>(() => | |
{ | |
int tempCount = 0; | |
foreach (var file in listOfFiles) | |
{ | |
//await the uploading logic here | |
int processed = await UploadFileAsync(file); | |
if (progress != null) | |
{ | |
progress.Report(tempCount); | |
} | |
tempCount++; | |
} | |
return tempCount; | |
}); | |
return processCount; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment