@@ -273,31 +273,67 @@ private async void Omnibar_TextChanged(Omnibar sender, OmnibarTextChangedEventAr
273273
274274 private async void BreadcrumbBar_ItemClicked ( Controls . BreadcrumbBar sender , Controls . BreadcrumbBarItemClickedEventArgs args )
275275 {
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+
276281 if ( args . IsRootItem )
277282 {
278283 await ViewModel . HandleItemNavigationAsync ( "Home" ) ;
279284 return ;
280285 }
281286
282- await ViewModel . HandleFolderNavigationAsync ( ViewModel . PathComponents [ args . Index ] . Path ) ;
287+ await ViewModel . HandleFolderNavigationAsync ( path ) ;
283288 }
284289
285290 private async void BreadcrumbBar_ItemDropDownFlyoutOpening ( object sender , BreadcrumbBarItemDropDownFlyoutEventArgs e )
286291 {
287292 if ( e . IsRootItem )
288293 {
289- // TODO: Populate a different flyout for the root item
294+ IHomeFolder homeFolder = new HomeFolder ( ) ;
295+
290296 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+
298317 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+ }
301337
302338 return ;
303339 }
0 commit comments