Exemple #1
0
        /// <summary>
        /// 获取消息枚举对应的微信平台接受的消息名称
        /// </summary>
        public static string ObtainMessageType(EnumHelper.MsgType type)
        {
            var mi = type.GetType().GetMember(Enum.GetName(type.GetType(), type)).FirstOrDefault();
            MsgTypeAttribute attr = null;

            if (mi != null)
            {
                attr =
                    mi.GetCustomAttributes(typeof(MsgTypeAttribute), true).FirstOrDefault() as MsgTypeAttribute;
            }
            return(attr == null ? null : ObtainMessageType(attr));
        }
 /// <summary>
 /// 获取指定消息类型的微信平台接受名称
 /// </summary>
 /// <param name="mtype"></param>
 /// <returns></returns>
 public static string ObtainMessageType(MsgTypeAttribute mtype)
 {
     return mtype.TypeName;
 }
Exemple #3
0
 /// <summary>
 /// 获取指定消息类型的微信平台接受名称
 /// </summary>
 /// <param name="mtype"></param>
 /// <returns></returns>
 public static string ObtainMessageType(MsgTypeAttribute mtype)
 {
     return(mtype.TypeName);
 }