你好 云帆,
>>在网上看到了好多用WebClient下载文件,但是有一个问题就是,使用WebClient下载完成的文件存到那里了??
一般是下载到IsolatedStorage的,比如说下面这个静态方法:
public static void DownloadFileVerySimle(Uri fileAdress, string fileName)
{
WebClient client = new WebClient();
client.DownloadStringCompleted += (s, ev) =>
{
using (IsolatedStorageFile ISF = IsolatedStorageFile.GetUserStoreForApplication())
using (StreamWriter writeToFile = new StreamWriter(ISF.CreateFile(fileName)))
writeToFile.Write(ev.Result);
};
client.DownloadStringAsync(fileAdress);
}
>>怎么将下载完成的文件移动到自己想要的路径?
可以使用 IsolatedStorageFile.MoveFile 方法移送文件:http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefile.movefile(v=vs.110).aspx
>>或者说是下载文件只能使用HttpWebRequset或者是BackgroundTransfer
Windows Phone 8中的方式有: WebClient, WebRequest
或者 Background File Transfers:
http://msdn.microsoft.com/library/windows/apps/hh202955(v=vs.105).aspx
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.