private async void CallService1(object sender, EventArgs e) { BasicHttpBinding binding = DataModel.CreateBasicHttp(); //Service1Client client = new Service1Client(binding, new EndpointAddress("http://localhost:59074/Service1.svc")); Service1Client client = new Service1Client(binding, new EndpointAddress("http://192.168.1.96:59075/Service1.svc")); count++; CompositeType parm = new CompositeType(); parm.BoolValue = true; parm.StringValue = "Hello " + count.ToString() + " "; try { CompositeType s = await Task<CompositeType>.Factory.FromAsync((asyncCallback, asyncState) => client.BeginGetDataUsingDataContract(parm, asyncCallback, asyncState), (asyncResult) => client.EndGetDataUsingDataContract(asyncResult), null); MyText.Text = s.StringValue; } catch(Exception ex) { Android.Util.Log.Debug("", ex.ToString()); } }
public CompositeType GetDataUsingDataContract(CompositeType composite) { if (composite == null) { throw new ArgumentNullException("composite"); } if (composite.BoolValue) { composite.StringValue += "Suffix"; } return composite; }