public void assign_sina(Comment data) { created_at = WeiboStatus.time(data.created_at); id = data.id; text = data.text; user = new UserExt(); if (data.user != null) user.assign_sina(data.user); status = data.status; source = data.source; favorited = data.favorited; truncated = data.truncated; reply_comment = data.reply_comment; mid = data.mid; const string pattern = @"^\s*回复@[\w]+[::]\s*"; text = Regex.Replace(text, pattern, string.Empty); const string pattern2 = @"\s*//@[\w]+[::].*$"; text = Regex.Replace(text, pattern2,"//..."); if (reply_comment != null) references = string.Format("回复 {0} 的评论:{1}",reply_comment.user.screen_name,reply_comment.text); else if (status != null) references = string.Format("回复 {0} 的微博:{1}",status.user.screen_name,status.text); references = Regex.Replace(references, pattern2, string.Empty); }
public void assign_sina_data(StatusWithoutRt data) { /* idstr string 字符串型的微博ID created_at string 创建时间 id int64 微博ID text string 微博信息内容 source string 微博来源 favorited boolean 是否已收藏 truncated boolean 是否被截断 in_reply_to_status_id int64 回复ID in_reply_to_user_id int64 回复人UID in_reply_to_screen_name string 回复人昵称 mid int64 微博MID bmiddle_pic string 中等尺寸图片地址 original_pic string 原始图片地址 thumbnail_pic string 缩略图片地址 reposts_count int 转发数 comments_count int 评论数 annotations array 微博附加注释信息 geo object 地理信息字段 user */ //var jt = ((JToken)data.created_at); created_at = time(data.created_at); id = data.id; text = data.text; favorited = data.favorited; mid = data.mid; bmiddle_pic = data.bmiddle_pic; thumbnail_pic = data.thumbnail_pic; original_pic = data.original_pic; reposts_count = data.reposts_count; comments_count = data.comments_count; user = new UserExt(); user.assign_sina(data.user); geo = data.geo; has_pic = !string.IsNullOrEmpty(bmiddle_pic); reposts_comments_count = comments_count + reposts_count; if(geo != null) { Debug.WriteLine("{0}, {1}:{2}",geo.type,geo.coordinates[0],geo.coordinates[1]); } }
public async void Initialize(IWeiboAccessToken at) { if (IsInDesignMode) return; var t = WeiboClient.users_show_async(uid, at.get()); Timeline = new TimelineHomeViewModel(); Content = Timeline; Timeline.Reload(at); var r = await t; if (!r.Failed()) { var u = new UserExt(); u.assign_sina(r.Value); user = u; FireNotificationMessage("@{0} Wecolme",u.screen_name); } else FireNotificationMessage("{0} - user {1}",r.Error(), r.Reason); // await Task.Delay(2000); }