mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-13 11:09:28 +08:00
9a2ffc1d7c
Fix issues with push results
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using Wox.Plugin;
|
|
using Wox.PluginLoader;
|
|
|
|
namespace Wox.Commands
|
|
{
|
|
public class SystemCommand : BaseCommand
|
|
{
|
|
public override void Dispatch(Query query)
|
|
{
|
|
foreach (PluginPair pair in Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.System))
|
|
{
|
|
PluginPair pair1 = pair;
|
|
ThreadPool.QueueUserWorkItem(state =>
|
|
{
|
|
pair1.InitContext.PushResults = (q, r) =>
|
|
{
|
|
if (r == null || r.Count == 0) return;
|
|
foreach (Result result in r)
|
|
{
|
|
result.PluginDirectory = pair1.Metadata.PluginDirecotry;
|
|
result.OriginQuery = q;
|
|
result.AutoAjustScore = true;
|
|
}
|
|
UpdateResultView(r);
|
|
};
|
|
|
|
List<Result> results = pair1.Plugin.Query(query);
|
|
pair1.InitContext.PushResults(query, results);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|