예제 #1
0
 private async void Page_Loading(FrameworkElement sender, object args)
 {
     deckBox.ItemsSource = null;
     if (DataService.decks.Count == 0)
     {
         await DataReadWriteService.GetDecks();
     }
     foreach (Deck deck in DataService.decks)
     {
         DeckNames.Add(deck.Name);
     }
     deckBox.ItemsSource = DeckNames;
 }
예제 #2
0
        private async void OpenButton_Click(object sender, RoutedEventArgs e)
        {
            cardBox.ItemsSource = null;
            string selectedDeck = deckBox.SelectedItem?.ToString();

            if (string.IsNullOrWhiteSpace(selectedDeck))
            {
                return;
            }

            var cards = DataService.GetCardsFromDeck(selectedDeck);

            if (cards == null || cards.Count == 0)
            {
                await DataReadWriteService.GetCardsForDeck(selectedDeck);
            }

            CardsList           = cards;
            cardBox.ItemsSource = CardsList;
        }