コード例 #1
0
ファイル: ShortProfile.cs プロジェクト: ununian/TweetStation
        // Used to update asynchronously our display when we get enough information about the tweet detail
        public void UpdateFromUserId(long userId)
        {
            user = User.FromId(userId);
            if (user == null)
            {
                Console.WriteLine("Could nto find user ID={0}", userId);
                return;
            }

            var pic = ImageStore.RequestProfilePicture(-userId, user.PicUrl, this);

            if (pic != ImageStore.DefaultImage)
            {
                profilePic.Image = pic;
            }

            url.AddTarget(delegate { if (UrlTapped != null)
                                     {
                                         UrlTapped();
                                     }
                          }, UIControlEvent.TouchUpInside);
            url.SetTitle(user.Url, UIControlState.Normal);
            url.SetTitle(user.Url, UIControlState.Highlighted);
            SetNeedsDisplay();
        }
コード例 #2
0
        static Uri GetPicUrlFromId(long id, string optionalUrl)
        {
            Uri url;

            if (optionalUrl == null)
            {
                if (!idToUrl.TryGetValue(id, out optionalUrl))
                {
                    var user = User.FromId(id);
                    if (user == null)
                    {
                        return(null);
                    }
                    optionalUrl = user.PicUrl;
                }
            }
            if (id < 0 || Graphics.HighRes)
            {
                int _normalIdx = optionalUrl.LastIndexOf("_normal");
                if (_normalIdx != -1)
                {
                    optionalUrl = optionalUrl.Substring(0, _normalIdx) + "_bigger" + optionalUrl.Substring(_normalIdx + 7);
                }
            }
            if (!Uri.TryCreate(optionalUrl, UriKind.Absolute, out url))
            {
                return(null);
            }

            idToUrl [id] = optionalUrl;
            return(url);
        }
コード例 #3
0
 public FullProfileView(long id) : base(UITableViewStyle.Grouped, null, true)
 {
     user = User.FromId(id);
     if (user == null)
     {
         User.FetchUser(id, u => ProcessUserReturn(u));
     }
     else
     {
         CreateUI();
     }
 }
コード例 #4
0
        // Once we have a full tweet, setup the rest of the view.
        void SetTweet(Tweet fullTweet)
        {
            this.tweet = fullTweet;
            userTimeline.UserReference = User.FromId(tweet.UserId);

            shortProfileView.UpdateFromUserId(tweet.UserId);
            shortProfileView.PictureTapped += delegate { PictureViewer.Load(this, tweet.UserId); };
            shortProfileView.Tapped        += LoadFullProfile;
            shortProfileView.UrlTapped     += delegate { WebViewController.OpenUrl(this, User.FromId(tweet.UserId).Url); };

            if (tweet.InReplyToStatus != 0)
            {
                var in_reply = new ConversationRootElement(Locale.Format("In reply to: {0}", tweet.InReplyToUserName), tweet);

                main.Add(in_reply);
            }
        }
コード例 #5
0
        static string Name(long id)
        {
            var user = User.FromId(id);

            return(user.Screenname);
        }