private async void listItemBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { getListItemName listItemName = (sender as ListBox).SelectedItem as getListItemName; if (listItemName != null) { string itemName = listItemName.name; if (inDecklist) { RootObject foundCard = await FindCards.GetCardData(itemName); string image = String.Format(foundCard.editions[0].image_url); showCardImg.Source = new BitmapImage(new Uri(image, UriKind.Absolute)); } else { VisualStateManager.GoToState(this, "cardsState", false); //change app to cardsState currentDeckFile = itemName; await fileActions("openFile", currentDeckFile, cardNamesList); } } }
private async void findCardBtn_Click(object sender, RoutedEventArgs e) { httpCardName = formatUserInput(findCardTxtBx.Text); findCardTxtBx.Text = String.Empty; try { findCardTxtBx.PlaceholderText = "Enter Card name"; RootObject foundCard = await FindCards.GetCardData(httpCardName); string image = String.Format(foundCard.editions[0].image_url); showCardImg.Source = new BitmapImage(new Uri(image, UriKind.Absolute)); } catch (Exception ex) { findCardTxtBx.PlaceholderText = "Card not found!"; } }