Prisjakt - WOX plugin
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using Wox.Plugin; | |
namespace WOX.Prisjakt | |
{ | |
public class Main : IPlugin | |
{ | |
private static string prisjaktQueryUrl = "https://www.prisjakt.nu/#rparams=ss="; | |
public void Init(PluginInitContext context) | |
{ | |
} | |
public List<Result> Query(Query query) | |
{ | |
// GET THE QUERY THAT THE USER WANT TO SEARCH FOR | |
var product = query.Search; | |
// CREATE A RESULT TO SHOW THE LOGO AND THE QUERY AND ADD ACTION | |
var result = new Result | |
{ | |
Title = "Search on Prisjakt...", | |
IcoPath = "Images\\prisjakt.png", | |
SubTitle = string.Format("Keyword: {0}", product), | |
Action = (Func<ActionContext, bool>)(c => | |
{ | |
// WHEN THE USER HITS ENTER, RUN THE METHOD | |
SearchPrisjakt(product); | |
return true; | |
}) | |
}; | |
// SHOW THE ROW WITH THE QUERY | |
return new List<Result> { result }; | |
} | |
public void SearchPrisjakt(string query) | |
{ | |
// START THE DEFAULT BROWSER AND OPEN A FORMATTED URL TO DO A SEARCH ON PRISJAKT | |
Process.Start(string.Format("{0}{1}", prisjaktQueryUrl, Uri.EscapeDataString(query))); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment