Example #1
0
        public void CheckResponseXml()
        {
            var rep = new RepNewsMessage();
            var newsItems = new List<NewsItem>
            {
                new NewsItem()
                {
                    Description = "1",
                    PicUrl = "pic1",
                    Title = "t1",
                    Url = "url1"
                },
                new NewsItem()
                {
                    Description = "2",
                    PicUrl = "pic2",
                    Title = "t2",
                    Url = "url2"
                },
            };
            var data = new NewsMsgData();
            data.Items.AddRange(newsItems);
            rep.Data = data;

            var r = rep.ToXmlText();
            Debug.WriteLine(r);
        }
        /// <summary>
        ///     获取图文响应消息
        /// </summary>
        /// <returns></returns>
        public RepNewsMessage GetNewsResponse(IEnumerable <NewsItem> data = null)
        {
            var ret = new RepNewsMessage();

            FillRepMsg(ret);
            if (data != null)
            {
                var msgData = new NewsMsgData();
                msgData.Items.AddRange(data);
                ret.Data = msgData;
            }
            return(ret);
        }
Example #3
0
 /// <summary>
 /// 获取图文响应消息
 /// </summary>
 /// <returns></returns>
 public RepNewsMessage GetNewsResponse(IEnumerable<NewsItem> data = null)
 {
     var ret = new RepNewsMessage();
     FillRepMsg(ret);
     if (data != null)
     {
         var msgData = new NewsMsgData();
         msgData.Items.AddRange(data);
         ret.Data = msgData;
     }
     return ret;
 }