Вот что у меня есть проблема
У меня есть следующий код:
//Get All master record
entryE_QuestMaster = new ObservableCollection<E_QuestMaster>();
QuestVM.getExamsMasterbyExamID(eUtility.ConvertInt32(this.txtID.Text), ref entryE_QuestMaster);
//
//Loop to show questions
int iNumber=1;
foreach (var oIn in entryE_QuestMaster)
{
Node subNode = new Node();
subNode.Content = oIn.e_Question;
subNode.Name = "Quest_" + iNumber.ToString().Trim();
subNode.Tag = oIn.e_QID.ToString();
subNode.Icon = "/Images/Number/" + iNumber.ToString().Trim() + ".gif";
iNumber++;
this.tvMainNode.Nodes.Add(subNode);
}
вот асинхронный метод вызова службы wcf
/// <summary>
///
/// </summary>
/// <param name="ID"></param>
public void getExamsMasterbyExamID(int ID, ref ObservableCollection<E_QuestMaster> iCollectionData)
{
ObservableCollection<E_QuestMaster> iCollectionDataResult = iCollectionData;
eLearningDataServiceClient client = new eLearningDataServiceClient();
client.getExamsMasterCompleted+=(s,e)=>
{
iCollectionDataResult = e.Result;
};
client.getExamsMasterAsync(ID);
}
проблема: при запуске системы -> QuestVM.getExamsMasterbyExamID (eUtility.ConvertInt32 (this.txtID.Text), ref entryE_QuestMaster);
он не ждет, пока я получу e.result, просто перейдите к следующей строке кода, которая
цикл foreach.
plssss, помогите кому-нибудь или дайте идею с примером кода, что я должен сделать, чтобы дождаться e.result
Я хотел кое-как подождать, пока я получу e.result
Есть идеи?