im new at the Facebook C# SDK and im trying to do somthing for windows phone 7 but helf of the function are restricted to silverlight cuz 'Silverlight should only have async calls', im really trying to do this:
// Using IDictionary<string, object> (.Net 3.5, .Net 4.0, WP7)
var client = new FacebookClient();
var me = (IDicationary<string,object>)client.Get("me");
string firstName = (string)me["first_name"];
string lastName = (string)me["last_name"];
string email = (string)me["email"];
as in: http://facebooksdk.codeplex.com/wikipage?title=Code%20Examples&referringTitle=Documentation
but i cant use the get method... ill explain my self better!, i want to save the info, there is a solution out there:
_fbClient.GetCompleted +=
(o, e) =>
{
if (e.Error == null)
{
var result = (IDictionary<string, object>)e.GetResultData();
Dispatcher.BeginInvoke(() => MyData.ItemsSource = result);
}
else
{
MessageBox.Show(e.Error.Message);
}
};
_fbClient.GetAsync("/me");
problem is there is no way to access the MyData.ItemsSource, i need to access each field or ask for each field by it self... any thoughts?
this guy might have some direction: http://blog.prabir.me/post/Facebook-CSharp-SDK-Batch-Requests.aspx
var result = (IDictionary<string, object>)e.GetResultData();
var fname = (string)result["first_name"];
var lname = (string)result["last_name"];
If it is a json object cast it to IDictionary<string,object>, if array cast it to IList<object>. if string cast it to string, if numbers cast it to double and so on.
Straight from the Silverlight sample:
fb.GetCompleted +=
(o, e) =>
{
if (e.Error == null)
{
var result = (IDictionary<string, object>)e.GetResultData();
Dispatcher.BeginInvoke(() => InfoBox.ItemsSource = result);
}
else
{
// TODO: Need to let the user know there was an error
}
};
fb.GetAsync("/me");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.