Ejemplo n.º 1
0
 /// <summary>
 /// 引发通道服务产生消息事件
 /// </summary>
 /// <param name="messageType">消息类型。</param>
 /// <param name="message">消息内容。</param>
 protected void OnMessage(ChannelServiceMessageTypeOptions messageType, string message)
 {
     if (this.EventMessage != null)
     {
         this.EventMessage(messageType, message);
     }
 }
        /// <summary>
        /// 获取通道服务消息类型的文字说明。
        /// </summary>
        /// <param name="messageType">通道服务消息类型。</param>
        /// <returns>通道服务消息类型的文字说明</returns>
        public static string GetDescription(this ChannelServiceMessageTypeOptions messageType)
        {
            switch (messageType)
            {
            case ChannelServiceMessageTypeOptions.BackInformation:
                return("主站端 - 通知消息");

            case ChannelServiceMessageTypeOptions.BackImportance:
                return("主站端 - 重要消息");

            case ChannelServiceMessageTypeOptions.BackWarning:
                return("主站端 - 警告消息");

            case ChannelServiceMessageTypeOptions.BackException:
                return("主站端 - 错误消息");

            case ChannelServiceMessageTypeOptions.FrontInformation:
                return("设备端 - 通知消息");

            case ChannelServiceMessageTypeOptions.FrontImportance:
                return("设备端 -重要消息");

            case ChannelServiceMessageTypeOptions.FrontWarning:
                return("设备端 -警告消息");

            case ChannelServiceMessageTypeOptions.FrontException:
                return("设备端 -错误消息");

            case ChannelServiceMessageTypeOptions.NormallyImportance:
                return("重要消息");

            case ChannelServiceMessageTypeOptions.NormallyInformation:
                return("消息");

            case ChannelServiceMessageTypeOptions.NormallyWarning:
                return("警告");

            case ChannelServiceMessageTypeOptions.NormallyException:
                return("异常");

            default:
                throw new NotImplementedException("尚未实现该枚举。");
            }
        }