Skip to content

Commit 0f9fd94

Browse files
committed
handle future scenario where PluginsManager's action keyword increased
1 parent 10a30f4 commit 0f9fd94

File tree

1 file changed

+12
-3
lines changed
  • Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex

1 file changed

+12
-3
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Flow.Launcher.Infrastructure.Logger;
12
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
23
using Microsoft.Search.Interop;
34
using System;
@@ -178,12 +179,20 @@ private static List<Result> ResultForWindexSearchOff(string rawQuery)
178179
{
179180
SearchManager.Settings.WarnWindowsSearchServiceOff = false;
180181

182+
var pluginsManagerPlugins= api.GetAllPlugins().FirstOrDefault(x => x.Metadata.ID == "9f8f9b14-2518-4907-b211-35ab6290dee7");
183+
184+
var actionKeywordCount = pluginsManagerPlugins.Metadata.ActionKeywords.Count;
185+
186+
if (actionKeywordCount > 1)
187+
LogException("PluginsManager's action keyword has increased to more than 1, this does not allow for determining the " +
188+
"right action keyword. Explorer's code for managing Windows Search service not running exception needs to be updated",
189+
new InvalidOperationException());
190+
181191
if (MessageBox.Show(string.Format(api.GetTranslation("plugin_explorer_alternative"), Environment.NewLine),
182192
api.GetTranslation("plugin_explorer_alternative_title"),
183-
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
193+
MessageBoxButton.YesNo) == MessageBoxResult.Yes
194+
&& actionKeywordCount == 1)
184195
{
185-
var pluginsManagerPlugins= api.GetAllPlugins().FirstOrDefault(x => x.Metadata.ID == "9f8f9b14-2518-4907-b211-35ab6290dee7");
186-
187196
api.ChangeQuery(string.Format("{0} install everything", pluginsManagerPlugins.Metadata.ActionKeywords[0]));
188197
}
189198
else

0 commit comments

Comments
 (0)