Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maskaravivek/9915068 to your computer and use it in GitHub Desktop.
Save maskaravivek/9915068 to your computer and use it in GitHub Desktop.
This method simply moves the referenced database from the windows phone's project folder to the application's isolated storage
public static void MoveReferenceDatabase()
{
// Obtain the virtual store for the application.
IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication();
// Create a stream for the file in the installation folder.
using (Stream input = Application.GetResourceStream(new Uri("DutchMe.sdf", UriKind.Relative)).Stream)
{
// Create a stream for the new file in the local folder.
using (IsolatedStorageFileStream output = iso.CreateFile("DutchMe.sdf"))
{
// Initialize the buffer.
byte[] readBuffer = new byte[4096];
int bytesRead = -1;
// Copy the file from the installation folder to the local folder.
while ((bytesRead = input.Read(readBuffer, 0, readBuffer.Length)) > 0)
{
output.Write(readBuffer, 0, bytesRead);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment