mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
Rename the project.
This commit is contained in:
46
Wox.Plugin.System/ThirdpartyPluginIndicator.cs
Normal file
46
Wox.Plugin.System/ThirdpartyPluginIndicator.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Plugin.System
|
||||
{
|
||||
public class ThirdpartyPluginIndicator : BaseSystemPlugin
|
||||
{
|
||||
private List<PluginPair> allPlugins = new List<PluginPair>();
|
||||
private Action<string> changeQuery;
|
||||
|
||||
protected override List<Result> QueryInternal(Query query)
|
||||
{
|
||||
List<Result> results = new List<Result>();
|
||||
if (string.IsNullOrEmpty(query.RawQuery)) return results;
|
||||
|
||||
foreach (PluginMetadata metadata in allPlugins.Select(o=>o.Metadata))
|
||||
{
|
||||
if (metadata.ActionKeyword.StartsWith(query.RawQuery))
|
||||
{
|
||||
PluginMetadata metadataCopy = metadata;
|
||||
Result result = new Result
|
||||
{
|
||||
Title = metadata.ActionKeyword,
|
||||
SubTitle = string.Format("Activate {0} workflow",metadata.Name),
|
||||
Score = 50,
|
||||
IcoPath = "Images/work.png",
|
||||
Action = () => changeQuery(metadataCopy.ActionKeyword + " "),
|
||||
DontHideWoxAfterSelect = true
|
||||
};
|
||||
results.Add(result);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
protected override void InitInternal(PluginInitContext context)
|
||||
{
|
||||
allPlugins = context.Plugins;
|
||||
changeQuery = context.ChangeQuery;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user