【发布时间】:2011-06-20 05:37:27
【问题描述】:
我的代码能够将 1 张图像保存到 windows phone 7 中的独立存储中,但是如何更改它以便能够将 1 张以上的图像保存到独立存储中。现在,每当我想保存新图像最新图像将与旧图像重叠,因此任何人都可以帮助我更改代码或使用有效的示例。非常感谢
我的代码:
private void saveButtonClick(object sender, RoutedEventArgs e)
{
try
{
using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
{
if (isf.FileExists("myImage.jpg"))
isf.DeleteFile("myImage.jpg");
using (IsolatedStorageFileStream isfs = isf.CreateFile("myImage.jpg"))
{
var bmp = new WriteableBitmap(myImageElement, myImageElement.RenderTransform);
bmp.SaveJpeg(isfs, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
}
}
}
catch (Exception exc)
{
MessageBox.Show(exc.Message);
}
}
【问题讨论】:
标签: windows-phone-7 isolatedstorage