【发布时间】:2014-05-11 22:33:40
【问题描述】:
我正在尝试找到一种在 Windows 手机上下载 XML 文件的方法,该文件稍后将被解析以在集合中使用。现在我尝试了与 WPF 应用程序相同的方法:
public void downloadXml()
{
WebClient webClient = new WebClient();
Uri StudentUri = new Uri("url");
webClient.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(fileDownloaded);
webClient.DownloadFileAsync(StudentUri, @"C:/path");
}
将其移至 Windows Phone 时,Web 客户端会丢失 DownloadFileAsync 和 DownloadFileCompleted 功能。那么有没有另一种方法可以做到这一点,我是否必须使用IsolatedStorageFile,如果是这样,如何解析它?
【问题讨论】:
-
当您说要再次解析文件时,为什么不将其下载为字符串?我的意思是 webClient.DownloadStringAsync?
标签: c# xml windows-phone-8 webclient