mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 04:37:30 +02:00
Add PushResults for push results before Query results return
This commit is contained in:
@@ -27,13 +27,17 @@ namespace Wox.Commands
|
||||
{
|
||||
try
|
||||
{
|
||||
List<Result> r = thirdPlugin.Plugin.Query(q) ?? new List<Result>();
|
||||
r.ForEach(o =>
|
||||
thirdPlugin.InitContext.PushResults = r =>
|
||||
{
|
||||
o.PluginDirectory = thirdPlugin.Metadata.PluginDirecotry;
|
||||
o.OriginQuery = q;
|
||||
});
|
||||
UpdateResultView(r);
|
||||
r.ForEach(o =>
|
||||
{
|
||||
o.PluginDirectory = thirdPlugin.Metadata.PluginDirecotry;
|
||||
o.OriginQuery = q;
|
||||
});
|
||||
UpdateResultView(r);
|
||||
};
|
||||
List<Result> results = thirdPlugin.Plugin.Query(q) ?? new List<Result>();
|
||||
thirdPlugin.InitContext.PushResults(results);
|
||||
}
|
||||
catch (Exception queryException)
|
||||
{
|
||||
|
||||
@@ -17,14 +17,20 @@ namespace Wox.Commands
|
||||
PluginPair pair1 = pair;
|
||||
ThreadPool.QueueUserWorkItem(state =>
|
||||
{
|
||||
List<Result> results = pair1.Plugin.Query(query);
|
||||
foreach (Result result in results)
|
||||
pair1.InitContext.PushResults = r =>
|
||||
{
|
||||
result.PluginDirectory = pair1.Metadata.PluginDirecotry;
|
||||
result.OriginQuery = query;
|
||||
result.AutoAjustScore = true;
|
||||
}
|
||||
if(results.Count > 0) UpdateResultView(results);
|
||||
if (r == null || r.Count == 0) return;
|
||||
foreach (Result result in r)
|
||||
{
|
||||
result.PluginDirectory = pair1.Metadata.PluginDirecotry;
|
||||
result.OriginQuery = query;
|
||||
result.AutoAjustScore = true;
|
||||
}
|
||||
UpdateResultView(r);
|
||||
};
|
||||
|
||||
List<Result> results = pair1.Plugin.Query(query);
|
||||
pair1.InitContext.PushResults(results);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Wox.PluginLoader
|
||||
if (pluginPair != null)
|
||||
{
|
||||
PluginMetadata metadata = pluginPair.Metadata;
|
||||
forker.Fork(() => plugin1.Init(new PluginInitContext()
|
||||
pluginPair.InitContext = new PluginInitContext()
|
||||
{
|
||||
Plugins = plugins,
|
||||
CurrentPluginMetadata = metadata,
|
||||
@@ -60,7 +60,8 @@ namespace Wox.PluginLoader
|
||||
StartLoadingBar = () => App.Window.Dispatcher.Invoke(new Action(() => App.Window.StartLoadingBar())),
|
||||
StopLoadingBar = () => App.Window.Dispatcher.Invoke(new Action(() => App.Window.StopLoadingBar())),
|
||||
ShellRun = (cmd) => (bool) App.Window.Dispatcher.Invoke(new Func<bool>(() => App.Window.ShellRun(cmd))),
|
||||
}));
|
||||
};
|
||||
forker.Fork(() => plugin1.Init(pluginPair.InitContext));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user