Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Facebook for.NET停止工作并跳过代码_C#_Facebook_Windows Phone 8 - Fatal编程技术网

C# Facebook for.NET停止工作并跳过代码

C# Facebook for.NET停止工作并跳过代码,c#,facebook,windows-phone-8,C#,Facebook,Windows Phone 8,我正在构建一个WindowsPhone8应用程序,我想为用户提供一个Facebook登录。这段代码在两天前就开始工作了,但是一个队友做了一些更改,现在它不再工作了。他不知道自己改变了什么 登录工作正常,但获取用户数据是个问题。 这是我获取用户信息的代码: private async void GraphApi() { FacebookClient fbClient = new FacebookClient(AccessToken); fbClient.G

我正在构建一个WindowsPhone8应用程序,我想为用户提供一个Facebook登录。这段代码在两天前就开始工作了,但是一个队友做了一些更改,现在它不再工作了。他不知道自己改变了什么

登录工作正常,但获取用户数据是个问题。 这是我获取用户信息的代码:

private async void GraphApi()
    {
        FacebookClient fbClient = new FacebookClient(AccessToken);

        fbClient.GetCompleted += (o, e) =>
        {
            if (e.Error != null)
            {
                Dispatcher.BeginInvoke(() =>
                    {
                        IAsyncResult message = Guide.BeginShowMessageBox(AppResources.ApplicationTitle, e.Error.Message, new string[] { AppResources.ButtonOk }, 0, MessageBoxIcon.Alert, null, null);
                        message.AsyncWaitHandle.WaitOne();
                    });

                return;
            }

            IDictionary<string, object> result = (IDictionary<string, object>)e.GetResultData();

            Dispatcher.BeginInvoke(() =>
                {
                    AppSettings["Username"] = (string)result["name"];
                    AppSettings["FirstName"] = (string)result["first_name"];
                    AppSettings["LastName"] = (string)result["last_name"];
                    AppSettings.Save();
                    ProfileName.Text = "Hi " + (string)result["name"];
                    FirstName.Text = "First Name: " + (string)result["first_name"];
                    FirstName.Text = "Last Name: " + (string)result["last_name"];
                });
        };

        await fbClient.GetTaskAsync("me");
    }
private异步void-GraphApi()
{
FacebookClient fbClient=新的FacebookClient(AccessToken);
fbClient.GetCompleted+=(o,e)=>
{
如果(例如错误!=null)
{
Dispatcher.BeginInvoke(()=>
{
IAsyncResult message=Guide.BeginShowMessageBox(AppResources.ApplicationTitle,e.Error.message,新字符串[]{AppResources.ButtonOk},0,MessageBoxIcon.Alert,null,null);
message.AsyncWaitHandle.WaitOne();
});
回来
}
IDictionary result=(IDictionary)e.GetResultData();
Dispatcher.BeginInvoke(()=>
{
AppSettings[“用户名”]=(字符串)结果[“名称”];
AppSettings[“FirstName”]=(字符串)结果[“first_name”];
AppSettings[“LastName”]=(字符串)结果[“last_name”];
AppSettings.Save();
ProfileName.Text=“Hi”+(字符串)结果[“name”];
FirstName.Text=“First Name:”+(字符串)结果[“First_Name”];
FirstName.Text=“Last Name:”+(字符串)结果[“Last_Name”];
});
};
等待fbClient.GetTaskAsync(“我”);
}
使Facebook客户端正常工作,但它会转到以下代码:
fbClient.GetCompleted+=(o,e)
,并跳过此代码,不会出现错误


知道为什么此代码不起作用吗?

正在作为订阅服务器添加到
fbClient.GetCompleted
事件的lambda在您单步执行该代码时不会运行。您正在订阅一个事件,并且代码将在触发该事件时运行。明白了。但是代码仍然不起作用你没有跟踪更改的源代码管理。。。?那太不幸了。