Using Launcher.LaunchFileAsync to launch file from Isolated File Storage on the Window Phone 8 SDK

Assuming you have saved your file to the Isolated File Storage like so:

using (IsolatedStorageFile ISF = IsolatedStorageFile.GetUserStoreForApplication())

{

//create a local file with the same name using the input stream and saving through the output stream

using (IsolatedStorageFileStream outputStream = ISF.CreateFile(fileName))

{

try

{

byte[] bytes = new byte[inputStream.Length];

inputStream.Read(bytes, 0, (int)inputStream.Length);

outputStream.Write(bytes, 0, bytes.Length);

outputStream.Flush();

}

catch

{}

}

loadingProgressBar.IsVisible = false;

 

//have saved our file now lets launch it

LaunchFile(fileName);

}

 

private async void LaunchFile(string fileName)

{

var file = await ApplicationData.Current.LocalFolder.GetFileAsync(fileName);

await Windows.System.Launcher.LaunchFileAsync(file);

}