Refactoring instant query

This commit is contained in:
bao-qian
2015-11-03 00:34:27 +00:00
parent cd0d9052e8
commit fc6ac662cd
6 changed files with 38 additions and 68 deletions

View File

@@ -200,11 +200,7 @@ namespace Wox.Plugin.CMD
return context.API.GetTranslation("wox_plugin_cmd_plugin_description");
}
public bool IsInstantQuery(string query)
{
if (query.StartsWith(">")) return true;
return false;
}
public bool IsInstantQuery(string query) => false;
public bool IsExclusiveQuery(Query query)
{

View File

@@ -120,19 +120,16 @@ namespace Wox.Plugin.WebSearch
return context.API.GetTranslation("wox_plugin_websearch_plugin_description");
}
public bool IsInstantQuery(string query)
public bool IsInstantQuery(string query) => false;
public bool IsExclusiveQuery(Query query)
{
var strings = query.Split(' ');
var strings = query.RawQuery.Split(' ');
if (strings.Length > 1)
{
return WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == strings[0] && o.Enabled);
}
return false;
}
public bool IsExclusiveQuery(Query query)
{
return IsInstantQuery(query.RawQuery);
}
}
}