我是 Windows Phone 开发的新手。
我正在使用 for 循环为列表中的每个元素调用 web 服务。我想只有在获得服务结果后才能进入下一个循环。我的循环是这样的:
for (int i = 0; i < count; i++)
{
selectedInfo = lstReorderItems[i];
if (string.IsNullOrEmpty(selectedInfo.ItemCostVariantValueIDs))
{
client.AddItemstoCartCompleted += client_AddItemstoCartCompleted;
client.AddItemstoCartAsync(//params);
}
else
{
client.CheckItemQuantityInCartCompleted += client_CheckItemQuantityInCartCompleted;
client.CheckItemQuantityInCartAsync(//params);
}
}
但循环继续,无需等待结果的到来。那么有人可以帮帮我吗?