mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-15 03:59:15 +08:00
ba1e22955e
1. suggestion is async 2. if ping time of domain less than 300ms, then suggestion is still sync 3. #578 #539
33 lines
829 B
C#
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;
|
|
}
|
|
}
|
|
}
|
|
}
|