PowerToys/Wox.Core/Plugin/QueryDispatcher/UserPluginQueryDispatcher.cs

38 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;
2014-01-03 23:52:36 +08:00
using System.Threading;
2015-01-16 23:42:12 +08:00
using Wox.Core.Exception;
using Wox.Core.UserSettings;
2014-09-19 16:57:48 +08:00
using Wox.Infrastructure.Logger;
2014-01-29 18:33:24 +08:00
using Wox.Plugin;
2014-01-03 18:16:05 +08:00
2014-12-26 22:51:04 +08:00
namespace Wox.Core.Plugin.QueryDispatcher
2014-01-03 18:16:05 +08:00
{
2015-02-04 23:16:41 +08:00
public class UserPluginQueryDispatcher : BaseQueryDispatcher
2014-01-03 18:16:05 +08:00
{
2015-02-04 23:16:41 +08:00
protected override List<PluginPair> GetPlugins(Query query)
2014-01-03 23:52:36 +08:00
{
2015-02-04 23:16:41 +08:00
List<PluginPair> plugins = new List<PluginPair>();
//only first plugin that matches action keyword will get executed
PluginPair userPlugin = PluginManager.AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.GetActionKeyword());
2015-02-04 23:16:41 +08:00
if (userPlugin != null)
2014-01-03 18:16:05 +08:00
{
2015-02-04 23:16:41 +08:00
var customizedPluginConfig = UserSettingStorage.Instance.
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == userPlugin.Metadata.ID);
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
{
2014-07-05 23:10:34 +08:00
//need to stop the loading animation
2014-12-26 22:51:04 +08:00
PluginManager.API.StopLoadingBar();
}
2015-02-04 23:16:41 +08:00
else
{
2015-02-04 23:16:41 +08:00
plugins.Add(userPlugin);
}
}
2015-02-04 23:16:41 +08:00
return plugins;
}
2014-01-03 18:16:05 +08:00
}
}