PowerToys/Plugins/Wox.Plugin.WebSearch/SuggestionSources/ISuggestionSource.cs
bao-qian 6ac33b0568 Add manually check updates option
1. manually check updates
2. refactoring get http request to use async
3. remove some generic exception catch
4. remove unused code
2016-05-09 02:32:47 +01:00

34 lines
865 B
C#

using System.Collections.Generic;
using System.Threading.Tasks;
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 Task<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;
}
}
}
}