print out thumbnail loading status to console
This commit is contained in:
parent
870daa3851
commit
e9a13dba49
13
Program.cs
13
Program.cs
@ -378,6 +378,8 @@ public class Game : GameWindow {
|
|||||||
int VertexBufferObject;
|
int VertexBufferObject;
|
||||||
int ElementBufferObject;
|
int ElementBufferObject;
|
||||||
int VertexArrayObject;
|
int VertexArrayObject;
|
||||||
|
readonly object thumbnailsLoadedLock = new();
|
||||||
|
int thumbnailsLoaded = 0;
|
||||||
List<Photo> allPhotos = new();
|
List<Photo> allPhotos = new();
|
||||||
List<Photo> photos = new();
|
List<Photo> photos = new();
|
||||||
HashSet<Photo> loadedImages = new();
|
HashSet<Photo> loadedImages = new();
|
||||||
@ -720,9 +722,18 @@ public class Game : GameWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async void LoadThumbnailsAsync() {
|
private async void LoadThumbnailsAsync() {
|
||||||
|
List<Task> tasks = new();
|
||||||
foreach (Photo p in allPhotos) {
|
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:
|
// To find the JPEG compression level of a file from the command line:
|
||||||
|
Loading…
Reference in New Issue
Block a user