PowerToys/Wox.Core/Plugin/QueryDispatcher/QueryDispatcher.cs

35 lines
1.0 KiB
C#
Raw Normal View History

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
{
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;
}
if (PluginManager.IsUserPluginQuery(query))
2014-12-26 22:51:04 +08:00
{
UserPluginDispatcher.Dispatch(query);
2014-12-26 22:51:04 +08:00
}
else
{
SystemPluginDispatcher.Dispatch(query);
2014-12-26 22:51:04 +08:00
}
}
}
}