Tôi đang sử dụng mã này để lưu trữ hình ảnh vào bộ nhớ cách ly tại thời điểm tác vụ của máy ảnh hoàn tất.Cách tải hình ảnh từ bộ nhớ bị cô lập vào điều khiển hình ảnh trên điện thoại 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();
}
}
Bây giờ tôi muốn lấy hình ảnh từ bộ nhớ riêng và hiển thị nó trong điều khiển hình ảnh của tôi.
Có thể không?
Nó hoạt động tốt. Và tôi di chuyển trang tiếp theo làm một số hoạt động. và trở lại màn hình cũ này. Ở đây hình ảnh được tải không được hiển thị. Và tôi viết cùng một hàm gọi trong sự kiện page_Loaded. Tại sao nó không được nạp lại một lần nữa. sử dụng (var isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication()) { nếu (isolationStorage.FileExists (fnam)) { Own_Image.Source = GetImageFromIsolatedStorage (fnam); }} – selvam