コード例 #1
0
ファイル: RequestHandler.cs プロジェクト: ZhangVic/asp1110git
 public virtual AbstractResponse OnEvent_LocationRequest(LocationEventRequest locationEventRequest)
 {
     return this.DefaultResponse(locationEventRequest);
 }
コード例 #2
0
        public static AbstractRequest GetRequestEntity(XDocument doc)
        {
            RequestMsgType msgType = MsgTypeHelper.GetMsgType(doc);
            AbstractRequest entity = null;
            switch (msgType)
            {
                case RequestMsgType.Text:
                    entity = new TextRequest();
                    break;

                case RequestMsgType.Image:
                    entity = new ImageRequest();
                    break;

                case RequestMsgType.Voice:
                    entity = new VoiceRequest();
                    break;

                case RequestMsgType.Video:
                    entity = new VideoRequest();
                    break;

                case RequestMsgType.Location:
                    entity = new LocationRequest();
                    break;

                case RequestMsgType.Link:
                    entity = new LinkRequest();
                    break;

                case RequestMsgType.Event:
                    switch (EventTypeHelper.GetEventType(doc))
                    {
                        case RequestEventType.Subscribe:
                            entity = new SubscribeEventRequest();
                            goto Label_00C5;

                        case RequestEventType.UnSubscribe:
                            entity = new UnSubscribeEventRequest();
                            goto Label_00C5;

                        case RequestEventType.Scan:
                            entity = new ScanEventRequest();
                            goto Label_00C5;

                        case RequestEventType.Location:
                            entity = new LocationEventRequest();
                            goto Label_00C5;

                        case RequestEventType.Click:
                            entity = new ClickEventRequest();
                            goto Label_00C5;
                    }
                    throw new ArgumentOutOfRangeException();

                default:
                    throw new ArgumentOutOfRangeException();
            }
            Label_00C5:
            EntityHelper.FillEntityWithXml<AbstractRequest>(entity, doc);
            return entity;
        }