示例#1
0
        public static SummonerDTO fetchSmnrInfo(string smnrName)
        {
            //Fetch SummonerDTO from API
            string      URL  = "https://" + region + ".api.riotgames.com/lol/summoner/v3/summoners/by-name/" + smnrName + "?api_key=" + apikey;
            SummonerDTO user = deserJSON <SummonerDTO>(URL);

            if (user != null)
            {
                return(user);
            }
            return(null);
        }
示例#2
0
        private void fetchBtn_Click(object sender, EventArgs e)
        {
            string      smnrName = smnrNameInput.Text;      //Fetch name from input box
            SummonerDTO user     = fetchSmnrInfo(smnrName); //Fetch data from API

            //Start displaying fetched data
            if (user != null)
            {
                smnrNameLbl.Text = user.name;
                smnrIdBox.Text   = user.id.ToString();
                accIdBox.Text    = user.accountid.ToString();
                smnrLvlLbl.Text  = user.summonerLevel.ToString();
                int icon = user.profileIconid;
                smnrIcon.Size = new Size(128, 128);
                string iconURL = "http://ddragon.leagueoflegends.com/cdn/" + league_version + "/img/profileicon/" + icon.ToString() + ".png";
                smnrIcon.Load(iconURL);
                List <LeaguePositionDTO> rankInfo = getRankInfo(user.id);
                smnrRankLbl.Text   = getSoloRank(rankInfo);
                seriesInfoLbl.Text = getSeriesInfo(rankInfo);
            }
        }