Beispiel #1
0
        /// <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
            {
                pageTitle.Text         = "Images for " + (string)e.NavigationParameter;
                teamName               = (string)e.NavigationParameter;
                progressBar.Visibility = Visibility.Visible;
                var sampleDataGroups = await GetInstagramData.GetInstagramImages((string)e.NavigationParameter);

                if (sampleDataGroups != null)
                {
                    progressBar.Visibility         = Visibility.Collapsed;
                    this.DefaultViewModel["Items"] = sampleDataGroups;
                }
                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!");
            }
        }
Beispiel #2
0
        /// <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;
                string   navparam  = "" + e.NavigationParameter;
                string[] rnavparam = navparam.Split('&');
                List <GetInstagramData> imageData = new List <GetInstagramData>();
                imageData = await GetInstagramData.GetInstagramImages(rnavparam[1].ToString());

                if (imageData != null)
                {
                    progressBar.Visibility = Visibility.Collapsed;
                    foreach (var imageObject in imageData)
                    {
                        if (imageObject.imageId == rnavparam[0].ToString())
                        {
                            pageTitle.Text          = "Images for " + rnavparam[1].ToString();
                            imageCaption.Text       = imageObject.imageCaption;
                            imageMeta.Text          = "Posted by @" + imageObject.imageUsername + " and liked by " + imageObject.imageLikeCount;
                            imageThumbnail.Source   = new BitmapImage(new Uri("" + imageObject.image320));
                            imageWebUrl.NavigateUri = imageObject.imageWebUrl;
                            break;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                else
                {
                    progressBar.Visibility = Visibility.Collapsed;
                }
            }
            catch (Exception)
            {
                generateErrorHandler("Well, this is embarrassing", "We happened to encounter a minor error while we were working. Apologies!");
            }
        }