/// <summary> /// ふわっちAPIオブジェクトを解析してコメントリストを取得する /// </summary> /// <param name="whoWatchApiObj"></param> /// <returns></returns> IList <CommentStruct> parseCommentsFromWhoWatchApiObj(WhoWatchApiObject whoWatchApiObj) { IList <CommentStruct> workCommentList = new List <CommentStruct>(); foreach (Comment comment in whoWatchApiObj.comments) { CommentStruct workComment = new CommentStruct(); workComment.Id = comment.id; workComment.UserThumbUrl = comment.user.icon_url; workComment.UserName = comment.user.name; workComment.TimeStr = comment.posted_at; workComment.Text = comment.message; workComment.IsBouyomiOn = true; // 初期値 //System.Diagnostics.Debug.WriteLine("Id " + workComment.Id); //System.Diagnostics.Debug.WriteLine("UserThumbUrl " + workComment.UserThumbUrl); //System.Diagnostics.Debug.WriteLine("UserName " + workComment.UserName); //System.Diagnostics.Debug.WriteLine("TimeStr " + workComment.TimeStr); //System.Diagnostics.Debug.WriteLine("Text " + workComment.Text); workCommentList.Add(workComment); } return(workCommentList); }
/// <summary> /// ふわっちクライアントからコメントを受信した /// </summary> /// <param name="sender"></param> /// <param name="comment"></param> private void whoWatchClient_OnCommentReceiveEach(WhoWatchClient sender, CommentStruct comment) { // コメントの追加 UiCommentData uiCommentData = new UiCommentData(); uiCommentData.UserThumbUrl = comment.UserThumbUrl; uiCommentData.UserName = comment.UserName; uiCommentData.CommentStr = comment.Text; System.Diagnostics.Debug.WriteLine("UserThumbUrl " + uiCommentData.UserThumbUrl); System.Diagnostics.Debug.WriteLine("UserName " + uiCommentData.UserName); System.Diagnostics.Debug.WriteLine("CommentStr " + uiCommentData.CommentStr); ViewModel viewModel = this.DataContext as ViewModel; ObservableCollection <UiCommentData> uiCommentDataList = viewModel.UiCommentDataCollection; uiCommentDataList.Add(uiCommentData); // コメントログを記録 writeLog(uiCommentData.UserName, uiCommentData.CommentStr); // 棒読みちゃんへ送信 bouyomiChan.Talk(uiCommentData.CommentStr); }