2014-01-03 18:16:05 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
2014-01-03 23:52:36 +08:00
|
|
|
|
using System.Threading;
|
2014-07-01 22:19:46 +08:00
|
|
|
|
using Wox.Infrastructure.Storage.UserSettings;
|
2014-01-29 18:33:24 +08:00
|
|
|
|
using Wox.Plugin;
|
|
|
|
|
using Wox.PluginLoader;
|
2014-01-03 18:16:05 +08:00
|
|
|
|
|
2014-01-29 18:33:24 +08:00
|
|
|
|
namespace Wox.Commands
|
2014-01-03 18:16:05 +08:00
|
|
|
|
{
|
2014-01-03 23:52:36 +08:00
|
|
|
|
public class SystemCommand : BaseCommand
|
2014-01-03 18:16:05 +08:00
|
|
|
|
{
|
2014-03-18 23:41:34 +08:00
|
|
|
|
public override void Dispatch(Query query)
|
2014-01-03 18:16:05 +08:00
|
|
|
|
{
|
2014-03-25 17:08:35 +08:00
|
|
|
|
foreach (PluginPair pair in Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.System))
|
2014-01-03 23:52:36 +08:00
|
|
|
|
{
|
|
|
|
|
PluginPair pair1 = pair;
|
2014-07-01 22:19:46 +08:00
|
|
|
|
|
2014-01-03 23:52:36 +08:00
|
|
|
|
ThreadPool.QueueUserWorkItem(state =>
|
|
|
|
|
{
|
2014-03-27 16:56:50 +08:00
|
|
|
|
pair1.InitContext.PushResults = (q, r) =>
|
2014-01-03 23:52:36 +08:00
|
|
|
|
{
|
2014-03-27 14:50:42 +08:00
|
|
|
|
foreach (Result result in r)
|
|
|
|
|
{
|
|
|
|
|
result.PluginDirectory = pair1.Metadata.PluginDirecotry;
|
2014-03-27 16:56:50 +08:00
|
|
|
|
result.OriginQuery = q;
|
2014-03-27 14:50:42 +08:00
|
|
|
|
result.AutoAjustScore = true;
|
|
|
|
|
}
|
|
|
|
|
UpdateResultView(r);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
List<Result> results = pair1.Plugin.Query(query);
|
2014-03-27 16:56:50 +08:00
|
|
|
|
pair1.InitContext.PushResults(query, results);
|
2014-01-03 23:52:36 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
2014-01-03 18:16:05 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|