1
我是Windows Phone開發新手。停止循環直到在wp7中獲得服務結果
我正在使用for循環爲列表中的每個元素調用webservice。我只想在獲得服務結果後才能進入下一個循環。我的循環是這樣的:
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);
}
}
但循環繼續而不等待結果來。所以任何人都可以幫助我?