/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="Common.NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { try { progressBar.Visibility = Visibility.Visible; pageTitle.Text = "Videos for " + ((String)e.NavigationParameter); teamName = ((String)e.NavigationParameter); var youtubeVideos = await GetYouTubeData.GetYouTubeVideos(((String)e.NavigationParameter)); if (youtubeVideos != null) { progressBar.Visibility = Visibility.Collapsed; this.DefaultViewModel["Items"] = youtubeVideos; } else { progressBar.Visibility = Visibility.Collapsed; generateErrorHandler("Well, this is embarrassing", "We happened to encounter a minor error while we were working. Apologies!"); } } catch (Exception) { generateErrorHandler("Well, this is embarrassing", "We happened to encounter a minor error while we were working. Apologies!"); } }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="Common.NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { progressBar.Visibility = Visibility.Visible; try { string navparam = "" + e.NavigationParameter; string[] rnavparam = navparam.Split('&'); List <GetYouTubeData> youtubeData = new List <GetYouTubeData>(); List <VideoDetail> videoDetails = new List <VideoDetail>(); youtubeData = await GetYouTubeData.GetYouTubeVideos(rnavparam[1].ToString()); if (youtubeData != null) { progressBar.Visibility = Visibility.Collapsed; foreach (var videoObject in youtubeData) { if (videoObject.videoID == rnavparam[0].ToString()) { pageTitle.Text = videoObject.videoTitle; videoTitle.Text = videoObject.videoTitle; videoDescription.Text = videoObject.videoDesc + "\nPosted by @" + videoObject.channelId; watchVideo.NavigateUri = videoObject.redirectURL; videoImage.Source = new BitmapImage(new Uri("" + videoObject.videoThumbnail480)); break; } else { continue; } } } else { progressBar.Visibility = Visibility.Collapsed; generateErrorHandler("Well, this is embarrassing", "We happened to encounter a minor error while we were working. Apologies!"); } } catch (Exception) { generateErrorHandler("Well, this is embarrassing", "We happened to encounter a minor error while we were working. Apologies!"); } }