示例#1
0
        public List <Result> TWTOPGAMES(Wox.Plugin.PluginInitContext context)
        {
            Reset();
            var    TopGames = new Objects.TopGame.RootObject();
            string url      = URLBuilder("games/top", 10, "");

            using (var webClient = new System.Net.WebClient {
                Encoding = System.Text.Encoding.UTF8
            })
            {
                var jsontxt = webClient.DownloadString(url);
                TopGames = JsonConvert.DeserializeObject <Objects.TopGame.RootObject>(jsontxt);
            }
            foreach (var item in TopGames.top)
            {
                results.Add(new Result {
                    Title    = item.game.name,
                    SubTitle = item.game.popularity.ToString("n0") + " viewers are currently watching!",
                    IcoPath  = "Images\\app.png",
                    Score    = Score - 1,
                    Action   = c =>
                    {
                        Utility.ChangeQuery(context, item.game.name, settings);
                        return(false);
                    }
                });
            }
            return(results);
        }
示例#2
0
        public List <Result> TWTOPGAMES(Wox.Plugin.PluginInitContext context)
        {
            Reset();
            var    TopGames = new Objects.TopGame.RootObject();
            string url      = URLBuilder("games/top", 10, "");
            string jsontxt  = TwitchAPICall(url);

            try
            {
                TopGames = JsonConvert.DeserializeObject <Objects.TopGame.RootObject>(jsontxt);
            }
            catch { TopGames = null; }
            if (TopGames is null)
            {
                return(ExceptionResult(jsontxt));
            }
            foreach (var item in TopGames.top)
            {
                results.Add(new Result
                {
                    Title    = item.game.name,
                    SubTitle = item.game.popularity.ToString("n0") + " viewers are currently watching!",
                    IcoPath  = "Images\\app.png",
                    Score    = Score - 1,
                    Action   = c =>
                    {
                        Utility.ChangeQuery(context, item.game.name, settings);
                        return(false);
                    }
                });
            }
            return(results);
        }