Exemplo n.º 1
0
        private void ApiObj_OnRecvMessage(RTXSAPILib.RTXSAPIMessage Message) //接收到插件发来的消息触发该事件
        {
            try
            {
                txtResult.BeginInvoke(mydelegate, Message); //把信息显示到文本框


                //拆开协议包,把Message.Content赋值给一个SData对象,通过SData对象的方法获取里面字段的值
                RTXSAPILib.RTXSData ReceiverData;            //声明一个SData对象
                ReceiverData     = RootObj.CreateRTXSData(); //创建它
                ReceiverData.XML = Message.Content;          // 把Message.Content赋值给ReceiverData.XML
                string csSend     = ReceiverData.GetString("Sender");
                string csReceiver = ReceiverData.GetString("Receiver");
                string csSendTime = ReceiverData.GetString("SendTime");
                string csType     = ReceiverData.GetString("Type");
                string csContent  = ReceiverData.GetString("Content");

                if (csType == "NOTICE")
                {
                    string csSendNotice = "NOTICE|" + csReceiver + "|0|" + csContent;
                    SendNoticeData(csSendNotice, csReceiver);
                }
                else if (csType == "TALK")
                {
                    //string returnMess = ConnectTuLing(csContent);
                    string returnMess = "敬请期待!";
                    string csSendTalk = "TALK|" + returnMess;
                    SendNoticeData(csSendTalk, csSend);
                }
            }
            catch (COMException xe)
            {
                MessageBox.Show(xe.Message);
            }
        }
Exemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();

            RootObj = new RTXSAPIRootObj();                                                                 //创建根对象
            ApiObj  = RootObj.CreateAPIObj();                                                               //通过根对象创建应用对象
            MsgObj  = ApiObj.CreateMessage();                                                               //通过应用对象创建消息对象
            DataObj = RootObj.CreateRTXSData();                                                             //通过根对象创建SData对象

            ApiObj.OnRecvMessage += new _IRTXSAPIObjEvents_OnRecvMessageEventHandler(ApiObj_OnRecvMessage); //订阅一个事件,当收到客户端插件发过来的消息时触发该事件

            mydelegate = new AddText(AddTextMethod);
        }
Exemplo n.º 3
0
 public void AddTextMethod(RTXSAPILib.RTXSAPIMessage strMessage)
 {
     txtResult.Text   = strMessage.Sender + "发送:" + strMessage.Content + "到:" + strMessage.Receivers;
     txtReceiver.Text = strMessage.Sender;
 }