private void summonerNameInput1_KeyDown(object sender, KeyEventArgs e) { errorLabel.Hide(); smnInput1TextDelta = summonerNameInput1.Text; if (e.KeyCode == Keys.Enter) { try { long summonerId = Get_Summoner_ID_By_Name(summonerNameInput1.Text, apikey); List <MatchReference> matches = Get_Matches_From_Summoner_ID(summonerId, apikey); // Add items to match listbox MatchListBox.BeginUpdate(); MatchListBox.Items.Clear(); MatchListBox.DisplayMember = "name"; MatchListBox.ValueMember = "id"; foreach (MatchReference match in matches) { string champ = ChampionsInv.data[match.champion.ToString()].name; MatchListBox.Items.Add(new MatchListBoxType(champ, match.matchId)); } MatchListBox.EndUpdate(); } catch (Exception error) { Show_Error(error.Message); } } }
private void summonerNameInput1_TextChanged(object sender, EventArgs e) { if (summonerNameInput1.Text != smnInput1TextDelta && smnInput1TextDelta != "") { smnInput1TextDelta = ""; errorLabel.Hide(); MatchListBox.BeginUpdate(); MatchListBox.Items.Clear(); MatchListBox.EndUpdate(); resetMasteries(); } }