private void lbDrawLibrary_SelectedIndexChanged(object sender, EventArgs e) { ListBoxItemNameId itm = (ListBoxItemNameId)lbDrawLibrary.SelectedItem; if (itm != null) { pbDrawImage.Image = Helper.GetMagicImage(itm.Id); } }
private void listBoxCardEdition_SelectedIndexChanged(object sender, EventArgs e) { ListBoxItemNameId itm = (ListBoxItemNameId)listBoxCardEdition.SelectedItem; if (itm != null) { ShowImage(itm.Id); } }
private void ShowCard() { Card card = dataSource as Card; textBoxCardName.Text = card.Name; //textBoxCostType.Text = reader.GetString(1); textBoxCardPowtgh.Text = card.PowTgh; ShowHtml(card); textBoxCardType.Text = card.Type; ShowImage(card.Multiverseid.ToString()); // Select all extensions listBoxCardEdition.Items.Clear(); IDbCommand cmdEditon = DataBuider.database.CreateCommand(); cmdEditon.Connection = DataBuider.database.CreateOpenConnection(); IDbDataParameter p1Editon = cmdEditon.CreateParameter(); cmdEditon.Parameters.Add(p1Editon); byte[] bytes = System.Text.Encoding.UTF8.GetBytes(card.Name); p1Editon.Value = System.Text.Encoding.Default.GetString(bytes); cmdEditon.CommandText = "SELECT RARITY, EXTENSION, ID FROM CARD WHERE NAME = ?"; IDataReader readerEditon = cmdEditon.ExecuteReader(); while (readerEditon.Read()) { string cardid = readerEditon.GetInt32(2).ToString(); ListBoxItemNameId item = new ListBoxItemNameId(String.Format("{1} ({0})", readerEditon.GetString(0), readerEditon.GetString(1)), cardid); listBoxCardEdition.DisplayMember = "Name"; listBoxCardEdition.ValueMember = "Id"; listBoxCardEdition.Items.Add(item); if (card.Multiverseid.ToString() == cardid) { listBoxCardEdition.SelectedItem = item; } } }