diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Exceptions/EngineNotAvailableException.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Exceptions/EngineNotAvailableException.cs index 1a48892f5..a6315fb4b 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Exceptions/EngineNotAvailableException.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Exceptions/EngineNotAvailableException.cs @@ -3,8 +3,6 @@ using System; using System.Threading.Tasks; using System.Windows; -using Flow.Launcher.Plugin.Explorer.Search.IProvider; -using JetBrains.Annotations; namespace Flow.Launcher.Plugin.Explorer.Exceptions; @@ -20,7 +18,7 @@ public class EngineNotAvailableException : Exception string engineName, string resolution, string message, - Func> action = null) : base(message) + Func>? action = null) : base(message) { EngineName = engineName; Resolution = resolution; @@ -40,6 +38,23 @@ public class EngineNotAvailableException : Exception EngineName = engineName; Resolution = resolution; } + + public EngineNotAvailableException( + string engineName, + string resolution, + string message, + string errorIconPath, + Func>? action = null) : base(message) + { + EngineName = engineName; + Resolution = resolution; + ErrorIcon = errorIconPath; + Action = action ?? (_ => + { + Clipboard.SetDataObject(this.ToString()); + return ValueTask.FromResult(true); + }); + } public override string ToString() { diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs index ffd22d9f5..4bb8a0cdd 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs @@ -27,20 +27,16 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything Enum.GetName(Settings.IndexSearchEngineOption.Everything)!, Main.Context.API.GetTranslation("flowlauncher_plugin_everything_click_to_launch_or_install"), Main.Context.API.GetTranslation("flowlauncher_plugin_everything_is_not_running"), - ClickToInstallEverythingAsync) - { - ErrorIcon = Constants.EverythingErrorImagePath - }; + Constants.EverythingErrorImagePath, + ClickToInstallEverythingAsync); } catch (DllNotFoundException) { throw new EngineNotAvailableException( Enum.GetName(Settings.IndexSearchEngineOption.Everything)!, "Please check whether your system is x86 or x64", - Main.Context.API.GetTranslation("flowlauncher_plugin_everything_sdk_issue")) - { - ErrorIcon = Constants.GeneralSearchErrorImagePath - }; + Constants.GeneralSearchErrorImagePath, + Main.Context.API.GetTranslation("flowlauncher_plugin_everything_sdk_issue")); } } private async ValueTask ClickToInstallEverythingAsync(ActionContext _) @@ -72,16 +68,14 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything if (!Settings.EnableEverythingContentSearch) { throw new EngineNotAvailableException(Enum.GetName(Settings.IndexSearchEngineOption.Everything)!, - "Click to Enable Everything Content Search (only applicable to Everything 1.5+ with indexed content)", - "Everything Content Search is not enabled.", + Main.Context.API.GetTranslation("flowlauncher_plugin_everything_enable_content_search"), + Main.Context.API.GetTranslation("flowlauncher_plugin_everything_enable_content_search_tips"), + Constants.EverythingErrorImagePath, _ => { Settings.EnableEverythingContentSearch = true; return ValueTask.FromResult(true); - }) - { - ErrorIcon = Constants.EverythingErrorImagePath - }; + }); } if (token.IsCancellationRequested) yield break; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs index f1060a4ac..c3a7d9e91 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/WindowsIndexSearchManager.cs @@ -106,6 +106,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex "Windows Index", api.GetTranslation("plugin_explorer_windowsSearchServiceFix"), api.GetTranslation("plugin_explorer_windowsSearchServiceNotRunning"), + Constants.WindowsIndexErrorImagePath, c => { Settings.WarnWindowsSearchServiceOff = false; @@ -114,10 +115,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex api.ChangeQuery(string.Empty); return ValueTask.FromResult(false); - }) - { - ErrorIcon = Constants.WindowsIndexErrorImagePath - }; + }); } } }