void MetrocamService_SearchUsersCompleted(object sender, MobileClientLibrary.RequestCompletedEventArgs e)
        {
            App.MetrocamService.SearchUsersCompleted -= MetrocamService_SearchUsersCompleted;
            GlobalLoading.Instance.IsLoading = false;
            GlobalLoading.Instance.Text = "";
            SearchResults.Clear();

            results = e.Data as List<UserInfo>;
            foreach (UserInfo u in results)
            {
                SearchResults.Add(u);
            }

            if (results.Count == 0)
            {
                noresults.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                searchResults.ItemsSource = SearchResults;
                searchResults.Visibility = System.Windows.Visibility.Visible;
            }
        }
        void MetrocamService_FetchPopularNewsFeedCompleted(object sender, MobileClientLibrary.RequestCompletedEventArgs e)
        {
            endPop = DateTime.Now;
            GlobalLoading.Instance.Text = "";
            App.MetrocamService.FetchPopularNewsFeedCompleted -= MetrocamService_FetchPopularNewsFeedCompleted;
            App.PopularPictures.Clear();

            int count = 0;
            foreach (PictureInfo p in e.Data as List<PictureInfo>)
            {
                if (count == 24)
                    break;

                // changes to local time
                p.FriendlyCreatedDate = TimeZoneInfo.ConvertTime(p.FriendlyCreatedDate, TimeZoneInfo.Local);

                if (!isRefreshingPopular)
                {
                    if (App.PopularPictures.Count < 3)
                    {
                        App.PopularPictures.Add(p);
                    }
                    else
                    {
                        App.ContinuedPopularPictures.Add(p);
                    }
                }
                else
                {
                    App.PopularPictures.Add(p);
                }

                count++;
            }

            isRefreshingPopular = false;

            if (GlobalLoading.Instance.IsLoading)
                GlobalLoading.Instance.IsLoading = false;
        }
        void MetrocamService_FetchUserPicturesCompleted(object sender, MobileClientLibrary.RequestCompletedEventArgs e)
        {
            App.MetrocamService.FetchUserPicturesCompleted -= MetrocamService_FetchUserPicturesCompleted;

            userPictures = e.Data as List<PictureInfo>;
            userPictures.Reverse();
            App.UserPictures.Clear();

            // If user is still on profilePivot, set loading to false since we have loaded PictureLabel
            if (GlobalLoading.Instance.IsLoading)
                GlobalLoading.Instance.IsLoading = false;

            if (UserPictures.ItemsSource == null)
            {
                this.UserPictures.DataContext = App.UserPictures;
            }

            foreach (PictureInfo p in userPictures)
            {
                p.FriendlyCreatedDate = TimeZoneInfo.ConvertTime(p.FriendlyCreatedDate, TimeZoneInfo.Local);

                if (App.UserPictures.Count < 24)
                {
                    App.UserPictures.Add(p);
                }
                else
                {
                    // Put the rest into ContinuedUserPictures collection
                    ContinuedUserPictures.Add(p);
                }
            }
        }
        void MetrocamService_FetchUserCompleted(object sender, MobileClientLibrary.RequestCompletedEventArgs e)
        {
            App.MetrocamService.FetchUserCompleted -= MetrocamService_FetchUserCompleted;
            userInfo = e.Data as UserInfo;

            if (userInfo.ID.Equals(App.MetrocamService.CurrentUser.ID))
            {
                ConstructAppBar(true, true);
            }
            else
            {
                if (userInfo.IsFollowing == false)
                {
                    FollowingStatus.Text = "You are not following " + userInfo.Username + ".";
                    ConstructAppBar(false, false);
                }
                else
                {
                    FollowingStatus.Text = "You are following " + userInfo.Username + ".";
                    ConstructAppBar(false, true);
                }
            }

            // pivot name
            this.PivotRoot.Title = this.userInfo.Username;

            // profile pic
            profilePicture.Source = (new BitmapImage(new Uri(userInfo.ProfilePicture.MediumURL, UriKind.RelativeOrAbsolute)));

            // name
            fullName.Text = userInfo.Name;

            // location
            if (userInfo.Location == null)
                hometown.Text = SignUpPage.DefaultLocation;
            else
                hometown.Text = userInfo.Location;

            // username
            usernameTextBlock.Text = userInfo.Username;

            // bio
            if (userInfo.Biography == null)
                biographyTextBlock.Text = SignUpPage.DefaultBiography;
            else
                biographyTextBlock.Text = userInfo.Biography;

            PictureLabel.Text = userInfo.Pictures.ToString();
            FollowingLabel.Text = userInfo.Following.ToString();
            FollowerLabel.Text = userInfo.Followers.ToString();

            App.MetrocamService.FetchUserPicturesCompleted += new MobileClientLibrary.RequestCompletedEventHandler(MetrocamService_FetchUserPicturesCompleted);
            GlobalLoading.Instance.IsLoading = true;
            App.MetrocamService.FetchUserPictures(userInfo.ID);
        }
        void MetrocamService_DeleteRelationshipByUserIDCompleted(object sender, MobileClientLibrary.RequestCompletedEventArgs e)
        {
            App.MetrocamService.DeleteRelationshipByUserIDCompleted -= MetrocamService_DeleteRelationshipByUserIDCompleted;

            doingWork = false;
            AppBarSet = false;
            FollowingStatus.Text = "You are not following " + userInfo.Username + ".";
            ConstructAppBar(false, false);
        }