private void enterButton_Click(object sender, EventArgs e) { LolInfo.APIKEY = apiKeyTextBox.Text; InfoGrabber grabber = new InfoGrabber("na", LolInfo.APIKEY); //Dictionary<string, Summoner> summoners = new InfoGrabber().LookupSummonersByID("na", ); try { //IDictionary<string, List<League>> leagueGroups = new InfoGrabber().GetLeague("na", 2); //RecentGamesCollection games = new InfoGrabber().GetRecentGames("na", 2); LolInfo.ChampionCollection = grabber.GetChampions(); ItemList list = grabber.GetItems(); this.Close(); } catch (WebException ex) { MessageBox.Show("Invalid apikey"); } }
private void searchButton_Click(object sender, EventArgs e) { if (nameTextBox.Text.Trim() == "" || regionComboBox.SelectedIndex == -1) { MessageBox.Show("Please enter a name or select a region."); return; } InfoGrabber g = new InfoGrabber("na", LolInfo.APIKEY); summoner = g.LookupSummonerByName(nameTextBox.Text, regionComboBox.SelectedItem.ToString()); try { teams = summoner.GetTeams(); } catch { } finally { for (int i = 0; i < teams.Count(); i++) { DataRow row = table.NewRow(); row["Team Name"] = teams[i].Name; row["Number of Members"] = teams[i].Roster.MemberList.Count().ToString(); int team3v3Wins = 0; int team3v3Losses = 0; int team5v5Wins = 0; int team5v5Losses = 0; if (teams[i].MatchHistory != null) { for (int j = 0; j < teams[i].MatchHistory.Count(); j++) { if (teams[i].MatchHistory[j].Win) { if (teams[i].MatchHistory[j].MapId == 41) { team3v3Wins++; } else { team5v5Wins++; } } else { if (teams[i].MatchHistory[j].MapId == 41) { team3v3Losses++; } else { team5v5Losses++; } } } row["Total Win/Loss"] = (team3v3Wins + team5v5Wins).ToString() + "/" + (team3v3Losses + team5v5Losses).ToString(); row["3v3 Win/Loss"] = team3v3Wins.ToString() + "/" + team3v3Losses.ToString(); row["5v5 Win/Loss"] = team5v5Wins.ToString() + "/" + team5v5Losses.ToString(); } else { row["Total Win/Loss"] = "No Games Played"; row["3v3 Win/Loss"] = "No Games Played"; row["5v5 Win/Loss"] = "No Games Played"; } table.Rows.Add(row); } } teamsInfoDataGrid.DataSource = table; }
private void SummonerForm_Load(object sender, EventArgs e) { info = new InfoGrabber("na", LolInfo.APIKEY); table = new DataTable(); gamesPlayed = new RecentGamesCollection(); champs = new ChampionCollection(); table.Columns.Add("Date"); table.Columns.Add("Game"); table.Columns.Add("Type"); table.Columns.Add("Queue"); table.Columns.Add("Champion"); table.Columns.Add("WinLoss"); table.Columns.Add("K/D/A"); }