mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add post-action
This commit is contained in:
parent
47a0642c4d
commit
2ee671a1ae
1 changed files with 27 additions and 5 deletions
|
|
@ -4,6 +4,7 @@ using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace Wox.Plugin.SystemPlugins
|
namespace Wox.Plugin.SystemPlugins
|
||||||
{
|
{
|
||||||
|
|
@ -16,7 +17,7 @@ namespace Wox.Plugin.SystemPlugins
|
||||||
|
|
||||||
public ColorsPlugin()
|
public ColorsPlugin()
|
||||||
{
|
{
|
||||||
if(!Directory.Exists(DIR_PATH))
|
if (!Directory.Exists(DIR_PATH))
|
||||||
{
|
{
|
||||||
ColorsDirectory = Directory.CreateDirectory(DIR_PATH);
|
ColorsDirectory = Directory.CreateDirectory(DIR_PATH);
|
||||||
}
|
}
|
||||||
|
|
@ -29,16 +30,37 @@ namespace Wox.Plugin.SystemPlugins
|
||||||
protected override List<Result> QueryInternal(Query query)
|
protected override List<Result> QueryInternal(Query query)
|
||||||
{
|
{
|
||||||
var raw = query.RawQuery;
|
var raw = query.RawQuery;
|
||||||
if(!IsAvailable(raw)) return new List<Result>(0);
|
if (!IsAvailable(raw)) return new List<Result>(0);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var cached = Find(raw);
|
var cached = Find(raw);
|
||||||
if(cached.Length == 0)
|
if (cached.Length == 0)
|
||||||
{
|
{
|
||||||
var path = CreateImage(raw);
|
var path = CreateImage(raw);
|
||||||
return new List<Result> {new Result(raw, path)};
|
return new List<Result>
|
||||||
|
{
|
||||||
|
new Result
|
||||||
|
{
|
||||||
|
Title = raw,
|
||||||
|
IcoPath = path,
|
||||||
|
Action = _ =>
|
||||||
|
{
|
||||||
|
Clipboard.SetText(raw);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return cached.Select(x => new Result(raw, x.FullName)).ToList();
|
return cached.Select(x => new Result
|
||||||
|
{
|
||||||
|
Title = raw,
|
||||||
|
IcoPath = x.FullName,
|
||||||
|
Action = _ =>
|
||||||
|
{
|
||||||
|
Clipboard.SetText(raw);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}).ToList();
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue