使用Xamarin形式的WCF,已完成的args为null

时间:2017-10-19 09:26:09

标签: wcf asynchronous xamarin

我正在尝试在我的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();
    }

0 个答案:

没有答案