Skip to content

Instantly share code, notes, and snippets.

@Yodapp Yodapp/main.cs
Created Oct 14, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.