Esempio n. 1
0
        void SetImage()
        {
            if (Tweet.Entities == null)
            {
                return;
            }

            if (Tweet.Entities.Media != null && Tweet.Entities.Media.Any())
            {
                var photo = Tweet.Entities.Media.First();
                Images.Add(photo.MediaUrl);
            }


            if (Tweet.Entities.Urls != null && Tweet.Entities.Urls.Any())
            {
                var parser = new MediaLinkParser();
                foreach (var i in Tweet.Entities.Urls)
                {
                    if (i.EntityType == TwitterEntityType.Url)
                    {
                        var url = i as TwitterUrl;
                        if (url != null && !string.IsNullOrWhiteSpace(url.ExpandedValue))
                        {
                            string photoUrl;
                            if (parser.TryGetMediaUrl(url.ExpandedValue, out photoUrl))
                            {
                                Images.Add(photoUrl);
                            }
                        }
                    }
                }
            }

            if (Images.Count > 0)
            {
                HasImage  = true;
                IsLoading = true;
                BarText   = Localization.Resources.DownloadingImage;
            }
        }