您好,我使用多次不同參數值調用Async方法,在完成的事件中給出相同的結果。在Silverlight中多次調用異步方法問題
client.ListAllLookupValuesByTypeCompleted += client_ListAllAddressFormatCompleted;
client.ListAllLookupValuesByTypeAsync("AddressFormat");
client.ListAllLookupValuesByTypeCompleted += client_ListAllPhoneFormatCompleted;
client.ListAllLookupValuesByTypeAsync("PhoneFormat");
void client_ListAllAddressFormatCompleted(object sender, ListAllLookupValuesByTypeCompletedEventArgs e)
{
cmbAddressFormat.ItemsSource = e.Result;
}
void client_ListAllPhoneFormatCompleted(object sender, ListAllLookupValuesByTypeCompletedEventArgs e)
{
cmbPhonePrintFormat.ItemsSource = e.Result;
}
請幫幫我。 謝謝。
當我遇到同樣的問題時,我擴展了服務客戶端類(它是一個部分類)並添加了我自己的方法,它們使用內部的BeginSomeOperation和EndSomeOperation方法。每次都不可能創建新的服務實例,因爲我需要使用會話。 – vorrtex 2011-03-16 08:38:46
當有人回答您的問題時,請點擊該答案旁邊的綠色勾號。謝謝。 – jumbo 2011-03-18 23:11:41