@@ -273,31 +273,67 @@ private async void Omnibar_TextChanged(Omnibar sender, OmnibarTextChangedEventAr
273
273
274
274
private async void BreadcrumbBar_ItemClicked ( Controls . BreadcrumbBar sender , Controls . BreadcrumbBarItemClickedEventArgs args )
275
275
{
276
+ // Navigation to the current folder should not happen
277
+ if ( args . Index == ViewModel . PathComponents . Count - 1 ||
278
+ ViewModel . PathComponents [ args . Index ] . Path is not { } path )
279
+ return ;
280
+
276
281
if ( args . IsRootItem )
277
282
{
278
283
await ViewModel . HandleItemNavigationAsync ( "Home" ) ;
279
284
return ;
280
285
}
281
286
282
- await ViewModel . HandleFolderNavigationAsync ( ViewModel . PathComponents [ args . Index ] . Path ) ;
287
+ await ViewModel . HandleFolderNavigationAsync ( path ) ;
283
288
}
284
289
285
290
private async void BreadcrumbBar_ItemDropDownFlyoutOpening ( object sender , BreadcrumbBarItemDropDownFlyoutEventArgs e )
286
291
{
287
292
if ( e . IsRootItem )
288
293
{
289
- // TODO: Populate a different flyout for the root item
294
+ IHomeFolder homeFolder = new HomeFolder ( ) ;
295
+
290
296
e . Flyout . Items . Add ( new MenuFlyoutHeaderItem ( ) { Text = "Quick access" } ) ;
291
- e . Flyout . Items . Add ( new MenuFlyoutItem ( ) { Text = "Desktop" } ) ;
292
- e . Flyout . Items . Add ( new MenuFlyoutItem ( ) { Text = "Download" } ) ;
293
- e . Flyout . Items . Add ( new MenuFlyoutItem ( ) { Text = "Documents" } ) ;
294
- e . Flyout . Items . Add ( new MenuFlyoutItem ( ) { Text = "Pictures" } ) ;
295
- e . Flyout . Items . Add ( new MenuFlyoutItem ( ) { Text = "Music" } ) ;
296
- e . Flyout . Items . Add ( new MenuFlyoutItem ( ) { Text = "Videos" } ) ;
297
- e . Flyout . Items . Add ( new MenuFlyoutItem ( ) { Text = "Recycle bin" } ) ;
297
+
298
+ await foreach ( var storable in homeFolder . GetQuickAccessFolderAsync ( ) )
299
+ {
300
+ if ( storable is not IWindowsStorable windowsStorable )
301
+ continue ;
302
+
303
+ var flyoutItem = new MenuFlyoutItem ( )
304
+ {
305
+ Text = windowsStorable . GetDisplayName ( Windows . Win32 . UI . Shell . SIGDN . SIGDN_PARENTRELATIVEFORUI ) ,
306
+ Icon = new FontIcon { Glyph = "\uE8B7 " } , // Use font icon as placeholder
307
+ } ;
308
+
309
+ e . Flyout . Items . Add ( flyoutItem ) ;
310
+
311
+ windowsStorable . TryGetThumbnail ( ( int ) ( 16f * App . AppModel . AppWindowDPI ) , Windows . Win32 . UI . Shell . SIIGBF . SIIGBF_ICONONLY , out var thumbnailData ) ;
312
+ flyoutItem . Icon = new ImageIcon ( ) { Source = await MainWindow . Instance . DispatcherQueue . EnqueueOrInvokeAsync ( ( ) => thumbnailData . ToBitmapAsync ( ) , Microsoft . UI . Dispatching . DispatcherQueuePriority . Normal ) } ;
313
+
314
+ windowsStorable . Dispose ( ) ;
315
+ }
316
+
298
317
e . Flyout . Items . Add ( new MenuFlyoutHeaderItem ( ) { Text = "Drives" } ) ;
299
- e . Flyout . Items . Add ( new MenuFlyoutItem ( ) { Text = "Local Disk (C:)" } ) ;
300
- e . Flyout . Items . Add ( new MenuFlyoutItem ( ) { Text = "Local Disk (D:)" } ) ;
318
+
319
+ await foreach ( var storable in homeFolder . GetLogicalDrivesAsync ( ) )
320
+ {
321
+ if ( storable is not IWindowsStorable windowsStorable )
322
+ continue ;
323
+
324
+ var flyoutItem = new MenuFlyoutItem ( )
325
+ {
326
+ Text = windowsStorable . GetDisplayName ( Windows . Win32 . UI . Shell . SIGDN . SIGDN_PARENTRELATIVEFORUI ) ,
327
+ Icon = new FontIcon { Glyph = "\uE8B7 " } , // Use font icon as placeholder
328
+ } ;
329
+
330
+ e . Flyout . Items . Add ( flyoutItem ) ;
331
+
332
+ windowsStorable . TryGetThumbnail ( ( int ) ( 16f * App . AppModel . AppWindowDPI ) , Windows . Win32 . UI . Shell . SIIGBF . SIIGBF_ICONONLY , out var thumbnailData ) ;
333
+ flyoutItem . Icon = new ImageIcon ( ) { Source = await MainWindow . Instance . DispatcherQueue . EnqueueOrInvokeAsync ( ( ) => thumbnailData . ToBitmapAsync ( ) , Microsoft . UI . Dispatching . DispatcherQueuePriority . Normal ) } ;
334
+
335
+ windowsStorable . Dispose ( ) ;
336
+ }
301
337
302
338
return ;
303
339
}
0 commit comments