PowerToys/Wox/Commands/SystemCommand.cs

41 lines
1.3 KiB
C#
Raw Normal View History

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;
using Wox.Infrastructure.Storage.UserSettings;
2014-01-29 18:33:24 +08:00
using Wox.Plugin;
using Wox.Plugin.SystemPlugins;
2014-01-29 18:33:24 +08:00
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
{
var allSytemPlugins = Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.System);
if (UserSettingStorage.Instance.WebSearches.Exists(o => o.ActionWord == query.ActionName && o.Enabled))
2014-01-03 23:52:36 +08:00
{
//websearch mode
allSytemPlugins = new List<PluginPair>()
{
allSytemPlugins.First(o => ((ISystemPlugin)o.Plugin).ID == "565B73353DBF4806919830B9202EE3BF")
};
}
foreach (PluginPair pair in allSytemPlugins)
{
PluginPair pair1 = pair;
2014-01-03 23:52:36 +08:00
ThreadPool.QueueUserWorkItem(state =>
{
List<Result> results = pair1.Plugin.Query(query);
results.ForEach(o => { o.AutoAjustScore = true; });
2014-07-05 23:10:34 +08:00
App.Window.PushResults(query, pair1.Metadata, results);
2014-01-03 23:52:36 +08:00
});
}
2014-01-03 18:16:05 +08:00
}
}
}