Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First page saves image to Isolated Storage as a file 'photo.jpg'. Second page read it.</p> <p>Page1:</p> <pre><code>public partial class Page1 : PhoneApplicationPage { PhotoChooserTask PhotoChooser; int ImageWidth, ImageHeight; // Constructor public Page1() { InitializeComponent(); ImageWidth = (int)PageImage.Width; ImageHeight = (int)PageImage.Height; PhotoChooser = new PhotoChooserTask(); PhotoChooser.PixelWidth = ImageWidth; PhotoChooser.PixelHeight = ImageHeight; PhotoChooser.ShowCamera = true; PhotoChooser.Completed += new EventHandler&lt;PhotoResult&gt;(PhotoChooser_Completed); } void PhotoChooser_Completed(object sender, PhotoResult e) { if (e.TaskResult == TaskResult.OK) { IsolatedStorageFile Store = IsolatedStorageFile.GetUserStoreForApplication(); IsolatedStorageFileStream Stream = new IsolatedStorageFileStream("photo.jpg", FileMode.Create, FileAccess.Write, Store); WriteableBitmap myImage = new WriteableBitmap(ImageWidth, ImageHeight); myImage.SetSource(e.ChosenPhoto); PageImage.Source = myImage; PageImage.InvalidateArrange(); myImage.SaveJpeg(Stream, ImageWidth, ImageHeight, 0, 100); Stream.Close(); } } protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (IsolatedStorageFile.GetUserStoreForApplication().FileExists("photo.jpg")) { IsolatedStorageFile Store = IsolatedStorageFile.GetUserStoreForApplication(); IsolatedStorageFileStream Stream = new IsolatedStorageFileStream("photo.jpg", FileMode.Open, FileAccess.Read, Store); WriteableBitmap myImage = new WriteableBitmap(ImageWidth, ImageHeight); myImage.LoadJpeg(Stream); PageImage.Source = myImage; PageImage.InvalidateArrange(); Stream.Close(); } } private void ToPage2Button_Click(object sender, System.Windows.RoutedEventArgs e) { NavigationService.Navigate(new Uri("/Page2.xaml", UriKind.Relative)); } private void LoadButton_Click(object sender, System.Windows.RoutedEventArgs e) { PhotoChooser.Show(); } } </code></pre> <p>Page2:</p> <pre><code>public partial class Page2 : PhoneApplicationPage { int ImageWidth, ImageHeight; public Page2() { InitializeComponent(); ImageWidth = (int)PageImage.Width; ImageHeight = (int)PageImage.Height; } private void BackButton_Click(object sender, System.Windows.RoutedEventArgs e) { NavigationService.GoBack(); } protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (IsolatedStorageFile.GetUserStoreForApplication().FileExists("photo.jpg")) { IsolatedStorageFile Store = IsolatedStorageFile.GetUserStoreForApplication(); IsolatedStorageFileStream Stream = new IsolatedStorageFileStream("photo.jpg", FileMode.Open, FileAccess.Read, Store); WriteableBitmap myImage = new WriteableBitmap(ImageWidth, ImageHeight); myImage.LoadJpeg(Stream); PageImage.Source = myImage; PageImage.InvalidateArrange(); Stream.Close(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload