mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
Improve instant search ue
This commit is contained in:
39
Wox.Core/Plugin/QueryDispatcher/BaseQueryDispatcher.cs
Normal file
39
Wox.Core/Plugin/QueryDispatcher/BaseQueryDispatcher.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Wox.Core.Plugin.QueryDispatcher
|
||||
{
|
||||
public abstract class BaseQueryDispatcher : IQueryDispatcher
|
||||
{
|
||||
protected abstract List<PluginPair> GetPlugins(Query query);
|
||||
|
||||
public void Dispatch(Query query)
|
||||
{
|
||||
foreach (PluginPair pair in GetPlugins(query))
|
||||
{
|
||||
PluginPair localPair = pair;
|
||||
if (query.IsIntantQuery && PluginManager.IsInstantSearchPlugin(pair.Metadata))
|
||||
{
|
||||
DebugHelper.WriteLine(string.Format("Plugin {0} is executing instant search.", pair.Metadata.Name));
|
||||
using (new Timeit(" => instant search took: "))
|
||||
{
|
||||
PluginManager.ExecutePluginQuery(localPair, query);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(state =>
|
||||
{
|
||||
PluginManager.ExecutePluginQuery(localPair, query);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user