8
8
using Files . Filesystem . StorageEnumerators ;
9
9
using Files . Filesystem . StorageItems ;
10
10
using Files . Helpers ;
11
- using Files . Helpers . FileListCache ;
12
11
using Files . UserControls ;
13
12
using FluentFTP ;
14
13
using Microsoft . Toolkit . Mvvm . ComponentModel ;
@@ -68,8 +67,6 @@ public class ItemViewModel : ObservableObject, IDisposable
68
67
69
68
public event EventHandler < List < ListedItem > > OnSelectionRequestedEvent ;
70
69
71
- private IFileListCache fileListCache = FileListCacheController . GetInstance ( ) ;
72
-
73
70
private NamedPipeAsAppServiceConnection connection ;
74
71
75
72
private NamedPipeAsAppServiceConnection Connection
@@ -940,14 +937,17 @@ await Task.Run(async () =>
940
937
{
941
938
if ( ! item . IsShortcutItem && ! item . IsHiddenItem && ! FtpHelpers . IsFtpPath ( item . ItemPath ) )
942
939
{
940
+ cts . Token . ThrowIfCancellationRequested ( ) ;
943
941
matchingStorageFile = await GetFileFromPathAsync ( item . ItemPath ) ;
944
942
if ( matchingStorageFile != null )
945
943
{
944
+ cts . Token . ThrowIfCancellationRequested ( ) ;
946
945
await LoadItemThumbnail ( item , thumbnailSize , matchingStorageFile , true ) ;
947
-
948
946
var syncStatus = await CheckCloudDriveSyncStatusAsync ( matchingStorageFile ) ;
949
947
var fileFRN = await FileTagsHelper . GetFileFRN ( matchingStorageFile ) ;
950
948
var fileTag = FileTagsHelper . ReadFileTag ( item . ItemPath ) ;
949
+
950
+ cts . Token . ThrowIfCancellationRequested ( ) ;
951
951
await CoreApplication . MainView . DispatcherQueue . EnqueueAsync ( ( ) =>
952
952
{
953
953
item . FolderRelativeId = matchingStorageFile . FolderRelativeId ;
@@ -969,27 +969,32 @@ await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() =>
969
969
{
970
970
if ( ! item . IsShortcutItem && ! item . IsHiddenItem && ! FtpHelpers . IsFtpPath ( item . ItemPath ) )
971
971
{
972
+ cts . Token . ThrowIfCancellationRequested ( ) ;
972
973
BaseStorageFolder matchingStorageFolder = await GetFolderFromPathAsync ( item . ItemPath ) ;
973
974
if ( matchingStorageFolder != null )
974
975
{
976
+ cts . Token . ThrowIfCancellationRequested ( ) ;
975
977
await LoadItemThumbnail ( item , thumbnailSize , matchingStorageFolder , true ) ;
976
978
if ( matchingStorageFolder . DisplayName != item . ItemName && ! matchingStorageFolder . DisplayName . StartsWith ( "$R" ) )
977
979
{
980
+ cts . Token . ThrowIfCancellationRequested ( ) ;
978
981
await CoreApplication . MainView . DispatcherQueue . EnqueueAsync ( ( ) =>
979
982
{
980
983
item . ItemName = matchingStorageFolder . DisplayName ;
981
984
} ) ;
982
- await fileListCache . SaveFileDisplayNameToCache ( item . ItemPath , matchingStorageFolder . DisplayName ) ;
985
+
983
986
if ( folderSettings . DirectorySortOption == SortOption . Name && ! isLoadingItems )
984
987
{
985
988
await OrderFilesAndFoldersAsync ( ) ;
986
989
await ApplySingleFileChangeAsync ( item ) ;
987
990
}
988
991
}
989
992
993
+ cts . Token . ThrowIfCancellationRequested ( ) ;
990
994
var syncStatus = await CheckCloudDriveSyncStatusAsync ( matchingStorageFolder ) ;
991
995
var fileFRN = await FileTagsHelper . GetFileFRN ( matchingStorageFolder ) ;
992
996
var fileTag = FileTagsHelper . ReadFileTag ( item . ItemPath ) ;
997
+ cts . Token . ThrowIfCancellationRequested ( ) ;
993
998
await CoreApplication . MainView . DispatcherQueue . EnqueueAsync ( ( ) =>
994
999
{
995
1000
item . FolderRelativeId = matchingStorageFolder . FolderRelativeId ;
@@ -1004,12 +1009,14 @@ await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() =>
1004
1009
}
1005
1010
if ( ! wasSyncStatusLoaded )
1006
1011
{
1012
+ cts . Token . ThrowIfCancellationRequested ( ) ;
1007
1013
await LoadItemThumbnail ( item , thumbnailSize , null , true ) ;
1008
1014
}
1009
1015
}
1010
1016
1011
1017
if ( loadGroupHeaderInfo && isFileTypeGroupMode )
1012
1018
{
1019
+ cts . Token . ThrowIfCancellationRequested ( ) ;
1013
1020
groupImage = await GetItemTypeGroupIcon ( item , matchingStorageFile ) ;
1014
1021
}
1015
1022
}
@@ -1020,6 +1027,7 @@ await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() =>
1020
1027
{
1021
1028
if ( ! wasSyncStatusLoaded )
1022
1029
{
1030
+ cts . Token . ThrowIfCancellationRequested ( ) ;
1023
1031
await FilesystemTasks . Wrap ( async ( ) =>
1024
1032
{
1025
1033
var fileTag = FileTagsHelper . ReadFileTag ( item . ItemPath ) ;
@@ -1034,6 +1042,7 @@ await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() =>
1034
1042
1035
1043
if ( loadGroupHeaderInfo )
1036
1044
{
1045
+ cts . Token . ThrowIfCancellationRequested ( ) ;
1037
1046
await FilesystemTasks . Wrap ( ( ) => CoreApplication . MainView . DispatcherQueue . EnqueueAsync ( ( ) =>
1038
1047
{
1039
1048
gp . Model . ImageSource = groupImage ;
0 commit comments