mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
|
|
using System.Threading;
|
|
using Wox.Plugin;
|
|
|
|
namespace Wox.Core.Plugin.QueryDispatcher
|
|
{
|
|
internal static class QueryDispatcher
|
|
{
|
|
private static readonly IQueryDispatcher UserPluginDispatcher = new UserPluginQueryDispatcher();
|
|
private static readonly IQueryDispatcher SystemPluginDispatcher = new SystemPluginQueryDispatcher();
|
|
|
|
public static void Dispatch(Wox.Plugin.Query query)
|
|
{
|
|
PluginPair exclusiveSearchPlugin = PluginManager.GetExclusiveSearchPlugin(query);
|
|
if (exclusiveSearchPlugin != null)
|
|
{
|
|
ThreadPool.QueueUserWorkItem(state =>
|
|
{
|
|
PluginManager.ExecutePluginQuery(exclusiveSearchPlugin, query);
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (PluginManager.IsUserPluginQuery(query))
|
|
{
|
|
UserPluginDispatcher.Dispatch(query);
|
|
}
|
|
else
|
|
{
|
|
SystemPluginDispatcher.Dispatch(query);
|
|
}
|
|
}
|
|
}
|
|
}
|