@@ -543,14 +543,6 @@ internal set
543
543
}
544
544
}
545
545
546
- class PartialStorageItem
547
- {
548
- public string ItemName { get ; set ; }
549
- public string ContentType { get ; set ; }
550
- public StorageItemThumbnail Thumbnail { get ; set ; }
551
- public string RelativeId { get ; set ; }
552
- }
553
-
554
546
public async void LoadExtendedItemProperties ( ListedItem item )
555
547
{
556
548
if ( ! item . ItemPropertiesInitialized )
@@ -661,10 +653,6 @@ public async void RapidAddItemsToCollectionAsync(string path)
661
653
App . CurrentInstance . CanGoBack = App . CurrentInstance . ContentFrame . CanGoBack ;
662
654
App . CurrentInstance . CanGoForward = App . CurrentInstance . ContentFrame . CanGoForward ;
663
655
664
- ObservableCollection < PartialStorageItem > partialFiles = null ;
665
- ObservableCollection < PartialStorageItem > partialFolders = null ;
666
- var fetchOperation = Task . Run ( async ( ) =>
667
- {
668
656
try
669
657
{
670
658
_rootFolder = await StorageFolder . GetFolderFromPathAsync ( path ) ;
@@ -691,45 +679,6 @@ public async void RapidAddItemsToCollectionAsync(string path)
691
679
return ;
692
680
}
693
681
694
- QueryOptions options = new QueryOptions ( ) ;
695
- if ( await _rootFolder . GetIndexedStateAsync ( ) == IndexedState . FullyIndexed )
696
- {
697
- options . IndexerOption = IndexerOption . OnlyUseIndexerAndOptimizeForIndexedProperties ;
698
- }
699
- else
700
- {
701
- options . IndexerOption = IndexerOption . UseIndexerWhenAvailable ;
702
- }
703
- options . FolderDepth = FolderDepth . Shallow ;
704
-
705
- options . SetPropertyPrefetch ( PropertyPrefetchOptions . None , null ) ;
706
- options . SetThumbnailPrefetch ( ThumbnailMode . ListView , 40 , ThumbnailOptions . ReturnOnlyIfCached ) ;
707
- var query = _rootFolder . CreateItemQueryWithOptions ( options ) ;
708
- var thumbnails = await query . GetItemsAsync ( 0 , 250 ) ;
709
- uint index = 0 ;
710
- partialFiles = new ObservableCollection < PartialStorageItem > ( ) ;
711
- partialFolders = new ObservableCollection < PartialStorageItem > ( ) ;
712
-
713
- while ( thumbnails . Count > 0 )
714
- {
715
- foreach ( IStorageItem item in thumbnails )
716
- {
717
- if ( item . IsOfType ( StorageItemTypes . Folder ) )
718
- {
719
- partialFolders . Add ( new PartialStorageItem ( ) { RelativeId = ( ( StorageFolder ) item ) . FolderRelativeId , ItemName = item . Name , ContentType = null , Thumbnail = null } ) ;
720
- }
721
- else
722
- {
723
- partialFiles . Add ( new PartialStorageItem ( ) { RelativeId = ( ( StorageFile ) item ) . FolderRelativeId , Thumbnail = await ( ( StorageFile ) item ) . GetThumbnailAsync ( ThumbnailMode . ListView , 40 , ThumbnailOptions . ReturnOnlyIfCached ) , ItemName = item . Name , ContentType = ( ( StorageFile ) item ) . DisplayType } ) ;
724
- }
725
- }
726
- index += 250 ;
727
- thumbnails = await query . GetItemsAsync ( index , 250 ) ;
728
- }
729
-
730
- } ) ;
731
-
732
-
733
682
WIN32_FIND_DATA findData ;
734
683
FINDEX_INFO_LEVELS findInfoLevel = FINDEX_INFO_LEVELS . FindExInfoStandard ;
735
684
int additionalFlags = 0 ;
@@ -747,14 +696,14 @@ public async void RapidAddItemsToCollectionAsync(string path)
747
696
{
748
697
if ( ( ( FileAttributes ) findData . dwFileAttributes & FileAttributes . Directory ) != FileAttributes . Directory )
749
698
{
750
- AddFile ( findData , path , null ) ;
699
+ AddFile ( findData , path ) ;
751
700
++ count ;
752
701
}
753
702
else if ( ( ( FileAttributes ) findData . dwFileAttributes & FileAttributes . Directory ) == FileAttributes . Directory )
754
703
{
755
704
if ( findData . cFileName != "." && findData . cFileName != ".." )
756
705
{
757
- AddFolder ( findData , path , null ) ;
706
+ AddFolder ( findData , path ) ;
758
707
++ count ;
759
708
}
760
709
}
@@ -764,20 +713,6 @@ public async void RapidAddItemsToCollectionAsync(string path)
764
713
765
714
FindClose ( hFile ) ;
766
715
}
767
- //var populateFetchedProperties = await fetchOperation.ContinueWith(async (i) =>
768
- //{
769
- // await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
770
- // {
771
- // BitmapImage icon = null;
772
- // var itemsCopy = FilesAndFolders.ToList();
773
- // foreach (ListedItem item in itemsCopy)
774
- // {
775
-
776
- // }
777
- // });
778
-
779
- //});
780
-
781
716
782
717
if ( FilesAndFolders . Count == 0 )
783
718
{
@@ -799,7 +734,7 @@ public async void RapidAddItemsToCollectionAsync(string path)
799
734
isLoadingItems = false ;
800
735
}
801
736
802
- private void AddFolder ( WIN32_FIND_DATA findData , string pathRoot , PartialStorageItem partialStorageItem )
737
+ private void AddFolder ( WIN32_FIND_DATA findData , string pathRoot )
803
738
{
804
739
if ( ( App . CurrentInstance . CurrentPageType ) == typeof ( GenericFileBrowser ) || ( App . CurrentInstance . CurrentPageType == typeof ( PhotoAlbum ) ) )
805
740
{
@@ -811,7 +746,7 @@ private void AddFolder(WIN32_FIND_DATA findData, string pathRoot, PartialStorage
811
746
var itemDate = DateTime . FromFileTimeUtc ( ( findData . ftLastWriteTime . dwHighDateTime << 32 ) + ( long ) ( uint ) findData . ftLastWriteTime . dwLowDateTime ) ;
812
747
var itemPath = Path . Combine ( pathRoot , findData . cFileName ) ;
813
748
814
- _filesAndFolders . Add ( new ListedItem ( partialStorageItem ? . RelativeId )
749
+ _filesAndFolders . Add ( new ListedItem ( null )
815
750
{
816
751
//FolderTooltipText = tooltipString,
817
752
FileName = findData . cFileName ,
@@ -830,7 +765,7 @@ private void AddFolder(WIN32_FIND_DATA findData, string pathRoot, PartialStorage
830
765
}
831
766
}
832
767
833
- private async void AddFile ( WIN32_FIND_DATA findData , string pathRoot , PartialStorageItem partialStorageFile )
768
+ private async void AddFile ( WIN32_FIND_DATA findData , string pathRoot )
834
769
{
835
770
836
771
var itemName = findData . cFileName ;
@@ -839,16 +774,10 @@ private async void AddFile(WIN32_FIND_DATA findData, string pathRoot, PartialSto
839
774
var itemSize = ByteSize . FromBytes ( ( findData . nFileSizeHigh << 32 ) + ( long ) ( uint ) findData . nFileSizeLow ) . ToString ( ) ;
840
775
var itemSizeBytes = ( findData . nFileSizeHigh << 32 ) + ( ulong ) ( uint ) findData . nFileSizeLow ;
841
776
string itemType = "File" ;
842
- if ( partialStorageFile != null )
843
- {
844
- itemType = partialStorageFile . ContentType ;
845
- }
846
- else
777
+
778
+ if ( findData . cFileName . Contains ( '.' ) )
847
779
{
848
- if ( findData . cFileName . Contains ( '.' ) )
849
- {
850
- itemType = findData . cFileName . Split ( '.' ) [ 1 ] . ToUpper ( ) + " File" ;
851
- }
780
+ itemType = findData . cFileName . Split ( '.' ) [ 1 ] . ToUpper ( ) + " File" ;
852
781
}
853
782
854
783
var itemFolderImgVis = Visibility . Collapsed ;
@@ -862,38 +791,16 @@ private async void AddFile(WIN32_FIND_DATA findData, string pathRoot, PartialSto
862
791
Visibility itemThumbnailImgVis ;
863
792
Visibility itemEmptyImgVis ;
864
793
865
- try
866
- {
794
+ itemEmptyImgVis = Visibility . Visible ;
795
+ itemThumbnailImgVis = Visibility . Collapsed ;
867
796
868
- var itemThumbnailImg = partialStorageFile != null ? partialStorageFile . Thumbnail : null ;
869
- if ( itemThumbnailImg != null )
870
- {
871
- itemEmptyImgVis = Visibility . Collapsed ;
872
- itemThumbnailImgVis = Visibility . Visible ;
873
- icon . DecodePixelWidth = 40 ;
874
- icon . DecodePixelHeight = 40 ;
875
- await icon . SetSourceAsync ( itemThumbnailImg ) ;
876
- }
877
- else
878
- {
879
- itemEmptyImgVis = Visibility . Visible ;
880
- itemThumbnailImgVis = Visibility . Collapsed ;
881
- }
882
- }
883
- catch
884
- {
885
- itemEmptyImgVis = Visibility . Visible ;
886
- itemThumbnailImgVis = Visibility . Collapsed ;
887
- // Catch here to avoid crash
888
- // TODO maybe some logging could be added in the future...
889
- }
890
797
891
798
if ( _cancellationTokenSource . IsCancellationRequested )
892
799
{
893
800
isLoadingItems = false ;
894
801
return ;
895
802
}
896
- _filesAndFolders . Add ( new ListedItem ( partialStorageFile ? . RelativeId )
803
+ _filesAndFolders . Add ( new ListedItem ( null )
897
804
{
898
805
DotFileExtension = itemFileExtension ,
899
806
EmptyImgVis = itemEmptyImgVis ,
0 commit comments