@@ -115,7 +115,7 @@ private List<Result> ParseResults(JsonRPCQueryResponseModel queryResponseModel)
115115
116116 foreach ( var result in queryResponseModel . Result )
117117 {
118- result . Action = c =>
118+ result . AsyncAction = async c =>
119119 {
120120 UpdateSettings ( result . SettingsChange ) ;
121121
@@ -133,15 +133,15 @@ private List<Result> ParseResults(JsonRPCQueryResponseModel queryResponseModel)
133133 }
134134 else
135135 {
136- var actionResponse = Request ( result . JsonRPCAction ) ;
136+ var actionResponse = await RequestAsync ( result . JsonRPCAction ) ;
137137
138- if ( string . IsNullOrEmpty ( actionResponse ) )
138+ if ( actionResponse . Length == 0 )
139139 {
140140 return ! result . JsonRPCAction . DontHideAfterAction ;
141141 }
142142
143- var jsonRpcRequestModel =
144- JsonSerializer . Deserialize < JsonRPCRequestModel > ( actionResponse , options ) ;
143+ var jsonRpcRequestModel = await
144+ JsonSerializer . DeserializeAsync < JsonRPCRequestModel > ( actionResponse , options ) ;
145145
146146 if ( jsonRpcRequestModel ? . Method ? . StartsWith ( "Flow.Launcher." ) ?? false )
147147 {
@@ -166,19 +166,20 @@ private List<Result> ParseResults(JsonRPCQueryResponseModel queryResponseModel)
166166 private void ExecuteFlowLauncherAPI ( string method , object [ ] parameters )
167167 {
168168 var parametersTypeArray = parameters . Select ( param => param . GetType ( ) ) . ToArray ( ) ;
169- MethodInfo methodInfo = PluginManager . API . GetType ( ) . GetMethod ( method , parametersTypeArray ) ;
170- if ( methodInfo != null )
169+ var methodInfo = typeof ( IPublicAPI ) . GetMethod ( method , parametersTypeArray ) ;
170+ if ( methodInfo == null )
171+ {
172+ return ;
173+ }
174+ try
175+ {
176+ methodInfo . Invoke ( PluginManager . API , parameters ) ;
177+ }
178+ catch ( Exception )
171179 {
172- try
173- {
174- methodInfo . Invoke ( PluginManager . API , parameters ) ;
175- }
176- catch ( Exception )
177- {
178180#if ( DEBUG )
179- throw ;
181+ throw ;
180182#endif
181- }
182183 }
183184 }
184185
@@ -366,17 +367,15 @@ public Control CreateSettingPanel()
366367 var settingWindow = new UserControl ( ) ;
367368 var mainPanel = new StackPanel
368369 {
369- Margin = settingPanelMargin ,
370- Orientation = Orientation . Vertical
370+ Margin = settingPanelMargin , Orientation = Orientation . Vertical
371371 } ;
372372 settingWindow . Content = mainPanel ;
373373
374374 foreach ( var ( type , attribute ) in _settingsTemplate . Body )
375375 {
376376 var panel = new StackPanel
377377 {
378- Orientation = Orientation . Horizontal ,
379- Margin = settingControlMargin
378+ Orientation = Orientation . Horizontal , Margin = settingControlMargin
380379 } ;
381380 var name = new TextBlock ( )
382381 {
0 commit comments