mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 09:28:03 +08:00
Add pluginID for result.
This commit is contained in:
parent
4379145231
commit
929cc2727d
@ -3,18 +3,18 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
||||
{
|
||||
internal static class QueryDispatcher
|
||||
{
|
||||
private static IQueryDispatcher pluginCmd = new RegularPluginQueryDispatcher();
|
||||
private static IQueryDispatcher systemCmd = new WildcardPluginQueryDispatcher();
|
||||
private static IQueryDispatcher regularDispatcher = new RegularPluginQueryDispatcher();
|
||||
private static IQueryDispatcher wildcardDispatcher = new WildcardPluginQueryDispatcher();
|
||||
|
||||
public static void Dispatch(Wox.Plugin.Query query)
|
||||
{
|
||||
if (PluginManager.IsRegularPluginQuery(query))
|
||||
{
|
||||
pluginCmd.Dispatch(query);
|
||||
regularDispatcher.Dispatch(query);
|
||||
}
|
||||
else
|
||||
{
|
||||
systemCmd.Dispatch(query);
|
||||
wildcardDispatcher.Dispatch(query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,11 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
||||
try
|
||||
{
|
||||
List<Result> results = regularPlugin.Plugin.Query(query) ?? new List<Result>();
|
||||
PluginManager.API.PushResults(query,regularPlugin.Metadata,results);
|
||||
results.ForEach(o =>
|
||||
{
|
||||
o.PluginID = regularPlugin.Metadata.ID;
|
||||
});
|
||||
PluginManager.API.PushResults(query, regularPlugin.Metadata, results);
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
|
@ -23,7 +23,10 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
||||
try
|
||||
{
|
||||
List<Result> results = pair1.Plugin.Query(query);
|
||||
results.ForEach(o => { o.AutoAjustScore = true; });
|
||||
results.ForEach(o =>
|
||||
{
|
||||
o.PluginID = pair1.Metadata.ID;
|
||||
});
|
||||
|
||||
PluginManager.API.PushResults(query, pair1.Metadata, results);
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ namespace Wox.Core.UserSettings
|
||||
|
||||
protected override string ConfigFolder
|
||||
{
|
||||
get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
|
||||
get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Config"); }
|
||||
}
|
||||
|
||||
protected override string ConfigName
|
||||
|
@ -7,7 +7,7 @@ namespace Wox.Plugin
|
||||
{
|
||||
public class PluginInitContext
|
||||
{
|
||||
public PluginMetadata CurrentPluginMetadata { get; set; }
|
||||
public PluginMetadata CurrentPluginMetadata { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Public APIs for plugin invocation
|
||||
|
@ -15,6 +15,7 @@ namespace Wox.Plugin
|
||||
/// if we need to change the plugin config in the futher, use this to
|
||||
/// indicate config version
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
public int ConfigVersion
|
||||
{
|
||||
get { return configVersion; }
|
||||
|
@ -2,9 +2,6 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Wox.Plugin")]
|
||||
[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
@ -13,24 +10,10 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyCopyright("The MIT License (MIT)")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("c22be00d-a6f5-4e45-8ecc-09ebf297c812")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
[assembly: InternalsVisibleTo("Wox")]
|
||||
[assembly: InternalsVisibleTo("Wox.Core")]
|
@ -8,7 +8,6 @@ namespace Wox.Plugin
|
||||
|
||||
public class Result
|
||||
{
|
||||
|
||||
public string Title { get; set; }
|
||||
public string SubTitle { get; set; }
|
||||
public string IcoPath { get; set; }
|
||||
@ -34,21 +33,15 @@ namespace Wox.Plugin
|
||||
|
||||
public int Score { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Auto add scores for MRU items
|
||||
/// </summary>
|
||||
public bool AutoAjustScore { get; set; }
|
||||
|
||||
//todo: this should be controlled by system, not visible to users
|
||||
/// <summary>
|
||||
/// Only resulsts that originQuery match with curren query will be displayed in the panel
|
||||
/// </summary>
|
||||
public Query OriginQuery { get; set; }
|
||||
internal Query OriginQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Don't set this property if you are developing a plugin
|
||||
/// Plugin directory
|
||||
/// </summary>
|
||||
public string PluginDirectory { get; set; }
|
||||
public string PluginDirectory { get; internal set; }
|
||||
|
||||
public new bool Equals(object obj)
|
||||
{
|
||||
@ -75,6 +68,14 @@ namespace Wox.Plugin
|
||||
this.SubTitle = SubTitle;
|
||||
}
|
||||
|
||||
public List<Result> ContextMenu { get; set; }
|
||||
/// <summary>
|
||||
/// Context menus associate with this result
|
||||
/// </summary>
|
||||
public List<Result> ContextMenu { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Plugin ID that generate this result
|
||||
/// </summary>
|
||||
public string PluginID { get; set; }
|
||||
}
|
||||
}
|
@ -653,12 +653,10 @@ namespace Wox
|
||||
|
||||
if (list.Count > 0)
|
||||
{
|
||||
//todo:this should be opened to users, it's their choice to use it or not in their workflows
|
||||
list.ForEach(
|
||||
o =>
|
||||
{
|
||||
if (o.AutoAjustScore) o.Score += UserSelectedRecordStorage.Instance.GetSelectedCount(o) * 5;
|
||||
});
|
||||
list.ForEach(o =>
|
||||
{
|
||||
o.Score += UserSelectedRecordStorage.Instance.GetSelectedCount(o) * 5;
|
||||
});
|
||||
List<Result> l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == lastQuery).ToList();
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ namespace Wox.Storage
|
||||
|
||||
protected override string ConfigFolder
|
||||
{
|
||||
get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
|
||||
get { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Config"); }
|
||||
}
|
||||
|
||||
protected override string ConfigName
|
||||
|
Loading…
Reference in New Issue
Block a user