private async Task <bool> SaveDeck(StorageFile file) { if (file != null) { DeckPackageProcessor dpp = new DeckPackageProcessor(); return(await dpp.writePackageAsync(file, this.currentDeck)); } else { return(false); } }
private async void loadData(StorageFile file) { //File Picker, feed to processor, wait and show progress DeckPackageProcessor dpp = new DeckPackageProcessor(); progring.IsEnabled = true; progring.IsActive = true; await dpp.readPackageAsync(file); //Once we're done, kill progress, set up controls, and update the display progring.IsEnabled = false; progring.IsActive = false; NextCardBtn.Visibility = Visibility.Visible; PrevCardBtn.Visibility = Visibility.Visible; this.currentDeck = dpp.deck; this.currentDeck.shuffle(); this.DataContext = this.currentDeck; CardStackPanel.DataContext = this.currentDeck.getNextCard(); this.updateVisibleCard(); }
private async void loadDeckFromFile(StorageFile file) { //File Picker, feed to processor, wait and show progress DeckPackageProcessor dpp = new DeckPackageProcessor(); progressRing.IsEnabled = true; progressRing.IsActive = true; if (await dpp.readPackageAsync(file)) { //Once we're done, kill progress, set up controls, and update the display progressRing.IsEnabled = false; progressRing.IsActive = false; this.currentDeck = dpp.deck; this.DataContext = this.currentDeck; } else { Windows.UI.Popups.MessageDialog errorDialog = new Windows.UI.Popups.MessageDialog("There was a problem loading the file you selected. Make sure you've selected a valid QuizCards deck.", "Uh oh! I couldn't load that file."); await errorDialog.ShowAsync(); Frame.Navigate(typeof(LandingPage)); } //CardsGridView.DataContext = this.currentDeck; }
private async Task<bool> SaveDeck(StorageFile file) { if (file != null) { DeckPackageProcessor dpp = new DeckPackageProcessor(); return await dpp.writePackageAsync(file, this.currentDeck); } else { return false; } }