print out thumbnail loading status to console

This commit is contained in:
Colin McMillen 2023-08-26 00:12:31 -04:00
parent 870daa3851
commit e9a13dba49

View File

@ -378,6 +378,8 @@ public class Game : GameWindow {
int VertexBufferObject;
int ElementBufferObject;
int VertexArrayObject;
readonly object thumbnailsLoadedLock = new();
int thumbnailsLoaded = 0;
List<Photo> allPhotos = new();
List<Photo> photos = new();
HashSet<Photo> loadedImages = new();
@ -720,9 +722,18 @@ public class Game : GameWindow {
}
private async void LoadThumbnailsAsync() {
List<Task> tasks = new();
foreach (Photo p in allPhotos) {
await Task.Run( () => { p.LoadThumbnailAsync(geometry.ThumbnailSize); });
tasks.Add(Task.Run( () => {
p.LoadThumbnailAsync(geometry.ThumbnailSize);
lock (thumbnailsLoadedLock) {
thumbnailsLoaded++;
Console.WriteLine(thumbnailsLoaded);
}
}));
}
Console.WriteLine("TASKS: " + tasks.Count);
await Task.WhenAll(tasks).ContinueWith(t => { Console.WriteLine("done????"); });
}
// To find the JPEG compression level of a file from the command line: