Exemple #1
0
        public UserViewModel(User user)
        {
            Model = user;

            ProfileImageUrlHttps     = user.ProfileImageUrlHttps;
            ProfileImageUrlHttpsOrig = user.ProfileImageUrlHttps?.Replace("_normal", "");
            ProfileImageUrlHttpsMini = user.ProfileImageUrlHttps?.Replace("_normal", "_mini");
            ProfileImageUrlHttpsBig  = user.ProfileImageUrlHttps?.Replace("_normal", "_bigger");
            if (!string.IsNullOrEmpty(ProfileImageUrlHttpsOrig))
            {
                BigProfileImageUrl = MediaProxyServer.BuildUrl(ProfileImageUrlHttpsOrig);
            }

            ScreenName = Constants.Twitter.Mention + Model.GetScreenName();
            Url        = Uri.IsWellFormedUriString(user.Url, UriKind.Absolute) ? new Uri(user.Url) : user.GetUserUrl();
            DisplayUrl = Url.AbsoluteUri;
        }
        public StatusMediaViewModel(MediaEntity entity, ulong userId = 0)
        {
            Entity = entity;
            switch (entity.Type)
            {
            case "animated_gif":
            case "video":
                Url        = MediaProxyServer.BuildUrl(entity.VideoInfo.Variants[0].Url, userId);
                DisplayUrl = new Uri(entity.VideoInfo.Variants[0].Url);
                Type       = MediaType.Animated;
                break;

            default:
                Url        = MediaProxyServer.BuildUrl(entity.MediaUrl, userId);
                DisplayUrl = new Uri(entity.ExpandedUrl);
                Type       = MediaType.Image;
                break;
            }
        }
 public StatusMediaViewModel(Uri url, Uri displayUrl = null)
 {
     Url        = MediaProxyServer.BuildUrl(url);
     DisplayUrl = displayUrl ?? url;
     Type       = MediaType.Image;
 }