@@ -46,6 +46,7 @@ public class ItemViewModel : ObservableObject, IDisposable
46
46
{
47
47
private readonly SemaphoreSlim enumFolderSemaphore ;
48
48
private readonly ConcurrentQueue < ( uint Action , string FileName ) > operationQueue ;
49
+ private readonly ConcurrentDictionary < string , bool > itemLoadQueue ;
49
50
private readonly AsyncManualResetEvent operationEvent , loadPropsEvent ;
50
51
private IntPtr hWatchDir ;
51
52
private IAsyncAction aWatcherAction ;
@@ -344,6 +345,7 @@ public ItemViewModel(FolderSettingsViewModel folderSettingsViewModel)
344
345
filesAndFolders = new List < ListedItem > ( ) ;
345
346
FilesAndFolders = new BulkConcurrentObservableCollection < ListedItem > ( ) ;
346
347
operationQueue = new ConcurrentQueue < ( uint Action , string FileName ) > ( ) ;
348
+ itemLoadQueue = new ConcurrentDictionary < string , bool > ( ) ;
347
349
addFilesCTS = new CancellationTokenSource ( ) ;
348
350
semaphoreCTS = new CancellationTokenSource ( ) ;
349
351
loadPropsCTS = new CancellationTokenSource ( ) ;
@@ -452,6 +454,11 @@ public void CancelExtendedPropertiesLoading()
452
454
loadPropsCTS = new CancellationTokenSource ( ) ;
453
455
}
454
456
457
+ public void CancelExtendedPropertiesLoadingForItem ( ListedItem item )
458
+ {
459
+ itemLoadQueue . TryUpdate ( item . ItemPath , true , false ) ;
460
+ }
461
+
455
462
public async Task ApplySingleFileChangeAsync ( ListedItem item )
456
463
{
457
464
var newIndex = filesAndFolders . IndexOf ( item ) ;
@@ -900,13 +907,19 @@ public async Task LoadExtendedItemProperties(ListedItem item, uint thumbnailSize
900
907
}
901
908
902
909
item . ItemPropertiesInitialized = true ;
910
+ itemLoadQueue [ item . ItemPath ] = false ;
903
911
904
912
try
905
913
{
906
914
await Task . Run ( async ( ) =>
907
915
{
908
916
await loadPropsEvent . WaitAsync ( loadPropsCTS . Token ) ;
909
917
918
+ if ( itemLoadQueue . TryGetValue ( item . ItemPath , out var canceled ) && canceled )
919
+ {
920
+ return ;
921
+ }
922
+
910
923
var wasSyncStatusLoaded = false ;
911
924
ImageSource groupImage = null ;
912
925
bool loadGroupHeaderInfo = false ;
@@ -1032,6 +1045,10 @@ await FilesystemTasks.Wrap(() => CoreApplication.MainView.DispatcherQueue.Enqueu
1032
1045
{
1033
1046
// ignored
1034
1047
}
1048
+ finally
1049
+ {
1050
+ itemLoadQueue . TryRemove ( item . ItemPath , out _ ) ;
1051
+ }
1035
1052
}
1036
1053
1037
1054
private async Task < ImageSource > GetItemTypeGroupIcon ( ListedItem item , BaseStorageFile matchingStorageItem = null )
0 commit comments