Windows phone 8 不允许在隔离存储中移动文件Windows Phone
我直接从msdn skydrive页面抓取了这个。执行下载,并在下载完成时将文件移出共享/传输文件夹。我在后台线程中执行此操作Windows phone 8 不允许在隔离存储中移动文件Windows Phone,windows-phone-8,isolatedstorage,Windows Phone 8,Isolatedstorage,我直接从msdn skydrive页面抓取了这个。执行下载,并在下载完成时将文件移出共享/传输文件夹。我在后台线程中执行此操作 using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication()) { if (isoStore.FileExists(App.ViewModel.DownloadQueue.ElementAt(i).FileName)) { isoStore.
using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
{
if (isoStore.FileExists(App.ViewModel.DownloadQueue.ElementAt(i).FileName))
{
isoStore.DeleteFile(App.ViewModel.DownloadQueue.ElementAt(i).FileName);
}
try
{
isoStore.MoveFile(@"shared/transfers/" + App.ViewModel.DownloadQueue.ElementAt(i).FileName, "test.mp3");
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Message);
}
}
文件就在那里,即使我填充了不存在的垃圾路径,它仍然会抛出iso.Store.MoveFile上不允许的操作
test.mp3在根目录中也不存在。可能您正试图移动其他线程打开或使用的文件?为什么要在根目录中检查App.ViewModel.DownloadQueue.ElementAti.FileName,然后从/shared/transfers/?移动相同的App.ViewModel.DownloadQueue.ElementAti.FileName,因为我也在那里移动它,如果该文件已经存在,则将其删除。我认为该文件可能正在使用中,除非我将源文件名更改为“不退出I get”操作仍然不允许。请在下载后向我们展示代码,以及如何检测下载完成。