我想从 webClient_OpenReadCompleted 获得结果,并且我想在 getMethod 中获得响应。但是在这段代码中,首先 getMehod 有效,然后只有当 getMethod 完成时,webClient_OpenReadCompleted 才有效。如何在 getMethod 中得到结果?
ps 这一切都在 Windows Phone 上
public string apiUri = "https://api.vk.com/method/";
public string response = "";
public void getMethod(string parameters)
{
var webClient = new WebClient();
webClient.OpenReadCompleted += webClient_OpenReadCompleted;
string uri = apiUri + parameters + "&access_token=" + access_token;
webClient.OpenReadAsync(new Uri(uri));
}
void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
XDocument xml = XDocument.Load(e.Result);
response = xml.ToString();
}
public void statusGet(string uid)
{
getMethod("status.get.xml?uid" + uid);
}