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中的一个错误,还是我必须更改我的代码?