コード例 #1
0
        // When the REMOTE side receives a quote request over chat (maybe from
        //		LOCAL side subscribing to T42.RFQ.QuoteInquiryStream),
        //		REMOTE side calls T42.RFQ.SendQuoteResponse to send a
        //		response back.
        // Server calls Bridge to send response over chat

        private void SendQuoteResponseMethodHandler(
            IServerMethod method,
            IMethodInvocationContext invocationContext,
            IInstance caller,
            IServerMethodResultBuilder resultBuilder,
            Action <IServerMethodResult> asyncResponseCallback,
            object cookie)
        {
            var args = invocationContext.Arguments.ToDictionary(cv => cv.Name, cv => cv);

            var quantity = args.ContainsKey("quantity") ? (double?)args.SafeGetDouble("quantity") : null;

            bridge_.SendQuoteInquiryResponse(
                new RfqQuoteInquiryResponse(
                    RfqResponseType.Quote,
                    args.TryGetString("responseMessage"),
                    args["requestId"].Value.AsString,
                    args["requestParty"].Value.AsString,
                    args["counterParty"].Value.AsString,
                    args.TryGetString("productName"),
                    null,
                    quantity,
                    args.SafeGetDouble("price")));

            asyncResponseCallback(resultBuilder.Build());
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: tnaidenov/net-examples
        private static IServerMethodResult OnHelloWorldInvoked(
            IServerMethod method,
            IMethodInvocationContext invocationContext,
            IInstance caller,
            IServerMethodResultBuilder resultBuilder,
            object cookie)
        {
            Log($"{caller.ApplicationName} said hello with these arguments: {{{invocationContext.Arguments.AsString()}}}");

            // let's simulate a problem on the implementation side
            if (++invocationIndex_ % 3 == 0)
            {
                throw new Exception("Oops! Something happened!");
            }

            // return empty (void) result.
            return(resultBuilder.Build());
        }
コード例 #3
0
        // When the REMOTE side receives a comment from LOCAL side over chat
        //		(maybe by LOCAL side calling T42.RFQ.SendCommentToCounterParty)
        //	Server sends comment using Bridge, and
        //		on the REMOTE side Server pushes comment to T42.RFQ.RequestPartyCommentStream
        //	When the REMOTE side replies back by calling T42.RFQ.SendCommentToRequestParty
        //		Server calls Bridge to send comment back over the chat and
        //		on the LOCAL side pushes comment to T42.RFQ.CounterPartyCommentStream

        private void SendCommentToRequestPartyMethodHandler(
            IServerMethod method,
            IMethodInvocationContext invocationContext,
            IInstance caller,
            IServerMethodResultBuilder resultBuilder,
            Action <IServerMethodResult> asyncResponseCallback,
            object cookie)
        {
            var args = invocationContext.Arguments.ToDictionary(cv => cv.Name, cv => cv);

            bridge_.SendCommentToRequestParty(
                new RfqComment(
                    args.TryGetString("requestId"),
                    args["requestParty"].Value.AsString,
                    args["counterParty"].Value.AsString,
                    args.TryGetString("productName"),
                    args["comment"].Value.AsString));

            asyncResponseCallback(resultBuilder.Build());
        }