我正在尝试在我的xamarin表单应用程序中使用WCF服务,但我认为我的CompletedEventArgs存在问题,因为我有一个空对象引用错误(在catch中)。 这是我的代码:
private void callWCF()
{
try
{
ServiceRandom req = new ServiceRandom ();
req.InsertUserDetailsCompleted += req_InsertCompleted;
ProspectDetails prospectDetails = new ProspectDetails();
prospectDetails.Nom = "Test insertion appl";
req.InsertUserDetailsAsync(prospectDetails);
Test.Text = "ok";
}
catch (Exception ex)
{
Test.Text = ex.Message;
}
}
private void req_InsertCompleted(object sender, InsertUserDetailsCompletedEventArgs args)
{
string str = args.Result;
throw new NotImplementedException();
}