@@ -537,6 +537,43 @@ class PartialStorageItem
537537 public string RelativeId { get ; set ; }
538538 }
539539
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+
540577 public async void RapidAddItemsToCollectionAsync ( string path )
541578 {
542579 App . CurrentInstance . CanRefresh = false ;
@@ -672,56 +709,31 @@ public async void RapidAddItemsToCollectionAsync(string path)
672709 }
673710 else if ( ( ( FileAttributes ) findData . dwFileAttributes & FileAttributes . Directory ) == FileAttributes . Directory )
674711 {
675- AddFolder ( findData , path , null ) ;
676- ++ count ;
712+ if ( findData . cFileName != "." && findData . cFileName != ".." )
713+ {
714+ AddFolder ( findData , path , null ) ;
715+ ++ count ;
716+ }
677717 }
678718 }
679719
680720 } while ( FindNextFile ( hFile , out findData ) ) ;
681721
682722 FindClose ( hFile ) ;
683723 }
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+ // });
723735
724- } ) ;
736+ // });
725737
726738
727739 if ( FilesAndFolders . Count == 0 )
@@ -810,7 +822,7 @@ private async void AddFile(WIN32_FIND_DATA findData, string pathRoot, PartialSto
810822 try
811823 {
812824
813- var itemThumbnailImg = partialStorageFile != null ? partialStorageFile . Thumbnail . CloneStream ( ) : null ;
825+ var itemThumbnailImg = partialStorageFile != null ? partialStorageFile . Thumbnail : null ;
814826 if ( itemThumbnailImg != null )
815827 {
816828 itemEmptyImgVis = Visibility . Collapsed ;
0 commit comments