Używam tego kodu do przechowywania obrazu w pamięci izolatu w momencie zakończenia działania kamery.Jak załadować obraz z odizolowanej pamięci do sterowania obrazem w telefonie z systemem Windows?
void camera_Completed(object sender, PhotoResult e)
{
BitmapImage objImage = new BitmapImage();
//objImage.SetSource(e.ChosenPhoto);
//Own_Image.Source = objImage;
using (var isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
fnam = e.OriginalFileName.Substring(93);
MessageBox.Show(fnam);
if (isolatedStorage.FileExists(fnam))
isolatedStorage.DeleteFile(fnam);
IsolatedStorageFileStream fileStream = isolatedStorage.CreateFile(fnam);
BitmapImage bitmap = new BitmapImage();
bitmap.SetSource(e.ChosenPhoto);
WriteableBitmap wb = new WriteableBitmap(bitmap);
wb.SaveJpeg(fileStream, wb.PixelWidth, wb.PixelHeight, 100, 100);
MessageBox.Show("File Created");
fileStream.Close();
}
}
Teraz chcę pobrać obraz z odizolowanej pamięci i wyświetlić go w moim sterowaniu obrazem.
Czy to możliwe?
Działa poprawnie. I poruszam następną stronę, wykonuję operację. i wróć do tego starego ekranu. Tutaj załadowany obraz nie jest wyświetlany. Piszę tę samą funkcję w zdarzeniu page_Loaded. Dlaczego nie jest ponownie ładowany. using (var isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication()) { if (isolatedStorage.FileExists (fnam)) { Own_Image.Source = GetImageFromIsolatedStorage (fnam); }} – selvam