Browse Source

print out thumbnail loading status to console

main
Colin McMillen 9 months ago
parent
commit
e9a13dba49
  1. 13
      Program.cs

13
Program.cs

@ -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:

Loading…
Cancel
Save