@@ -269,21 +269,25 @@ private async void Omnibar_QuerySubmitted(Omnibar sender, OmnibarQuerySubmittedE
269269 return ;
270270
271271 // Try invoking built-in command
272- if ( item . Text is { } commandText )
272+ foreach ( IRichCommand command in Commands )
273273 {
274- var command = Commands [ commandText ] ;
275- if ( command == Commands . None )
276- await DialogDisplayHelper . ShowDialogAsync ( Strings . InvalidCommand . GetLocalizedResource ( ) ,
277- string . Format ( Strings . InvalidCommandContent . GetLocalizedResource ( ) , commandText ) ) ;
278- else if ( ! command . IsExecutable )
279- await DialogDisplayHelper . ShowDialogAsync ( Strings . CommandNotExecutable . GetLocalizedResource ( ) ,
280- string . Format ( Strings . CommandNotExecutableContent . GetLocalizedResource ( ) , command . Code ) ) ;
281- else
282- await command . ExecuteAsync ( ) ;
274+ if ( item . Text == command . Description )
275+ {
276+ if ( command == Commands . None )
277+ await DialogDisplayHelper . ShowDialogAsync ( Strings . InvalidCommand . GetLocalizedResource ( ) ,
278+ string . Format ( Strings . InvalidCommandContent . GetLocalizedResource ( ) , command . Code ) ) ;
279+ else if ( ! command . IsExecutable )
280+ await DialogDisplayHelper . ShowDialogAsync ( Strings . CommandNotExecutable . GetLocalizedResource ( ) ,
281+ string . Format ( Strings . CommandNotExecutableContent . GetLocalizedResource ( ) , command . Code ) ) ;
282+ else
283+ await command . ExecuteAsync ( ) ;
284+
285+ return ;
286+ }
283287 }
284288
285289 // Try invoking Windows app action
286- else if ( ActionManager . Instance . ActionRuntime is not null && item . ActionInstance is ActionInstance actionInstance )
290+ if ( ActionManager . Instance . ActionRuntime is not null && item . ActionInstance is ActionInstance actionInstance )
287291 {
288292 // Workaround for https://github.com/microsoft/App-Actions-On-Windows-Samples/issues/7
289293 var action = ActionManager . Instance . ActionRuntime . ActionCatalog . GetAllActions ( )
0 commit comments