PowerToys/Plugins/Wox.Plugin.WebSearch/SuggestionSources/ISuggestionSource.cs
bao-qian ba1e22955e Web search suggestion is loaded async
1. suggestion is async
2. if ping time of domain less than 300ms, then suggestion is still sync
3. #578 #539
2016-05-05 16:08:48 +01:00

33 lines
829 B
C#

using System.Collections.Generic;
namespace Wox.Plugin.WebSearch.SuggestionSources
{
public abstract class SuggestionSource
{
public virtual string Domain { get; set; }
public IHttpProxy Proxy { get; set; }
public SuggestionSource(IHttpProxy httpProxy)
{
Proxy = httpProxy;
}
public abstract List<string> GetSuggestions(string query);
public static SuggestionSource GetSuggestionSource(string name, PluginInitContext context)
{
switch (name.ToLower())
{
case "google":
return new Google(context.Proxy);
case "baidu":
return new Baidu(context.Proxy);
default:
return null;
}
}
}
}