如何解決異常,IsolatedFileStream不允許操作?WP7異常錯誤 - IsolatedStorageFileStream不允許操作
調試完成後,我意識到某行沒有被讀取,而是被跳到了catch部分。我正在閱讀windows phone 7中的照片樣本中的圖像,並將它們上傳到skydrive中。任何人都可以指導我如何解決這個問題儘快? 謝謝。
public BitmapImage fileName { get; set; }
private void GetImages()
{
MediaLibrary mediaLibrary = new MediaLibrary();
var pictures = mediaLibrary.Pictures;
foreach (var picture in pictures)
{
BitmapImage image = new BitmapImage();
image.SetSource(picture.GetImage());
MediaImage mediaImage = new MediaImage();
mediaImage.fileName = image;
UploadFile(mediaImage, picture.Name);
}
}
public void UploadFile(MediaImage image, string filepath)
{
if (skyDriveFolderID != string.Empty)
{
this.client.UploadCompleted += new EventHandler<LiveOperationCompletedEventArgs>(ISFile_UploadCompleted);
infoTextBlock.Text = "Uploading backup...";
dateTextBlock.Text = "";
try
{
using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
// error occurs HERE
IsolatedStorageFileStream readStream = myIsolatedStorage.OpenFile(filepath, FileMode.Open, FileAccess.Read);
readStream.Close();
this.client.UploadAsync(skyDriveFolderID, filepath, true, readStream, null)
}
}
您能否發佈例外數據?堆棧跟蹤和內部異常數據將很有用。 –