如何在WeBbrowser中显示我发送的消息? [英] how to show my sent message in WeBbrowser?

查看:55
本文介绍了如何在WeBbrowser中显示我发送的消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个棘手的问题,

当我编程时,我看一些参考,它显示了如何显示我和参与者之间的消息,我可以很容易地找到如何显示我收到的消息:这里是关键程序的一部分

when i am programming ,i take a look at some reference,it shows how to display the messages between me and the participant,i can easily find out how to display the message i receive:here are part of key program

_conversation.add(receivemessage);

 对象[] actionObjectArray = {发件人,_ConversationHistory};

  this.Dispatcher.Invoke(FormActor,新的对象[] {FormActions.SetListContents,History_WebBrowser,actionObjectArray}); // prgram从奥斯丁

 壳体FormActions.SetListContents:   //清晰并更新对话历史web浏览器中的内容

 case FormActions.SetListContents:   //clear and update the contents of the conversation history WebBrowser

             &NBSP ;          // ********* ***

                   &NBSP ;    //铸造动作数据到对象的阵列

                         // ********* ***

                   &NBSP ;   对象[] actionDataArray =(对象[])actionData;

                        //***************************************************
                        //cast action data to array of object.
                        //***************************************************
                        object[] actionDataArray = (object[])actionData;

             &NBSP ;          // ********* ***

                   &NBSP ;    //从对话动态数据阵列中取出对话历史记录的一个列表

                         // ********* ***

                   &NBSP ;   的ArrayList historyArray =(ArrayList的)actionDataArray [1];

                        //***************************************************
                        //Get the arraylist of conversation history out of the action data array
                        //***************************************************
                        ArrayList historyArray = (ArrayList)actionDataArray[1];

                         // ********* ***

                   &NBSP ;    //从动作数据的第一个元素中获取消息发送者的姓名


                         // ********* ***

                   &NBSP ;    string sender =(string)actionDataArray [0];

                        //***************************************************
                        //Get the name of the message sender out of first element of action data
                        //***************************************************
                        string sender = (string)actionDataArray[0];



                         // ********* ***

                   &NBSP ;    //从对话历史数组中获取最新消息文本


              ;           // ********* ***

                   &NBSP ;   串receivedMessage = historyArray [historyArray.Count - 1]的ToString();


                        //***************************************************
                        //Get the newest message text out of the conversation history array
                        //***************************************************
                        string receivedMessage = historyArray[historyArray.Count - 1].ToString();

           &NBSP ;            // ********* ***

                   &NBSP ;    //将操作对象转换为要更新的控件类型


                         // ********* ***

                   &NBSP ;    web浏览器webBrowserToUpdate =(web浏览器)actionObject;

                        //***************************************************
                        //Cast the object of action to the control type to be updated
                        //***************************************************
                        WebBrowser webBrowserToUpdate = (WebBrowser)actionObject;

               &NBSP ;        // ********* ***

                   &NBSP ;    //拼接以前的历史,以新的消息


                         // ********* ***

                        //***************************************************
                        //Concatenate the previous history to the new message
                        //***************************************************

                         _ConversationHistoryHtml.Insert(0,发件人+ receivedMessage);

               &NBSP ;        webBrowserToUpdate.NavigateToString(_ConversationHistoryHtml.ToString());

                        _ConversationHistoryHtml.Insert(0, sender + receivedMessage);
                        webBrowserToUpdate.NavigateToString(_ConversationHistoryHtml.ToString());

                         // ********* ***

                   &NBSP ;    //更新历史数组以用
替换最新的消息                        //消息发送者的名字+最新消息文本

                         // ********* ***

                   &NBSP ;    string recMessage = sender +":" + receivedMessage;

                   &NBSP ;    historyArray.RemoveAt(historyArray.Count - 1);

               &NBSP ;        historyArray.Add(recMessage);

                        //***************************************************
                        //Update the history array to replace the newest message with
                        //the message sender name + the newest message text.
                        //***************************************************
                        string recMessage = sender + ": " + receivedMessage;
                        historyArray.RemoveAt(historyArray.Count - 1);
                        historyArray.Add(recMessage);

它真的有效。

但如何让它显示我收到的消息?

but how to let it show my sent message?

推荐答案

处理((InstantMessageModality)Conversation.Modalities [ModalityType.InstantMessage])。InstantMessageReceived事件。 当您发送消息以及从远程用户收到消息时,会引发此事件。 您收到了您在此活动中发送的消息

Handle the ((InstantMessageModality)Conversation.Modalities[ModalityType.InstantMessage]).InstantMessageReceived event.  This event is raised when you send a message as well as when a message is received from a remote user.  You get the message text that you sent in this event.

John Austin

John Austin


这篇关于如何在WeBbrowser中显示我发送的消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆