不知道为什么,两天尝试不同的事情我一无所获。继续在 WriteableBitmap 行获取 NRP。你可以看到我已经尝试关闭和刷新(以及两者一起)流。
任何想法,将不胜感激。
IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
XmlSerializer serializer = new XmlSerializer(typeof(MyClass));
XDocument document = XDocument.Load(myIsolatedStorage.OpenFile("Selections.xml", FileMode.Open));
MyClass enclaves = (MyClass)serializer.Deserialize(document.CreateReader());
enclavesList.ItemsSource = enclaves.Collection1;
foreach (XElement xencl in document.Descendants("rest"))
{
WebClient downloader = new WebClient();
String theelement = xencl.Element("couplink").Value;
String nameElement = xencl.Element("coup").Value;
String uriring = theelement.ToString();
Uri uri = new Uri(uriring, UriKind.RelativeOrAbsolute);
downloader.DownloadStringCompleted += new DownloadStringCompletedEventHandler(enclavesDownloaded);
downloader.DownloadStringAsync(uri);
Random random = new Random();
int randomNumber = random.Next(0, 100);
using (IsolatedStorageFile newIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
String tempJPEG = randomNumber.ToString();
IsolatedStorageFileStream fileStream = newIsolatedStorage.CreateFile(tempJPEG);
//fileStream.Close();
//fileStream.Flush();
BitmapImage image = new BitmapImage(new Uri("" + uri ));
image.CreateOptions = BitmapCreateOptions.None;
WriteableBitmap wb = new WriteableBitmap(image);
System.Windows.Media.Imaging.Extensions.SaveJpeg(wb, fileStream, wb.PixelWidth, wb.PixelHeight, 0, 85);
}
}
}
我用谷歌搜索直到我失明,不知道现在该做什么。提前谢谢大家。