Ejemplo n.º 1
0
        /// <summary>
        /// 处理关注事件
        /// </summary>
        /// <param name="inMessage"></param>
        /// <returns></returns>
        private OutMessage HandleSubscribe(InMessageEvent inMessage)
        {
            var outMessageNews = new OutMessageNews
            {
                CreateTime   = inMessage.CreateTime,
                FromUserName = inMessage.ToUserName,
                ToUserName   = inMessage.FromUserName,
                ArticleCount = 2,
                Articles     = new item[] {
                    new  item()
                    {
                        Description = "",
                        PicUrl      = "http://e.hiphotos.baidu.com/image/pic/item/1c950a7b02087bf49661186dffd3572c10dfcfa1.jpg",
                        Title       = "代码改变世界",
                        Url         = "http://www.cnblogs.com/hepeng"
                    },
                    new  item()
                    {
                        Description = "代码的质量取决于项目管理者对于技术和代码的把握能力,如果摊上不懂技术的项目管理者以及对于代码质量没有要求的研发人员,可能最终输出的代码,将成为一团乱麻,只能在一个个项目中无穷次的积累,直到遇到一群优秀的开发人员费劲心力把体系重构为止",
                        PicUrl      = "http://www.wolfcode.cn//data/upload/20181122/5bf6676158412.jpg",
                        Title       = "感谢关注",
                        Url         = "http://www.cnblogs.com/hepeng"
                    }
                }
            };

            return(outMessageNews);
        }
Ejemplo n.º 2
0
 internal static void OnReceive <T>(T message, int channel, int bytes) where T : IMessageBase
 {
     if (InMessageEvent != null)
     {
         MessageInfo inMessage = new MessageInfo(message, channel, bytes, 1);
         InMessageEvent?.Invoke(inMessage);
     }
 }
Ejemplo n.º 3
0
 internal static void OnReceive <T>(T message, int channel, int bytes)
 {
     if (InMessageEvent != null)
     {
         var inMessage = new MessageInfo(message, channel, bytes, 1);
         InMessageEvent.Invoke(inMessage);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 处理二维码扫描到url跳转事件 返回消息不会起作用!
        /// </summary>
        /// <param name="inMessage"></param>
        /// <returns></returns>
        private OutMessage HandleScancodePush(InMessageEvent inMessage)
        {
            var outMessage = new OutMessageText
            {
                CreateTime   = inMessage.CreateTime,
                FromUserName = inMessage.ToUserName,
                ToUserName   = inMessage.FromUserName,
                Content      = $"HandleScancodePush{inMessage.EventKey}扫描结果:ScanCodeInfo:{inMessage.ScanCodeInfo},ScanType:{inMessage.ScanType},ScanResult:{inMessage.ScanResult}"
            };

            return(outMessage);//可以返回空
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 处理菜单跳转事件 返回消息不会起作用!
        /// </summary>
        /// <param name="inMessage"></param>
        /// <returns></returns>
        private OutMessage HandleView(InMessageEvent inMessage)
        {
            var outMessage = new OutMessageText
            {
                CreateTime   = inMessage.CreateTime,
                FromUserName = inMessage.ToUserName,
                ToUserName   = inMessage.FromUserName,
                Content      = $"{inMessage.EventKey}您跳转的url是{inMessage.EventKey}"
            };

            return(outMessage);//可以返回空
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 处理菜单点击事件
        /// </summary>
        /// <param name="inMessage"></param>
        /// <returns></returns>
        private OutMessage HandleClick(InMessageEvent inMessage)
        {
            var outMessage = new OutMessageText
            {
                CreateTime   = inMessage.CreateTime,
                FromUserName = inMessage.ToUserName,
                ToUserName   = inMessage.FromUserName,
                Content      = $"您点击的按钮是{inMessage.EventKey},暂未设置返回信息"
            };

            if (inMessage.EventKey.ToLower() == "music")
            {
                outMessage.Content = "http://music.taihe.com/";
            }


            return(outMessage);
        }