Третий день не могу разобраться с windows phone 8.1 c# sqlite - вопрос №1406291

Добрый день. Третий день не могу разобраться. Первый раз пишу приложение для windows phone 8.1. В нём будет использоваться база данных (заранее заполненная), в которую будут добавляться новые записи по мере надобности. Т.е. нужно уже готовую базу данных как-то добавить в приложение(ресурсы?)и при первом запуске скопировать её в локальную папку на устройстве. Нашёл статью [http://developer.nokia.com/community/wiki/How_to_use_SQLite_in_Windows_Phone#Preparing_the_application_to_publish_to_the_Store][1], но код из того примера не работает.

`
private async void Application_Launching(object sender, LaunchingEventArgs e)
{
StorageFile dbFile = null;
try
{
dbFile = await StorageFile.GetFileFromPathAsync(MainPage.DB_PATH);
}

catch (FileNotFoundException)
{

if (dbFile == null)
{
IsolatedStorageFile iso =IsolatedStorageFile.GetUserStoreForApplication();

// Create a stream for the file in the installation folder.
using (Stream input = Application.GetResourceStream(new Uri(«sample.sqlite», UriKind.Relative)).Stream)
{
using (IsolatedStorageFileStream output = iso.CreateFile(MainPage.DB_PATH))
{
// 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);
}
}
}
}
}

`
ругается на isolatedstoragefile,application.getresourceStream(),isolatedstoragefilestream. Что не так? Или как можно другим способом реализовать копирование базы

[1]: developer.nokia.com/community/wiki/How_to_use_SQLite_in_Windows_Phone#Preparing_the_application_to_publish_to_the_Store
12.03.15
0 ответов
Ответов пока нет
Посмотреть всех экспертов из раздела Технологии > .Net/C#
Пользуйтесь нашим приложением Доступно на Google Play Загрузите в App Store