Пример #1
0
 /// <summary>
 /// フォームのロードイベントハンドラ
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MainFrm_Load(object sender, EventArgs e)
 {
     ChatClient = new TwcasChatClient();
     ChatClient.OnCommentReceiveEach += ChatClient_OnCommentReceiveEach;
     ChatClient.OnCommentReceiveDone += ChatClient_OnCommentReceiveDone;
     ChatClient.OnMovieIdChanged += ChatClient_OnMovieIdChanged;
 }
Пример #2
0
        /// <summary>
        /// コメント受信イベントハンドラ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="comment"></param>
        private void ChatClient_OnCommentReceiveEach(TwcasChatClient sender, CommentStruct comment)
        {
            // コメントのGUIへのセットと棒読みちゃんへの送信
            // 棒読みちゃんへ送信
            string sendText = comment.Text;
            string bcTitle = ChatClient.BcTitle;
            if (bcTitle != "")
            {
                StringBuilder sendTextSb = new StringBuilder(sendText);
                sendTextSb.Replace("(" + bcTitle + ")", "");
                sendText = sendTextSb.ToString();
            }
            BouyomiChan.Talk(sendText);

            // 音声送信の処理が行われるようにイベント処理する
            Application.DoEvents();

            // ログを記録
            WriteLog(comment.UserName, comment.Text);
        }
Пример #3
0
 /// <summary>
 /// 動画IDが変更された時のイベントハンドラ
 /// </summary>
 /// <param name="sender"></param>
 private void ChatClient_OnMovieIdChanged(TwcasChatClient sender)
 {
     doOpen();
 }
Пример #4
0
        /// <summary>
        /// コメント受信完了イベントハンドラ
        /// </summary>
        /// <param name="sender"></param>
        private void ChatClient_OnCommentReceiveDone(TwcasChatClient sender)
        {
            IList<CommentStruct> commentList = ChatClient.CommentList;
            // GUIへセット
            for (int iLabel = 0, iComment = commentList.Count - 1; iLabel < CommentTextBoxList.Length && iComment >= 0; iLabel++, iComment--)
            {
                CommentStruct tagtComment = commentList[iComment];
                // コメントラベル
                CommentTextBoxList[iLabel].Text = tagtComment.Text;
                CommentTextBoxList[iLabel].Refresh();
                // ユーザーラベル
                UserLabelList[iLabel].Text = tagtComment.UserName;
                UserLabelList[iLabel].Refresh();
                // ユーザーピクチャーボックス
                UserPictBoxList[iLabel].ImageLocation = tagtComment.UserThumbUrl;
                UserPictBoxList[iLabel].Refresh();
            }

            // 放送スクリーン画像の表示
            if (commentList.Count > 0)
            {
                CommentStruct lastCmnt = commentList[commentList.Count - 1];
                if (pictBoxScreenThumb.ImageLocation != lastCmnt.ScreenThumbUrl)
                {
                    pictBoxScreenThumb.ImageLocation = lastCmnt.ScreenThumbUrl;
                    pictBoxScreenThumb.Refresh();
                }
            }
            else
            {
                pictBoxScreenThumb.ImageLocation = "";
                pictBoxScreenThumb.Refresh();
            }
        }