mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
Add one instance support.
This commit is contained in:
@@ -14,16 +14,11 @@ namespace WinAlfred.PluginLoader
|
||||
private static string PluginPath = "Plugins";
|
||||
private static string PluginConfigName = "plugin.ini";
|
||||
protected static List<PluginMetadata> pluginMetadatas = new List<PluginMetadata>();
|
||||
|
||||
public abstract List<PluginPair> LoadPlugin();
|
||||
|
||||
static BasePluginLoader()
|
||||
{
|
||||
ParsePlugins();
|
||||
}
|
||||
|
||||
private static void ParsePlugins()
|
||||
public static void ParsePluginsConfig()
|
||||
{
|
||||
pluginMetadatas.Clear();
|
||||
ParseSystemPlugins();
|
||||
ParseThirdPartyPlugins();
|
||||
}
|
||||
@@ -126,7 +121,7 @@ namespace WinAlfred.PluginLoader
|
||||
///// <returns></returns>
|
||||
//private static PluginMetadata filterPythonMetadata(PluginMetadata metadata)
|
||||
//{
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Microsoft.CSharp;
|
||||
using WinAlfred.Plugin;
|
||||
|
||||
namespace WinAlfred.PluginLoader
|
||||
@@ -14,23 +15,22 @@ namespace WinAlfred.PluginLoader
|
||||
public static void Init(MainWindow window)
|
||||
{
|
||||
plugins.Clear();
|
||||
BasePluginLoader.ParsePluginsConfig();
|
||||
|
||||
plugins.AddRange(new PythonPluginLoader().LoadPlugin());
|
||||
plugins.AddRange(new CSharpPluginLoader().LoadPlugin());
|
||||
foreach (IPlugin plugin in plugins.Select(pluginPair => pluginPair.Plugin))
|
||||
{
|
||||
IPlugin plugin1 = plugin;
|
||||
ThreadPool.QueueUserWorkItem(o =>
|
||||
ThreadPool.QueueUserWorkItem(o => plugin1.Init(new PluginInitContext()
|
||||
{
|
||||
plugin1.Init(new PluginInitContext()
|
||||
{
|
||||
Plugins = plugins,
|
||||
ChangeQuery = s => window.ChangeQuery(s),
|
||||
CloseApp = window.CloseApp,
|
||||
HideApp = window.HideApp,
|
||||
ShowApp = window.ShowApp,
|
||||
ShowMsg = (title, subTitle, iconPath) => window.ShowMsg(title, subTitle, iconPath)
|
||||
});
|
||||
});
|
||||
Plugins = plugins,
|
||||
ChangeQuery = s => window.ChangeQuery(s),
|
||||
CloseApp = window.CloseApp,
|
||||
HideApp = window.HideApp,
|
||||
ShowApp = () => window.ShowApp(null),
|
||||
ShowMsg = (title, subTitle, iconPath) => window.ShowMsg(title, subTitle, iconPath)
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,6 @@ namespace WinAlfred.PluginLoader
|
||||
{
|
||||
public class PythonPluginLoader : BasePluginLoader
|
||||
{
|
||||
|
||||
static PythonPluginLoader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override List<PluginPair> LoadPlugin()
|
||||
{
|
||||
List<PluginPair> plugins = new List<PluginPair>();
|
||||
|
||||
Reference in New Issue
Block a user