/// <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="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState) { // Allow saved page state to override the initial item to display if (pageState != null && pageState.ContainsKey("SelectedItem")) { navigationParameter = pageState["SelectedItem"]; } //if (AppSettings.CurrentUser != null) //{ // currentUser.DataContext = AppSettings.CurrentUser; // currentUser.Visibility = Windows.UI.Xaml.Visibility.Visible; //} // TODO: Create an appropriate data model for your problem domain to replace the sample data var navParamAsArray = navigationParameter as Object[]; Photo item = null; PhotoStream stream = null; // If the details are passed in as the navigation parameter then we use that if (navParamAsArray != null) { item = navParamAsArray[1] as Photo; stream = navParamAsArray[0] as PhotoStream; } if (item != null && stream != null) { // store the stream and the current photo so that we can navigate back to this page currentStream = stream; this.DefaultViewModel["Group"] = stream.StreamPhotos; flipView.SelectedItem = item; currentItem = item; GetPhotoDetails(); } IsInSlideShow = false; playSlideShow.Visibility = Windows.UI.Xaml.Visibility.Visible; stopSlideShow.Visibility = Windows.UI.Xaml.Visibility.Collapsed; }
private void flipView_SelectionChanged_1(object sender, SelectionChangedEventArgs e) { if (AppSettings.HasInternetConnectivity) { commentsList.ItemsSource = null; defaultUserImage.Visibility = Visibility.Visible; currentItem = flipView.SelectedItem as Photo; userImage.Visibility = Visibility.Collapsed; PhotoStream stream = currentStream; if (stream != null && stream.StreamPhotos.HasMoreItems && flipView.SelectedIndex + 5 >= stream.StreamPhotos.Count) { var noAwait = stream.StreamPhotos.LoadMoreItemsAsync(0); } SetCurrentPhotoDetails(null); if (!IsInSlideShow) { // if in slide show mode we do not need to load the details GetPhotoDetails(); } } else { this.Frame.Navigate(typeof(NoInternetPage)); } }