protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (UsingGlobal.meRoot.access_token == null && Me.TokenInFileUserDefault == "")
            {
                //bdLikes.Visibility = Visibility.Collapsed;
                //bdCollect.Visibility = Visibility.Collapsed;
                bdLikes.Visibility   = Visibility.Visible;
                bdCollect.Visibility = Visibility.Visible;
            }
            else
            {
                bdLikes.Visibility   = Visibility.Visible;
                bdCollect.Visibility = Visibility.Visible;
            }

            item = (RootObject)e.Parameter;

            BitmapImage bitmapImage = new BitmapImage();

            bitmapImage.UriSource = new Uri(item.user.profile_image.large);
            imbAuthor.ImageSource = bitmapImage;

            tblAuthorName.Text = item.user.name;
            tblUserName.Text   = item.user.username;
            tblLike.Text       = item.likes.ToString();
            if (item.liked_by_user == true)
            {
                bdLikes.Background = new SolidColorBrush(Colors.Pink);
            }

            BitmapImage bitmapImageShow = new BitmapImage();

            bitmapImageShow.UriSource = new Uri(item.urls.regular);
            imgShow.Source            = bitmapImageShow;

            HttpClient httpClient = new HttpClient();
            string     requestUri = RequestParameters.defaulUri + item.id + "/?client_id=" + RequestParameters.client_id;

            try
            {
                string reponseData = await httpClient.GetStringAsync(requestUri);

                rootObject = JsonConvert.DeserializeObject <DetailPhotoModel.RootObject>(reponseData, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                });
            }
            catch (Exception)
            {
                Noreult.Visibility   = Visibility.Visible;
                TrueReult.Visibility = Visibility.Collapsed;
            }

            await Task.Delay(500);

            griNewLoading.Visibility = Visibility.Collapsed;
        }
Пример #2
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            RootObject item = (RootObject)e.Parameter;

            BitmapImage bitmapImage = new BitmapImage();

            bitmapImage.UriSource = new Uri(item.user.profile_image.medium);
            imbAuthor.ImageSource = bitmapImage;

            tblAuthorName.Text = item.user.name;
            tblUserName.Text   = item.user.username;
            tblLike.Text       = item.likes.ToString();

            BitmapImage bitmapImageShow = new BitmapImage();

            bitmapImageShow.UriSource = new Uri(item.urls.regular);
            imgShow.Source            = bitmapImageShow;

            HttpClient httpClient  = new HttpClient();
            string     requestUri  = RequestParameters.defaulUri + item.id + "/?client_id=" + RequestParameters.client_id;
            string     reponseData = await httpClient.GetStringAsync(requestUri);

            DetailPhotoModel.RootObject rootObject = JsonConvert.DeserializeObject <DetailPhotoModel.RootObject>(reponseData);
        }