如何在Windows Phone中保存和检索来自隔离存储的图像?
问题描述:
我在windows phone中使用隔离存储。我想保存图像并从隔离存储中检索图像。我尝试了一些但是我无法保存图像
I am Using Isolated Storage in windows phone.I want save image and retrieve image from isolated storage. I tried some come but i can't save image
private void Watchlist_Click_1(object sender, RoutedEventArgs e)
{
XmlWriterSettings x_W_Settings = new XmlWriterSettings();
x_W_Settings.Indent = true;
using (IsolatedStorageFile ISF = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream stream = ISF.OpenFile("People.xml", FileMode.Create))
{
// var imageSource = PictureDecoder.DecodeJpeg(stream);
// BitmapImage bi = new BitmapImage();
XmlSerializer serializer = new XmlSerializer(typeof(List<StoreProduct>));
using (XmlWriter xmlWriter = XmlWriter.Create(stream, x_W_Settings))
{
//bi.SetSource(imageStream);
serializer.Serialize(xmlWriter, GeneratePersonData());
MessageBox.Show("Data Save!!!!");
}
}
}
this.NavigationService.Navigate(new Uri(string.Format("/LoginPage.xaml?selectedItem="), UriKind.Relative));
}
private List<StoreProduct> GeneratePersonData()
{
List<StoreProduct> l1 = new List<StoreProduct>();
StoreProduct p = new StoreProduct();
p.Title = App.CurrentArticle.Titles;
p.ProductName = App.ProductList.ProductName;
p.Price = App.ProductList.Price;
p.Description = App.ProductList.Shortdescription;
// p.ProductImage = App.ProductLists.ProductImage;
l1.Add(p);
return l1;
}