/// <summary> /// コメント受信イベントハンドラ /// </summary> /// <param name="sender"></param> /// <param name="comment"></param> private void twcasChatClient_OnCommentReceiveEach(TwcasChatClient 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); // 棒読みちゃんへ送信 if (comment.IsBouyomiOn) { string sendText = comment.Text; string bcTitle = twcasChatClient.BcTitle; if (bcTitle != "") { StringBuilder sendTextSb = new StringBuilder(sendText); sendTextSb.Replace("(" + bcTitle + ")", ""); sendText = sendTextSb.ToString(); } bouyomiChan.Talk(sendText); } }
/// <summary> /// ウィンドウが開かれた /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Loaded(object sender, RoutedEventArgs e) { twcasChatClient = new TwcasChatClient(); twcasChatClient.OnCommentReceiveEach += twcasChatClient_OnCommentReceiveEach; twcasChatClient.OnCommentReceiveDone += twcasChatClient_OnCommentReceiveDone; twcasChatClient.OnMovieIdChanged += twcasChatClient_OnMovieIdChanged; }
/// <summary> /// 動画IDが変更された時のイベントハンドラ /// </summary> /// <param name="sender"></param> private void twcasChatClient_OnMovieIdChanged(TwcasChatClient sender) { doOpen(); }
/// <summary> /// コメント受信完了イベントハンドラ /// </summary> /// <param name="sender"></param> private void twcasChatClient_OnCommentReceiveDone(TwcasChatClient sender) { // データグリッドを自動スクロール dataGridScrollToEnd(); }