Пример #1
0
        public void Execute()
        {
            if (this.RequestMessage != null)
            {
                switch (this.RequestMessage.MsgType)
                {
                    case RequestMsgType.Text:
                        this.ResponseMessage = this.OnTextRequest(this.RequestMessage as TextRequest);
                        return;

                    case RequestMsgType.Image:
                        this.ResponseMessage = this.OnImageRequest(this.RequestMessage as ImageRequest);
                        return;

                    case RequestMsgType.Voice:
                        this.ResponseMessage = this.OnVoiceRequest(this.RequestMessage as VoiceRequest);
                        return;

                    case RequestMsgType.Video:
                        this.ResponseMessage = this.OnVideoRequest(this.RequestMessage as VideoRequest);
                        return;

                    case RequestMsgType.Location:
                        this.ResponseMessage = this.OnLocationRequest(this.RequestMessage as LocationRequest);
                        return;

                    case RequestMsgType.Link:
                        this.ResponseMessage = this.OnLinkRequest(this.RequestMessage as LinkRequest);
                        return;

                    case RequestMsgType.Event:
                        this.ResponseMessage = this.OnEventRequest(this.RequestMessage as EventRequest);
                        return;
                }
                throw new WeixinException("未知的MsgType请求类型");
            }
        }
Пример #2
0
        public AbstractResponse OnEventRequest(EventRequest eventRequest)
        {
            AbstractResponse response = null;
            switch (eventRequest.Event)
            {
                case RequestEventType.Subscribe:
                    return this.OnEvent_SubscribeRequest(eventRequest as SubscribeEventRequest);

                case RequestEventType.UnSubscribe:
                    return this.OnEvent_UnSubscribeRequest(eventRequest as UnSubscribeEventRequest);

                case RequestEventType.Scan:
                    this.ResponseMessage = this.OnEvent_ScanRequest(eventRequest as ScanEventRequest);
                    return response;

                case RequestEventType.Location:
                    return this.OnEvent_LocationRequest(eventRequest as LocationEventRequest);

                case RequestEventType.Click:
                    return this.OnEvent_ClickRequest(eventRequest as ClickEventRequest);
            }
            throw new WeixinException("未知的Event下属请求信息");
        }