public void add_buttonClick(object sender, RoutedEventArgs e) { addCardDialog add = new addCardDialog(((BitmapImage)image.Source), rarity.Content.ToString() == "Basic Land"); add.ShowDialog(); if (add.DialogResult == true) { App.Add_Card(card_id, add.DeckName, add.DeckID, add.Amount, add.SideBoard, name.Content.ToString()); } }
private void addButton_Click(object sender, RoutedEventArgs e) { int buttonPressed = int.Parse(((Canvas)sender).Name.Substring(9)); int rowNumber = (currentPage - 1) * 6 + buttonPressed; addCardDialog add; try { bool isBasicLand = table.Rows[rowNumber]["rarity"].ToString().Equals("Basic Land"); if (Deck_id != -1) { add = new addCardDialog((BitmapImage)images[rowNumber % 6].Source, Deck_name, Deck_id, isBasicLand); } else { add = new addCardDialog((BitmapImage)images[rowNumber % 6].Source, isBasicLand); } }catch (InvalidOperationException io) { if (Deck_id != -1) { add = new addCardDialog((BitmapImage)images[rowNumber].Source, false); } else { add = new addCardDialog((BitmapImage)images[rowNumber % 6].Source, false); } } add.ShowDialog(); String card_name = table.Rows[rowNumber]["cardName"].ToString(); if (add.DialogResult == true) { App.Add_Card((int)table.Rows[rowNumber]["id"], add.DeckName, add.DeckID, add.Amount, add.SideBoard, card_name); } }