mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
Implement IInstantSearch for CMD and WebSearch plugin
This commit is contained in:
@@ -6,12 +6,13 @@ using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using WindowsInput;
|
||||
using WindowsInput.Native;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Hotkey;
|
||||
using Control = System.Windows.Controls.Control;
|
||||
|
||||
namespace Wox.Plugin.CMD
|
||||
{
|
||||
public class CMD : IPlugin, ISettingProvider, IPluginI18n
|
||||
public class CMD : IPlugin, ISettingProvider, IPluginI18n, IInstantSearch
|
||||
{
|
||||
private PluginInitContext context;
|
||||
private bool WinRStroked;
|
||||
@@ -37,6 +38,7 @@ namespace Wox.Plugin.CMD
|
||||
context.API.PushResults(query, context.CurrentPluginMetadata, history);
|
||||
pushedResults.AddRange(history);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
string basedir = null;
|
||||
@@ -72,6 +74,7 @@ namespace Wox.Plugin.CMD
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
}
|
||||
return results;
|
||||
}
|
||||
@@ -207,5 +210,11 @@ namespace Wox.Plugin.CMD
|
||||
{
|
||||
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
|
||||
}
|
||||
|
||||
public bool IsInstantSearch(string query)
|
||||
{
|
||||
if (query.StartsWith(">")) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using Wox.Plugin.WebSearch.SuggestionSources;
|
||||
|
||||
namespace Wox.Plugin.WebSearch
|
||||
{
|
||||
public class WebSearchPlugin : IPlugin, ISettingProvider,IPluginI18n
|
||||
public class WebSearchPlugin : IPlugin, ISettingProvider, IPluginI18n, IInstantSearch
|
||||
{
|
||||
private PluginInitContext context;
|
||||
|
||||
@@ -97,5 +97,16 @@ namespace Wox.Plugin.WebSearch
|
||||
{
|
||||
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
|
||||
}
|
||||
|
||||
public bool IsInstantSearch(string query)
|
||||
{
|
||||
var strings = query.Split(' ');
|
||||
if (strings.Length > 1)
|
||||
{
|
||||
return WebSearchStorage.Instance.EnableWebSearchSuggestion &&
|
||||
WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == strings[0] && o.Enabled);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user