private void buttonSelectChamp_Click(object sender, EventArgs e) { pbCover.Image = null; try { string name = lbSelectChamp.SelectedItem.ToString(); currentChamp = new Champs(); champions.ForEach(x => { if (x.findChamp(name) != null) { currentChamp = x; } }); pbChampImage.Image = Image.FromFile("Images/" + name + ".jpg"); updateTextBoxes(currentChamp); pbCover.Image = Image.FromFile("Cover Images/" + name + ".jpg"); pbCover.Visible = true; wbInformation.Visible = false; } catch { } }
private void updateTextBoxes(Champs champ) { tbCurrentChamp.Text = champ.name; tbType.Text = champ.charType; tbHealth.Text = champ.health; tbAD.Text = champ.adPercent; tbAP.Text = champ.apPercent; tbDifficulty.Text = champ.difficulty; tbIPCost.Text = champ.ipCost; tbRPCost.Text = champ.rpCost; tbReleaseDate.Text = champ.releaseDate; }
private void LoadChampions() { buttonOffline.Enabled = false; buttonOnline.BackColor = Color.SpringGreen; buttonCounters.BackColor = Color.LightGray; buttonSkills.BackColor = Color.LightGray; buttonBuilds.BackColor = Color.LightGray; try { string[] champInfo = System.IO.File.ReadAllLines("Champions.txt"); for (int i = 0; i < champInfo.Length; i++) { Champs newChamp = new Champs(); newChamp.setChampStats(champInfo[i]); champions.Add(newChamp); } } catch { MessageBox.Show("Exception is caught(Load Champions)"); } }