8,735
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Browser;
using System.Xml.Linq;
using System.Windows.Media.Imaging;
using System.IO.IsolatedStorage;
using System.IO;
using System.Text;
using System.Xml;
namespace ATest
{
public class CDownFile
{
public DownEndHander DownEnd;
public CDownFile()
{
}
//下载文件
public void DownloadFile()
{
Uri uri = new Uri(HtmlPage.Document.DocumentUri, "/Test.xml");
WebClient internet = new WebClient();
internet.DownloadStringCompleted += new DownloadStringCompletedEventHandler(internet_DownloadStringCompleted);
internet.DownloadStringAsync(uri);
}
private void internet_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Cancelled || e.Error != null)
{
return;
}
else
{
//加入你的保存代码
//通知主程序下载完成
DownEnd();
}
}
}
}