1414using System . Threading . Tasks ;
1515using Windows . ApplicationModel . Core ;
1616using Windows . Storage ;
17+ using Windows . Storage . BulkAccess ;
1718using Windows . Storage . FileProperties ;
1819using Windows . Storage . Search ;
1920using Windows . UI . Core ;
@@ -98,7 +99,7 @@ public ItemViewModel()
9899 private void Universal_PropertyChanged ( object sender , System . ComponentModel . PropertyChangedEventArgs e )
99100 {
100101 // Clear the path UI
101- GetCurrentSelectedTabInstance < ProHome > ( ) . accessiblePathTabView . TabItems . Clear ( ) ;
102+ GetCurrentSelectedTabInstance < ProHome > ( ) . pathBoxItems . Clear ( ) ;
102103 // Style tabStyleFixed = GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Resources["PathSectionTabStyle"] as Style;
103104 FontWeight weight = new FontWeight ( )
104105 {
@@ -128,17 +129,12 @@ private void Universal_PropertyChanged(object sender, System.ComponentModel.Prop
128129 }
129130 tag = s + @"\" ;
130131
131- Microsoft . UI . Xaml . Controls . TabViewItem item = new Microsoft . UI . Xaml . Controls . TabViewItem ( )
132+ PathBoxItem item = new PathBoxItem ( )
132133 {
133- Header = componentLabel + " ›" ,
134- Tag = tag ,
135- CornerRadius = new CornerRadius ( 0 ) ,
136- //Style = tabStyleFixed,
137- FontWeight = weight ,
138- FontSize = 14
134+ Title = componentLabel ,
135+ Path = tag ,
139136 } ;
140- item . Tapped += Item_Tapped ;
141- GetCurrentSelectedTabInstance < ProHome > ( ) . accessiblePathTabView . TabItems . Add ( item ) ;
137+ GetCurrentSelectedTabInstance < ProHome > ( ) . pathBoxItems . Add ( item ) ;
142138 }
143139 else
144140 {
@@ -148,31 +144,19 @@ private void Universal_PropertyChanged(object sender, System.ComponentModel.Prop
148144 tag = tag + part + @"\" ;
149145 }
150146
151- Microsoft . UI . Xaml . Controls . TabViewItem item = new Microsoft . UI . Xaml . Controls . TabViewItem ( )
147+ PathBoxItem item = new PathBoxItem ( )
152148 {
153- Header = componentLabel + " ›" ,
154- Tag = tag ,
155- CornerRadius = new CornerRadius ( 0 ) ,
156- //Style = tabStyleFixed,
157- FontWeight = weight ,
158- FontSize = 14
149+ Title = componentLabel ,
150+ Path = tag ,
159151 } ;
160- item . Tapped += Item_Tapped ;
161- GetCurrentSelectedTabInstance < ProHome > ( ) . accessiblePathTabView . TabItems . Add ( item ) ;
152+ GetCurrentSelectedTabInstance < ProHome > ( ) . pathBoxItems . Add ( item ) ;
162153
163154 }
164155 index ++ ;
165156 }
166157 }
167158 }
168159
169- private void Item_Tapped ( object sender , Windows . UI . Xaml . Input . TappedRoutedEventArgs e )
170- {
171- CancelLoadAndClearFiles ( ) ;
172- var itemTappedTag = ( sender as Microsoft . UI . Xaml . Controls . TabViewItem ) . Tag . ToString ( ) ;
173- ItemViewModel < ProHome > . GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Navigate ( typeof ( GenericFileBrowser ) , itemTappedTag , new SuppressNavigationTransitionInfo ( ) ) ;
174- }
175-
176160 private void AlwaysPresentCommands_PropertyChanged ( object sender , System . ComponentModel . PropertyChangedEventArgs e )
177161 {
178162 if ( tabInstance . AlwaysPresentCommands . isEnabled == true )
@@ -292,7 +276,7 @@ public async void DisplayConsentDialog()
292276 await tabInstance . consentDialog . ShowAsync ( ) ;
293277 }
294278
295- public async void AddItemsToCollectionAsync ( string path , Page currentPage )
279+ public async void AddItemsToCollectionAsync ( string path )
296280 {
297281 ItemViewModel < ProHome > . GetCurrentSelectedTabInstance < ProHome > ( ) . RefreshButton . IsEnabled = false ;
298282
@@ -357,8 +341,6 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
357341 {
358342 _rootFolder = await StorageFolder . GetFolderFromPathAsync ( Universal . path ) ;
359343
360- //History.AddToHistory(Universal.path);
361-
362344 tabInstance . BackButton . IsEnabled = tabInstance . accessibleContentFrame . CanGoBack ;
363345 tabInstance . ForwardButton . IsEnabled = tabInstance . accessibleContentFrame . CanGoForward ;
364346
@@ -370,12 +352,12 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
370352
371353 if ( typeof ( PageType ) == typeof ( GenericFileBrowser ) )
372354 {
373- _options . SetThumbnailPrefetch ( ThumbnailMode . ListView , 20 , ThumbnailOptions . UseCurrentScale ) ;
355+ _options . SetThumbnailPrefetch ( ThumbnailMode . ListView , 20 , ThumbnailOptions . ReturnOnlyIfCached ) ;
374356 _options . SetPropertyPrefetch ( PropertyPrefetchOptions . BasicProperties , new string [ ] { "System.DateModified" , "System.ContentType" , "System.Size" , "System.FileExtension" } ) ;
375357 }
376358 else if ( typeof ( PageType ) == typeof ( PhotoAlbum ) )
377359 {
378- _options . SetThumbnailPrefetch ( ThumbnailMode . PicturesView , 275 , ThumbnailOptions . ResizeThumbnail ) ;
360+ _options . SetThumbnailPrefetch ( ThumbnailMode . PicturesView , 275 , ThumbnailOptions . ReturnOnlyIfCached ) ;
379361 _options . SetPropertyPrefetch ( PropertyPrefetchOptions . BasicProperties , new string [ ] { "System.FileExtension" } ) ;
380362 }
381363 _options . IndexerOption = IndexerOption . OnlyUseIndexerAndOptimizeForIndexedProperties ;
@@ -386,30 +368,19 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
386368
387369 if ( typeof ( PageType ) == typeof ( GenericFileBrowser ) )
388370 {
389- _options . SetThumbnailPrefetch ( ThumbnailMode . ListView , 20 , ThumbnailOptions . UseCurrentScale ) ;
371+ _options . SetThumbnailPrefetch ( ThumbnailMode . ListView , 20 , ThumbnailOptions . ReturnOnlyIfCached ) ;
390372 _options . SetPropertyPrefetch ( PropertyPrefetchOptions . BasicProperties , new string [ ] { "System.DateModified" , "System.ContentType" , "System.ItemPathDisplay" , "System.Size" , "System.FileExtension" } ) ;
391373 }
392374 else if ( typeof ( PageType ) == typeof ( PhotoAlbum ) )
393375 {
394- _options . SetThumbnailPrefetch ( ThumbnailMode . PicturesView , 275 , ThumbnailOptions . ResizeThumbnail ) ;
376+ _options . SetThumbnailPrefetch ( ThumbnailMode . PicturesView , 275 , ThumbnailOptions . ReturnOnlyIfCached ) ;
395377 _options . SetPropertyPrefetch ( PropertyPrefetchOptions . BasicProperties , new string [ ] { "System.FileExtension" } ) ;
396378 }
397379
398380 _options . IndexerOption = IndexerOption . UseIndexerWhenAvailable ;
399381 break ;
400382 }
401383
402- SortEntry sort = new SortEntry ( )
403- {
404- PropertyName = "System.FileName" ,
405- AscendingOrder = true
406- } ;
407- _options . SortOrder . Add ( sort ) ;
408- if ( ! _rootFolder . AreQueryOptionsSupported ( _options ) )
409- {
410- _options . SortOrder . Clear ( ) ;
411- }
412-
413384 uint index = 0 ;
414385 _folderQueryResult = _rootFolder . CreateFolderQueryWithOptions ( _options ) ;
415386 //_folderQueryResult.ContentsChanged += FolderContentsChanged;
@@ -584,7 +555,7 @@ private async Task AddFile(StorageFile file, CancellationToken token)
584555 {
585556 try
586557 {
587- var itemThumbnailImg = await file . GetThumbnailAsync ( ThumbnailMode . ListView , 20 , ThumbnailOptions . UseCurrentScale ) ;
558+ var itemThumbnailImg = await file . GetScaledImageAsThumbnailAsync ( ThumbnailMode . ListView , 40 , ThumbnailOptions . ReturnOnlyIfCached ) ;
588559 if ( itemThumbnailImg != null )
589560 {
590561 itemEmptyImgVis = Visibility . Collapsed ;
@@ -609,7 +580,7 @@ private async Task AddFile(StorageFile file, CancellationToken token)
609580 {
610581 try
611582 {
612- var itemThumbnailImg = await file . GetThumbnailAsync ( ThumbnailMode . PicturesView , 275 , ThumbnailOptions . ResizeThumbnail ) ;
583+ var itemThumbnailImg = await file . GetScaledImageAsThumbnailAsync ( ThumbnailMode . PicturesView , 275 , ThumbnailOptions . ReturnOnlyIfCached ) ;
613584 if ( itemThumbnailImg != null )
614585 {
615586 itemEmptyImgVis = Visibility . Collapsed ;
0 commit comments