示例#1
0
        protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
        {
            if (log.IsDebugEnabled)
            {
                log.DebugFormat("OnOperationRequest. Code={0}", operationRequest.OperationCode);
            }

            switch (operationRequest.OperationCode)
            {
            case (byte)MyOperationCodes.EchoOperation:
            {
                // The echo operation one is handled immediately because it does not require the client to join a game.
                var myEchoRequest = new MyEchoRequest(this.Protocol, operationRequest);
                if (this.ValidateOperation(myEchoRequest, sendParameters) == false)
                {
                    return;
                }

                var myEchoResponse = new MyEchoResponse {
                    Response = myEchoRequest.Text
                };
                var operationResponse = new OperationResponse(operationRequest.OperationCode, myEchoResponse);
                this.SendOperationResponse(operationResponse, sendParameters);
                break;
            }

            default:
            {
                // for this example all other operations will handled by the base class
                base.OnOperationRequest(operationRequest, sendParameters);
                return;
            }
            }
        }
示例#2
0
        protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
        {
            if (log.IsDebugEnabled)
            {
                log.DebugFormat("OnOperationRequest. Code={0}", operationRequest.OperationCode);
            }

            switch (operationRequest.OperationCode)
            {
                case (byte)MyOperationCodes.EchoOperation:
                    {
                        // The echo operation one is handled immediately because it does not require the client to join a game.
                        var myEchoRequest = new MyEchoRequest(this.Protocol, operationRequest);
                        if (this.ValidateOperation(myEchoRequest, sendParameters) == false)
                        {
                            return;
                        }

                        var myEchoResponse = new MyEchoResponse { Response = myEchoRequest.Text };
                        var operationResponse = new OperationResponse(operationRequest.OperationCode, myEchoResponse);
                        this.SendOperationResponse(operationResponse, sendParameters);
                        break;
                    }

                default:
                    {
                        // for this example all other operations will handled by the base class
                        base.OnOperationRequest(operationRequest, sendParameters);
                        return;
                    }
            }
        }
示例#3
0
    public string MyEcho(string strInput)
    {
        MyEchoRequest inValue = new MyEchoRequest();

        inValue.strInput = strInput;
        MyEchoResponse retVal = ((IMyCalls)(this)).MyEcho(inValue);

        return(retVal.MyEchoResult);
    }
示例#4
0
 MyEchoResponse IMyCalls.MyEcho(MyEchoRequest request)
 {
     return(base.Channel.MyEcho(request));
 }