@@ -537,6 +537,43 @@ class PartialStorageItem
537
537
public string RelativeId { get ; set ; }
538
538
}
539
539
540
+ public async void LoadExtendedItemProperties ( ListedItem item )
541
+ {
542
+ if ( ! item . ItemPropertiesInitialized )
543
+ {
544
+ if ( item . FileType != "Folder" )
545
+ {
546
+ BitmapImage icon = new BitmapImage ( ) ;
547
+ var matchingItem = _filesAndFolders . FirstOrDefault ( x => x == item ) ;
548
+ var matchingStorageItem = await StorageFile . GetFileFromPathAsync ( item . FilePath ) ;
549
+ if ( matchingItem != null && matchingStorageItem != null )
550
+ {
551
+ matchingItem . FileType = matchingStorageItem . DisplayType ;
552
+ matchingItem . FolderRelativeId = matchingStorageItem . FolderRelativeId ;
553
+ var Thumbnail = await matchingStorageItem . GetThumbnailAsync ( ThumbnailMode . ListView , 20 , ThumbnailOptions . UseCurrentScale ) ;
554
+ if ( Thumbnail != null )
555
+ {
556
+ matchingItem . FileImg = icon ;
557
+ await icon . SetSourceAsync ( Thumbnail ) ;
558
+ matchingItem . EmptyImgVis = Visibility . Collapsed ;
559
+ matchingItem . FileIconVis = Visibility . Visible ;
560
+ }
561
+ }
562
+ }
563
+ else
564
+ {
565
+ var matchingItem = _filesAndFolders . FirstOrDefault ( x => x == item ) ;
566
+ var matchingStorageItem = await StorageFolder . GetFolderFromPathAsync ( item . FilePath ) ;
567
+ if ( matchingItem != null && matchingStorageItem != null )
568
+ {
569
+ matchingItem . FolderRelativeId = matchingStorageItem . FolderRelativeId ;
570
+ }
571
+ }
572
+
573
+ item . ItemPropertiesInitialized = true ;
574
+ }
575
+ }
576
+
540
577
public async void RapidAddItemsToCollectionAsync ( string path )
541
578
{
542
579
App . CurrentInstance . CanRefresh = false ;
@@ -672,56 +709,31 @@ public async void RapidAddItemsToCollectionAsync(string path)
672
709
}
673
710
else if ( ( ( FileAttributes ) findData . dwFileAttributes & FileAttributes . Directory ) == FileAttributes . Directory )
674
711
{
675
- AddFolder ( findData , path , null ) ;
676
- ++ count ;
712
+ if ( findData . cFileName != "." && findData . cFileName != ".." )
713
+ {
714
+ AddFolder ( findData , path , null ) ;
715
+ ++ count ;
716
+ }
677
717
}
678
718
}
679
719
680
720
} while ( FindNextFile ( hFile , out findData ) ) ;
681
721
682
722
FindClose ( hFile ) ;
683
723
}
684
- var populateFetchedProperties = await fetchOperation . ContinueWith ( async ( i ) =>
685
- {
686
- await CoreApplication . MainView . CoreWindow . Dispatcher . RunAsync ( CoreDispatcherPriority . Normal , async ( ) =>
687
- {
688
- BitmapImage icon = null ;
689
- var itemsCopy = FilesAndFolders . ToList ( ) ;
690
- foreach ( ListedItem item in itemsCopy )
691
- {
692
- if ( item . FileType != "Folder" )
693
- {
694
- icon = new BitmapImage ( ) ;
695
- var matchingItem = _filesAndFolders . FirstOrDefault ( x => x == item ) ;
696
- var matchingStorageItem = partialFiles . FirstOrDefault ( x => x . ItemName == matchingItem . FileName ) ;
697
- if ( matchingItem != null && matchingStorageItem != null )
698
- {
699
- matchingItem . FileType = matchingStorageItem . ContentType ;
700
- matchingItem . FolderRelativeId = matchingStorageItem . RelativeId ;
701
- if ( matchingStorageItem . Thumbnail != null )
702
- {
703
- icon . DecodePixelWidth = 40 ;
704
- icon . DecodePixelHeight = 40 ;
705
- await icon . SetSourceAsync ( matchingStorageItem . Thumbnail . CloneStream ( ) ) ;
706
- matchingItem . FileImg = icon ;
707
- matchingItem . EmptyImgVis = Visibility . Collapsed ;
708
- matchingItem . FileIconVis = Visibility . Visible ;
709
- }
710
- }
711
- }
712
- else
713
- {
714
- var matchingItem = _filesAndFolders . FirstOrDefault ( x => x == item ) ;
715
- var matchingStorageItem = partialFolders . FirstOrDefault ( x => x . ItemName == matchingItem . FileName ) ;
716
- if ( matchingItem != null && matchingStorageItem != null )
717
- {
718
- matchingItem . FolderRelativeId = matchingStorageItem . RelativeId ;
719
- }
720
- }
721
- }
722
- } ) ;
724
+ //var populateFetchedProperties = await fetchOperation.ContinueWith(async (i) =>
725
+ //{
726
+ // await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
727
+ // {
728
+ // BitmapImage icon = null;
729
+ // var itemsCopy = FilesAndFolders.ToList();
730
+ // foreach (ListedItem item in itemsCopy)
731
+ // {
732
+
733
+ // }
734
+ // });
723
735
724
- } ) ;
736
+ // });
725
737
726
738
727
739
if ( FilesAndFolders . Count == 0 )
@@ -810,7 +822,7 @@ private async void AddFile(WIN32_FIND_DATA findData, string pathRoot, PartialSto
810
822
try
811
823
{
812
824
813
- var itemThumbnailImg = partialStorageFile != null ? partialStorageFile . Thumbnail . CloneStream ( ) : null ;
825
+ var itemThumbnailImg = partialStorageFile != null ? partialStorageFile . Thumbnail : null ;
814
826
if ( itemThumbnailImg != null )
815
827
{
816
828
itemEmptyImgVis = Visibility . Collapsed ;
0 commit comments