// When the page is constructed, the client receives all pre-existing cards // from the database. These cards are loaded into a temporary list which are // then read into the ObservableCollection. This intermediary step was made // necessary due to the fact that ObservableCollections cannot be assigned to Lists. private async void LoadFlashcards() { _loadedFlashcards = await FlashDBService.LoadFlashcards(); foreach (var message in _loadedFlashcards) { this.LoadedFlashcards.Add(message); } }
// The DB services are initialized with the selected group's information, tying them to the correct locations // in Cosmos DB. private async void InitializeServices() { chat = new ChatDBService(); flash = new FlashDBService(); // Initializes the ChangeFeedProcessor. await chat.RunChangeFeedHostAsync(); await flash.RunChangeFeedHostAsync(); }
private async void SaveDeck() { // If the user has not added any flashcards to the deck, or failed to assign it a name, it won't be published to the database. if (tempDeck.Count == 0 || DeckName == null) { return; } CardDeck deck = new CardDeck() { ObjType = "Card", Name = DeckName, CreatorAvatar = MainPageViewModel.CurrentGoogleAvatar, CreatorName = MainPageViewModel.CurrentGoogleUsername, Timestamp = DateTime.Now.Ticks.ToString(), DeckContents = tempDeck, Length = tempDeck.Count }; await FlashDBService.UploadFlashCard(deck); await _navigationService.GoBackAsync(); }