'How to use Facebook SDK for Windows Phone 7 without handling Navigated event on some WebBrowser?

I'm following some examples from Facebook SDK for .NET specifically the ones for Windows Phone.

I don't want to create a WebBrowser control in my xaml since I saw that in the Library there is already a LoginPage that contains a WebBrowser control.

I don't understand why in their example they create another WebBrowser control to handle the login, and in the code behind they handle the Navigated event.

I would like to have some cleaner handling of Login and retrieving basic info from the logged in user.



Solution 1:[1]

To replace all those lines that you see in the example, you could simply do:

var client = new FacebookSessionClient(appId);
var Session = await client.LoginAsync("basic_info,publish_actions,read_stream,user_photos");

Use the client and the Session you created before to make other calls to Facebook.

Example:

string path = "me?fields=name,picture";
var res = await client.GetTaskAsync(path, new Dictionary<string, object>());

You have a JsonObject with the result.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 csharpwinphonexaml