If you want to save to ONLY isolated storage, you cannot use the CameraCaptureTask
. In WP8, it will transparently save a copy of the image to the camera roll, regardless of what you do.
That said, there is a solution. You'll need to use the camera APIs to basically create and use your own CameraCaptureTask
. I'm not going to go into huge depth, but this should get you started.
First thing you need to do is follow this tutorial to create the view and basic application. They use the cam_CaptureImageAvailable
method to store the image to the camera roll. You'll want to modify that to store it in isolated storage like so:
using (e.ImageStream)
{
using(IsolatedStorageFile storageFile = IsolatedStorageFile.GetuserStoreForApplication())
{
if( !sotrageFile.DirectoryExists(<imageDirectory>)
{
storageFile.CreateDirectory(<imageDirectory>);
}
using( IsolatedStorageFileStream targetStream = storageFile.OpenFile( <filename+path>, FileMode.Create, FileAccess.Write))
{
byte[] readBuffer = new byte[4096];
int bytesRead;
while( (bytesRead = e.ImageStream.Read( readBuffer, 0, readBuffer.Length)) > 0)
{
targetStream.Write(readBuffer, 0, bytesRead);
}
}
}
}
From this point, you have a functional camera application that stores only to isolated storage. You may want to spice it up with color effects or something, but it's not necessary.