void Current_Resuming(object sender, object e) { AppConstants.DeterminePreferredQuality(); if (videoPlaying) { AppConstants.PlayPreferredQuality(qualities, AppConstants.preferredQuality, streamerObject); } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { AppConstants.DeterminePreferredQuality(); await AppConstants.SetText("Twixel"); if (AppConstants.ActiveUser != null) { if (AppConstants.ActiveUser.authorized) { userButton.Content = AppConstants.ActiveUser.displayName; } else { userButton.Content = "Log In"; } } else { userButton.Content = "Log In"; } topGamesCollection = new ObservableCollection <GameGridViewBinding>(); justFetchedTopGames = new List <Game>(); justFetchedTopGames = await AppConstants.twixel.RetrieveTopGames(10, false); if (justFetchedTopGames != null) { foreach (Game game in justFetchedTopGames) { topGamesCollection.Add(new GameGridViewBinding(game)); } } else { await AppConstants.ShowError("Could not load top games.\nError Code: " + AppConstants.twixel.ErrorString); } featuredStreams = await AppConstants.twixel.RetrieveFeaturedStreams(5, false); if (featuredStreams != null) { if (featuredStreams.Count > 0) { selectedStreamIndex = 0; backStreamButton.IsEnabled = false; featuredGameTextBlock.Text = featuredStreams[selectedStreamIndex].stream.channel.displayName + " playing " + featuredStreams[selectedStreamIndex].stream.game; featuredDescriptionTextBlock.Text = FixDescription(featuredStreams[selectedStreamIndex].text); qualities = await AppConstants.GetQualities(featuredStreams[selectedStreamIndex].stream.channel.name); if (qualities == null) { streamOfflineTextBlock.Visibility = Windows.UI.Xaml.Visibility.Visible; streamIsOffline = true; pausePlayButton.IsEnabled = false; } else { streamerObject.SetTrackTitle(featuredStreams[selectedStreamIndex].stream.channel.displayName, featuredDescriptionTextBlock.Text); streamerObject.SetThumbnail(featuredStreams[selectedStreamIndex].stream.channel.logo.urlString); AppConstants.PlayPreferredQuality(qualities, AppConstants.preferredQuality, streamerObject); videoPlaying = true; } } } else { await AppConstants.ShowError("Could not load featured streams.\nError Code: " + AppConstants.twixel.ErrorString); } }