Ejemplo n.º 1
0
        public void ToXml()
        {
            var message = new TextMessage();
            message.ToUserName = "******";
            message.FromUserName = "******";
            message.CreateTime = DateTime.Now;
            message.Content = "Hello World";

            var xml = message.ToXml();
            Console.WriteLine(xml);
        }
Ejemplo n.º 2
0
        public void TextReplyTest()
        {
            var reply = new TextMessage();
            reply.ToUserName = "******";
            reply.FromUserName = "******";
            //reply.CreateTime = UnixTimeToTime(12345678);
            //reply.MsgType = PostMessageType.Text;
            reply.Content = "你好";

            var xml = reply.ToXml();
            Console.WriteLine(xml);
        }
Ejemplo n.º 3
0
        protected virtual string DefaultProcess(Message msg)
        {
            var reply = new TextMessage();
            reply.ToUserName = msg.FromUserName;
            reply.FromUserName = msg.ToUserName;
            if (msg.MsgType == MessageType.Event)
            {
                reply.Content = string.Format("{0} event is not processed.", ((EventMessage)msg).Event);
            }
            else
            {
                reply.Content = string.Format("{0} message is not processed.", msg.MsgType);
            }

            return reply.ToXml();
        }
Ejemplo n.º 4
0
 protected virtual string ProcessTextMessage(TextMessage msg)
 {
     return DefaultProcess(msg);
 }