public UserInfo(TwitterDataModel.User user) { this.Id = user.Id; this.Name = WebUtility.HtmlDecode(user.Name).Trim(); this.ScreenName = user.ScreenName; this.Location = WebUtility.HtmlDecode(user.Location); this.Description = WebUtility.HtmlDecode(user.Description); try { this.ImageUrl = new Uri(user.ProfileImageUrlHttps); } catch (Exception) { this.ImageUrl = null; } this.Url = user.Url; this.Protect = user.Protected; this.FriendsCount = user.FriendsCount; this.FollowersCount = user.FollowersCount; this.CreatedAt = MyCommon.DateTimeParse(user.CreatedAt); this.StatusesCount = user.StatusesCount; this.Verified = user.Verified; if (user.Status != null) { this.RecentPost = user.Status.Text; this.PostCreatedAt = MyCommon.DateTimeParse(user.Status.CreatedAt); this.PostSource = user.Status.Source; } }
private void UpdateProfileImage_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { string res = ""; TwitterDataModel.User user = null; if (e.Result == null) { return; } // アイコンを取得してみる // が、古いアイコンのユーザーデータが返ってくるため反映/判断できない try { res = MyOwner.TwitterInstance.GetUserInfo(_info.ScreenName, ref user); Image img = (new HttpVarious()).GetImage(user.ProfileImageUrl); if (img != null) { UserPicture.Image = img; } } catch (Exception) { } }
private bool AnalizeUserInfo(TwitterDataModel.User user) { if (user == null) { return(false); } try { _info.Id = user.Id; _info.Name = user.Name.Trim(); _info.ScreenName = user.ScreenName; _info.Location = user.Location; _info.Description = user.Description; _info.ImageUrl = new Uri(user.ProfileImageUrl); _info.Url = user.Url; _info.Protect = user.Protected; _info.FriendsCount = user.FriendsCount; _info.FollowersCount = user.FollowersCount; _info.FavoriteCount = user.FavouritesCount; _info.CreatedAt = MyCommon.DateTimeParse(user.CreatedAt); _info.StatusesCount = user.StatusesCount; _info.Verified = user.Verified; _info.ListedCount = user.ListedCount; try { _info.RecentPost = user.Status.Text; _info.PostCreatedAt = MyCommon.DateTimeParse(user.Status.CreatedAt); _info.PostSource = user.Status.Source; if (!_info.PostSource.Contains("</a>")) { _info.PostSource += "</a>"; } } catch (Exception) { _info.RecentPost = null; _info.PostCreatedAt = new DateTime(); _info.PostSource = null; } } catch (Exception) { return(false); } return(true); }