mirror of
https://github.com/microsoft/PowerToys
synced 2024-11-21 15:53:19 +00:00
Add missed changes
This commit is contained in:
parent
2db2136117
commit
3901422a54
61
WinAlfred.Plugin.System/ThirdpartyPluginIndicator.cs
Normal file
61
WinAlfred.Plugin.System/ThirdpartyPluginIndicator.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace WinAlfred.Plugin.System
|
||||
{
|
||||
public class ThirdpartyPluginIndicator : ISystemPlugin
|
||||
{
|
||||
private List<PluginPair> allPlugins = new List<PluginPair>();
|
||||
private Action<string> changeQuery;
|
||||
|
||||
public List<Result> Query(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("press space to active {0} workflow",metadata.Name),
|
||||
Score = 50,
|
||||
IcoPath = "Images/work.png",
|
||||
Action = () => changeQuery(metadataCopy.ActionKeyword + " "),
|
||||
DontHideWinAlfredAfterAction = true
|
||||
};
|
||||
results.Add(result);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public void Init(PluginInitContext context)
|
||||
{
|
||||
allPlugins = context.Plugins;
|
||||
changeQuery = context.ChangeQuery;
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get
|
||||
{
|
||||
return "ThirdpartyPluginIndicator";
|
||||
}
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "ThirdpartyPluginIndicator";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
29
WinAlfred/Commands/BaseCommand.cs
Normal file
29
WinAlfred/Commands/BaseCommand.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using WinAlfred.Plugin;
|
||||
|
||||
namespace WinAlfred.Commands
|
||||
{
|
||||
public abstract class BaseCommand
|
||||
{
|
||||
private MainWindow window;
|
||||
|
||||
public abstract void Dispatch(Query query);
|
||||
|
||||
//TODO:Ugly, we should subscribe events here, instead of just use usercontrol as the parameter
|
||||
protected BaseCommand(MainWindow window)
|
||||
{
|
||||
this.window = window;
|
||||
}
|
||||
|
||||
protected void UpdateResultView(List<Result> results)
|
||||
{
|
||||
if (results.Count > 0)
|
||||
{
|
||||
window.OnUpdateResultView(results);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
WinAlfred/Images/close.png
Normal file
BIN
WinAlfred/Images/close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 139 B |
BIN
WinAlfred/Images/cmd.png
Normal file
BIN
WinAlfred/Images/cmd.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
WinAlfred/Images/exit.png
Normal file
BIN
WinAlfred/Images/exit.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
WinAlfred/Images/logoff.png
Normal file
BIN
WinAlfred/Images/logoff.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 613 B |
BIN
WinAlfred/Images/work.png
Normal file
BIN
WinAlfred/Images/work.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
@ -100,6 +100,9 @@ namespace WinAlfred
|
||||
Plugins.Init(this);
|
||||
cmdDispatcher = new Command(this);
|
||||
InitialTray();
|
||||
|
||||
//var engine = new Jurassic.ScriptEngine();
|
||||
//MessageBox.Show(engine.Evaluate("5 * 10 + 2").ToString());
|
||||
}
|
||||
|
||||
private void TbQuery_OnPreviewKeyDown(object sender, KeyEventArgs e)
|
||||
|
@ -59,6 +59,9 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Accessibility" />
|
||||
<Reference Include="Jurassic">
|
||||
<HintPath>C:\Users\Scott\Desktop\Jurassic.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\packages\log4net.2.0.3\lib\net35-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
|
Loading…
Reference in New Issue
Block a user