PowerToys/Wox.Plugin.SystemPlugins/UrlPlugin.cs

47 lines
1.4 KiB
C#
Raw Normal View History

2014-05-24 16:29:56 +08:00
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Wox.Plugin.SystemPlugins
{
public class UrlPlugin : BaseSystemPlugin
{
protected override List<Result> QueryInternal(Query query)
{
var raw = query.RawQuery;
Uri uri;
if (Uri.TryCreate(raw, UriKind.Absolute, out uri))
{
return new List<Result>
{
new Result
{
Title = raw,
SubTitle = "Open the typed URL...",
IcoPath = "Images/url1.png",
Score = 8,
Action = _ =>
{
2014-07-10 23:57:08 +08:00
Process.Start(uri.AbsoluteUri);
2014-05-24 16:29:56 +08:00
return true;
}
}
};
}
return new List<Result>(0);
}
public override string ID
{
get { return "0308FD86DE0A4DEE8D62B9B535370992"; }
}
2014-05-24 16:29:56 +08:00
public override string Name { get { return "URL handler"; } }
2014-06-30 21:31:13 +08:00
public override string Description { get { return "Provide Opening the typed URL from Wox."; } }
2014-05-24 16:29:56 +08:00
public override string IcoPath { get { return "Images/url2.png"; } }
protected override void InitInternal(PluginInitContext context)
{
}
}
}