日期:2014-05-17 浏览次数:20757 次
private Stream Read(String FileName)
{
Uri mainUri = new Uri(FileName, UriKind.Relative);
WebClient webClient = new WebClient();
webClient.OpenReadCompleted += webClient_OpenReadCompleted;
webClient.OpenReadAsync(mainUri);
}
private void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
Stream mainXapStream = e.Result;
}
ManualResetEvent wait = new ManualResetEvent(false);
private Stream Read(String FileName)
{
Uri mainUri = new Uri(FileName, UriKind.Relative);
wait.reset(); //复位
WebClient webClient = new WebClient();
webClient.OpenReadCompleted += webClient_OpenReadCompleted;
webClient.OpenReadAsync(mainUri);
wait.WaitOne(); //等待完成
}
private void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
Stream mainXapStream = e.Result;
wait.set(); //通知完成
}