2014-12-26 22:51:04 +08:00
|
|
|
|
|
2015-02-05 18:43:05 +08:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using Wox.Plugin;
|
|
|
|
|
|
2014-12-26 22:51:04 +08:00
|
|
|
|
namespace Wox.Core.Plugin.QueryDispatcher
|
|
|
|
|
{
|
|
|
|
|
internal static class QueryDispatcher
|
|
|
|
|
{
|
2015-01-26 17:46:55 +08:00
|
|
|
|
private static readonly IQueryDispatcher UserPluginDispatcher = new UserPluginQueryDispatcher();
|
|
|
|
|
private static readonly IQueryDispatcher SystemPluginDispatcher = new SystemPluginQueryDispatcher();
|
2014-12-26 22:51:04 +08:00
|
|
|
|
|
|
|
|
|
public static void Dispatch(Wox.Plugin.Query query)
|
|
|
|
|
{
|
2015-02-05 18:43:05 +08:00
|
|
|
|
PluginPair exclusiveSearchPlugin = PluginManager.GetExclusiveSearchPlugin(query);
|
|
|
|
|
if (exclusiveSearchPlugin != null)
|
|
|
|
|
{
|
|
|
|
|
ThreadPool.QueueUserWorkItem(state =>
|
|
|
|
|
{
|
|
|
|
|
PluginManager.ExecutePluginQuery(exclusiveSearchPlugin, query);
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-26 17:46:55 +08:00
|
|
|
|
if (PluginManager.IsUserPluginQuery(query))
|
2014-12-26 22:51:04 +08:00
|
|
|
|
{
|
2015-01-26 17:46:55 +08:00
|
|
|
|
UserPluginDispatcher.Dispatch(query);
|
2014-12-26 22:51:04 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-01-26 17:46:55 +08:00
|
|
|
|
SystemPluginDispatcher.Dispatch(query);
|
2014-12-26 22:51:04 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|