我有一個WCF服務,並在我的Silverlight 4應用程序中使用它。我有5個異步調用。我怎麼知道他們已經完成了?我如何知道我的異步方法已在WCF服務中完成?
void service_StochSlowCompleted(object sender, StochSlowCompletedEventArgs e)
{
int count = e.Result.Count/2;
for (int i = 0; i < count; i++)
{
Stoch.Add(e.Result[i]);
}
}
void service_MovingAvgCompleted(object sender, MovingAvgCompletedEventArgs e)
{
MA = e.Result;
}
void service_MomentumCompleted(object sender, MomentumCompletedEventArgs e)
{
PMO = e.Result;
}
void service_RSICompleted(object sender, RSICompletedEventArgs e)
{
RSI = e.Result;
}
void service_OBVCompleted(object sender, OBVCompletedEventArgs e)
{
OBV = e.Result;
}
public void Get_Data(ObservableCollection<double> high, ObservableCollection<double> low, ObservableCollection<double> open, ObservableCollection<double> close, ObservableCollection<double> volume, ObservableCollection<DateTime> date)
{
service.OBVAsync(0, close.Count - 1, close, volume);
service.RSIAsync(0, close.Count - 1, close, 9);
service.StochSlowAsync(0, close.Count - 1, high, low, close, 14, 3, 14);
service.MomentumAsync(0, close.Count - 1, close, 10);
service.MovingAvgAsync(0, close.Count - 1, close, 10);
Close = close;
Date = date;
}
public void Predict()
{
//some code uses the results returned from the serivce
}
外,我有:
Prediction p = new Prediction();
p.Get_Data(high, low, open, close, volume, date);
p.Predict();
所以..請我怎樣才能知道?????
您好Guillaume .. thanx爲您的快速反應,但你可以請你提供我的代碼我怎麼可以做你提到的詭計?謝謝 –
完成後,代碼很髒,但你看到了訣竅。 – Guillaume
啊哈我看到了,非常感謝你的紀堯姆對你的幫助:) –