From 6f55e8a35dbaf087a265dd2ff772a46d07b42996 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 22 Feb 2025 19:44:21 +0800 Subject: [PATCH] Add BackToQueryResults api function back --- Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 6 ++++++ Flow.Launcher/PublicAPIInstance.cs | 2 ++ Flow.Launcher/ViewModel/MainViewModel.cs | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index 1a8da381b..28cc1fc91 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -305,6 +305,12 @@ namespace Flow.Launcher.Plugin /// Choose the first result after reload if true; keep the last selected result if false. Default is true. public void ReQuery(bool reselect = true); + /// + /// Back to the query results. + /// This method should run when selected item is from context menu or history. + /// + public void BackToQueryResults(); + /// /// Displays a standardised Flow message box. /// diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index d7f052af3..7706a64ba 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -319,6 +319,8 @@ namespace Flow.Launcher public void ReQuery(bool reselect = true) => _mainVM.ReQuery(reselect); + public void BackToQueryResults() => _mainVM.BackToQueryResults(); + public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK) => MessageBoxEx.Show(messageBoxText, caption, button, icon, defaultResult); diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index d8e33ad14..0d1f5655b 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -489,7 +489,7 @@ namespace Flow.Launcher.ViewModel } } - private void BackToQueryResults() + public void BackToQueryResults() { if (!SelectedIsFromQueryResults()) {