public FlashCardCarousel(List <Sign> listOfSigns) { InitializeComponent(); // Randomize the list of signs Random rnd = new Random(); for (int i = 0; i < listOfSigns.Count; i++) { // Get random index for swapping with 'i' int randomIndex = rnd.Next(0, listOfSigns.Count); // Do the swap Sign randomSign = listOfSigns[randomIndex]; listOfSigns[randomIndex] = listOfSigns[i]; listOfSigns[i] = randomSign; } // Create a flash card page for each sign and add it to the carousel int numOfCards = listOfSigns.Count; for (int i = 0; i < numOfCards; i++) { FlashCard flashCardPage = new FlashCard(listOfSigns[i], i + 1, numOfCards); Children.Add(flashCardPage); } }
/// <summary> /// This will pause the video of a card if the user navigates away from /// the flash cards by selecting another tab while a video is playing. /// </summary> protected override void OnDisappearing() { base.OnDisappearing(); FlashCard currentPage = (FlashCard)CurrentPage; // VideoPlayer was having a problem with this function if the back button // had been pressed and we were popping the navigation stack. I believe // The underlying problem is when the video player is trying to assign // itself a new source. So skipping this function call when popping the // navigation stack avoids the issue. if (!backButtonPressed) { currentPage.HideVideoAfterSwipe(); } }