I have a class:
public class User
{
public string id, name, email, image;
public User (IFBGraphUser user)
{
id = user.GetId ();
name = user.GetName ();
GetEmail ();
}
private void GetEmail()
{
FBRequestConnection.StartWithGraphPath ("/me", null, "GET", ConnectionReturn);
}
private void ConnectionReturn(FBRequestConnection connection, NSObject result, NSError error)
{
var me = (FBGraphObject)result;
Console.WriteLine("this is a test");
this.email = me["email"].ToString();
}
}
With a async method: StartWithGraphPath
When the constructor is called I want to wait for StartWithGraphPath
to finish before GetEmail
returns.
How Can I accomplish this?
StartWithGraphPath
does not return an IAsyncResult
so I can't use AsyncWaitHandle
.
Edit
When the code is called:
User u = new User(user);
Console.WriteLine("hello");
My application output:
hello
this is a test
Which is what leads me to believe StartWithGraphPath
is being called async. Is there another explanation?
Whats odd is there is also a method called StartWithGraphPathAsync So wouldn't this one Im using be synchronous by deduction? It has a synchronous feel while in debugger but not when simply running the app