1

我有 Windows Phone 8 应用程序。我将此应用程序安装在运行 Windows 10 移动版的设备中。从设备卸载应用程序后,我发现我的 sqlite db 文件存在于 IsolatedStorageFile

IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
store.FileExists(dbName)  // returns true

我通过这种方法将此文件添加到存储中:

Assembly assem = Assembly.GetExecutingAssembly();
CopyFromContentToStorage(assem.FullName.Substring(0, assem.FullName.IndexOf(',')), dbName);

    private void CopyFromContentToStorage(String assemblyName, String dbName)
    {
        IsolatedStorageFile store =
            IsolatedStorageFile.GetUserStoreForApplication();
        System.IO.Stream src =
            Application.GetResourceStream(
                new Uri("/" + assemblyName + ";component/" + dbName,
                        UriKind.Relative)).Stream;
        IsolatedStorageFileStream dest =
            new IsolatedStorageFileStream(dbName,
                System.IO.FileMode.OpenOrCreate,
                System.IO.FileAccess.Write, store);
        src.Position = 0;
        CopyStream(src, dest);
        dest.Flush();
        dest.Close();
        src.Close();
        dest.Dispose();
    }

我在运行 windows phone 8 * 8.1 的两台设备上测试了这个应用程序。但它在这些设备上正常工作;

这是 Windows Mobile 10 中的错误还是我必须更改我的代码?

4

0 回答 0