Example #1
0
        void client_GenericRequestReceived(Client client, Shared.Messages.GenericRequest msg)
        {
            if (msg.GetType() == typeof(MessagesExtensions.CalcMessageRequest))
            {
                MessagesExtensions.CalcMessageRequest request = msg as MessagesExtensions.CalcMessageRequest;

                MessagesExtensions.CalcMessageResponse response = new MessagesExtensions.CalcMessageResponse(request);
                response.Result = request.A + request.B;
                client.SendGenericResponse(response);
            }
        }
Example #2
0
        private void btnCalc_Click(object sender, EventArgs e)
        {
            MessagesExtensions.CalcMessageRequest request = new MessagesExtensions.CalcMessageRequest();
            request.A = 10;
            request.B = 5;

            client.SendGenericRequest <MessagesExtensions.CalcMessageResponseDelegate>(request, (clientSender, response) =>
            {
                InvokeUI(() =>
                {
                    MessageBox.Show(this, response.Result.ToString(), this.Text);
                });
            });
        }
Example #3
0
 public CalcMessageResponse(CalcMessageRequest request)
     : base(request)
 {
 }