File tree Expand file tree Collapse file tree 3 files changed +47
-2
lines changed
Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 3030 <converters : NullToVisibilityCollapsedConverter x : Key =" NullToVisibilityCollapsedConverter" />
3131 <converters1 : BoolNegationConverter x : Key =" BoolNegationConverter" />
3232 <converters : VisibilityInvertConverter x : Key =" VisibilityInvertConverter" />
33+ <converters1 : BoolToObjectConverter
34+ x:Key=" SearchSuggestionGlyphConverter"
35+ FalseValue="  "
36+ TrueValue="  " />
3337
3438 <ResourceDictionary .MergedDictionaries>
3539 <ResourceDictionary Source =" ms-appx:///UserControls/KeyboardShortcut/KeyboardShortcut.xaml" />
Original file line number Diff line number Diff line change @@ -338,6 +338,7 @@ await DispatcherQueue.EnqueueOrInvokeAsync(() =>
338338 }
339339 else if ( Omnibar . CurrentSelectedMode == OmnibarSearchMode )
340340 {
341+ await ViewModel . PopulateOmnibarSuggestionsForSearchMode ( ) ;
341342 }
342343 }
343344
@@ -456,7 +457,7 @@ await DispatcherQueue.EnqueueOrInvokeAsync(() =>
456457 }
457458 else if ( e . NewMode == OmnibarSearchMode )
458459 {
459-
460+ await ViewModel . PopulateOmnibarSuggestionsForSearchMode ( ) ;
460461 }
461462 }
462463
@@ -486,7 +487,7 @@ await DispatcherQueue.EnqueueOrInvokeAsync(() =>
486487 }
487488 else if ( Omnibar . CurrentSelectedMode == OmnibarSearchMode )
488489 {
489-
490+ await ViewModel . PopulateOmnibarSuggestionsForSearchMode ( ) ;
490491 }
491492 }
492493 }
Original file line number Diff line number Diff line change @@ -1243,6 +1243,46 @@ public void PopulateOmnibarSuggestionsForCommandPaletteMode()
12431243 }
12441244 }
12451245
1246+ public async Task PopulateOmnibarSuggestionsForSearchMode ( )
1247+ {
1248+ if ( ContentPageContext . ShellPage is null )
1249+ return ;
1250+
1251+ if ( ! string . IsNullOrWhiteSpace ( OmnibarSearchModeText ) )
1252+ {
1253+ var search = new FolderSearch ( )
1254+ {
1255+ Query = OmnibarSearchModeText ,
1256+ Folder = ContentPageContext . ShellPage . ShellViewModel . WorkingDirectory ,
1257+ MaxItemCount = 10 ,
1258+ } ;
1259+
1260+ var results = await search . SearchAsync ( ) ;
1261+ var newSuggestions = results
1262+ . Select ( item => new SuggestionModel ( item ) )
1263+ . ToList ( ) ;
1264+
1265+ // Remove items no longer in the result set
1266+ var toRemove = OmnibarSearchModeSuggestionItems
1267+ . Where ( existing => ! newSuggestions . Any ( newItem => newItem . ItemPath == existing . ItemPath ) )
1268+ . ToList ( ) ;
1269+
1270+ foreach ( var item in toRemove )
1271+ OmnibarSearchModeSuggestionItems . Remove ( item ) ;
1272+
1273+ // Add new items
1274+ var toAdd = newSuggestions
1275+ . Where ( newItem => ! OmnibarSearchModeSuggestionItems . Any ( existing => existing . ItemPath == newItem . ItemPath ) ) ;
1276+
1277+ foreach ( var item in toAdd )
1278+ OmnibarSearchModeSuggestionItems . Add ( item ) ;
1279+ }
1280+ else
1281+ {
1282+ // NOTE: Add to the recent queries
1283+ }
1284+ }
1285+
12461286 [ Obsolete ( "Remove once Omnibar goes out of experimental." ) ]
12471287 public async Task SetAddressBarSuggestionsAsync ( AutoSuggestBox sender , IShellPage shellpage )
12481288 {
You can’t perform that action at this time.
0 commit comments