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); } }
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); }); }); }
public CalcMessageResponse(CalcMessageRequest request) : base(request) { }