public static void InvokeService() { MathProxy.MathClient proxy = new MathClient(); Console.WriteLine("now watch the service method invocation "); Console.WriteLine("Sum ={0}", proxy.Addition(2, 7)); Console.WriteLine("Sum={0}", proxy.Multiply(2, 7)); }
private void btnMultiply_Click(object sender, EventArgs e) { txtResult.Text = ""; txtStatus.Text = ""; try { _client = new MathClient(); if (radInt.Checked) { int x = Convert.ToInt32(txtX.Text); int y = Convert.ToInt32(txtY.Text); int result = _client.Multiply(x, y); txtResult.Text = result.ToString(); } else if (radDouble.Checked) { double x = Convert.ToDouble(txtX.Text); double y = Convert.ToDouble(txtY.Text); double result = _client.MultiplyDouble(x, y); txtResult.Text = result.ToString(); } } catch (FaultException <OverflowException> ex) { txtStatus.Text = ex.GetType().ToString(); MessageBox.Show(ex.Message, "OverflowException"); } catch (Exception ex) { txtStatus.Text = ex.GetType().ToString(); MessageBox.Show(ex.Message, "Exception"); } }