/// <summary>
        /// 调用。
        /// </summary>
        /// <param name="context">处理上下文。</param>
        /// <returns>任务。</returns>
        public override Task Invoke(IHandlerContext context)
        {
            Context = context;

            var requestMessage = context.GetRequestMessage();

            IResponseMessage responseMessage;

            switch (requestMessage.MessageType)
            {
            case RequestMessageType.Event:
                responseMessage = OnEventRequest(requestMessage as EventMessageBase);
                break;

            case RequestMessageType.Image:
                responseMessage = OnImageRequest(requestMessage as RequestMessageImage);
                break;

            case RequestMessageType.Link:
                responseMessage = OnLinkRequest(requestMessage as RequestMessageLink);
                break;

            case RequestMessageType.Location:
                responseMessage = OnLocationRequest(requestMessage as RequestMessageLocation);
                break;

            case RequestMessageType.ShortVideo:
                responseMessage = OnShortVideoRequest(requestMessage as RequestMessageShortVideo);
                break;

            case RequestMessageType.Text:
                responseMessage = OnTextRequest(requestMessage as RequestMessageText);
                break;

            case RequestMessageType.Video:
                responseMessage = OnVideoRequest(requestMessage as RequestMessageVideo);
                break;

            case RequestMessageType.Voice:
                responseMessage = OnVoiceRequest(requestMessage as RequestMessageVoice);
                break;

            default:
                throw new NotSupportedException("不支持的请求消息类型:" + requestMessage.MessageType);
            }

            if (responseMessage != null)
            {
                //基本信息初始化。
                responseMessage.CreateTime   = DateTime.Now;
                responseMessage.FromUserName = requestMessage.ToUserName;
                responseMessage.ToUserName   = requestMessage.FromUserName;
            }

            context.SetResponseMessage(responseMessage);

            return(Next.Invoke(context));
        }
        /// <summary>
        /// 调用。
        /// </summary>
        /// <param name="context">处理上下文。</param>
        /// <returns>任务。</returns>
        public override Task Invoke(IHandlerContext context)
        {
            Context = context;

            var requestMessage = context.GetRequestMessage();

            IResponseMessage responseMessage;
            switch (requestMessage.MessageType)
            {
                case RequestMessageType.Event:
                    responseMessage = OnEventRequest(requestMessage as EventMessageBase);
                    break;

                case RequestMessageType.Image:
                    responseMessage = OnImageRequest(requestMessage as RequestMessageImage);
                    break;

                case RequestMessageType.Link:
                    responseMessage = OnLinkRequest(requestMessage as RequestMessageLink);
                    break;

                case RequestMessageType.Location:
                    responseMessage = OnLocationRequest(requestMessage as RequestMessageLocation);
                    break;

                case RequestMessageType.ShortVideo:
                    responseMessage = OnShortVideoRequest(requestMessage as RequestMessageShortVideo);
                    break;

                case RequestMessageType.Text:
                    responseMessage = OnTextRequest(requestMessage as RequestMessageText);
                    break;

                case RequestMessageType.Video:
                    responseMessage = OnVideoRequest(requestMessage as RequestMessageVideo);
                    break;

                case RequestMessageType.Voice:
                    responseMessage = OnVoiceRequest(requestMessage as RequestMessageVoice);
                    break;

                default:
                    throw new NotSupportedException("不支持的请求消息类型:" + requestMessage.MessageType);
            }

            if (responseMessage != null)
            {
                //基本信息初始化。
                responseMessage.CreateTime = DateTime.Now;
                responseMessage.FromUserName = requestMessage.ToUserName;
                responseMessage.ToUserName = requestMessage.FromUserName;
            }

            context.SetResponseMessage(responseMessage);

            return Next.Invoke(context);
        }