Implement IInstantSearch for CMD and WebSearch plugin

This commit is contained in:
qianlifeng
2015-01-27 22:59:03 +08:00
parent 4ecff94aec
commit 9f64a384d6
7 changed files with 99 additions and 13 deletions

View File

@@ -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;
}
}
}