Windows phone 7 将项目frm OS7.0升级到OS7.1,GetFileName不适用于windows phone
在将项目从OS7.0更改为OS7.1之前,下面的代码正在运行。升级后,代码不工作。如果您能帮助我们如何使这个隔离存储工作,我们将不胜感激Windows phone 7 将项目frm OS7.0升级到OS7.1,GetFileName不适用于windows phone,windows-phone-7,Windows Phone 7,在将项目从OS7.0更改为OS7.1之前,下面的代码正在运行。升级后,代码不工作。如果您能帮助我们如何使这个隔离存储工作,我们将不胜感激 使用(var store1=IsolatedStorageFile.GetUserStoreForApplication()) { 如果(store1.DirectoryExists(“联系人”)) { strFileName=“Contacts\” string[]fileList=store1.getfilename(strFileName); if(
使用(var store1=IsolatedStorageFile.GetUserStoreForApplication())
{
如果(store1.DirectoryExists(“联系人”))
{
strFileName=“Contacts\”
string[]fileList=store1.getfilename(strFileName);
if(fileList.Length我认为OS7.1需要一个搜索模式
搜索模式。支持单字符(“?”)和多字符(“*”)通配符
添加*解决了我的问题。什么不起作用?GetFileName会抛出错误或根本不返回任何内容?你确定联系人文件夹中有文件吗?我添加了数据或文件。我真的找不到错误。我在两个版本中测试了应用程序:OS7.0和7.1,只有带有OS7,0的应用程序起作用。没有错误,测试了strFilename=“Contacts\\”或strFilename=@“Contacts\”
using (var store1 = IsolatedStorageFile.GetUserStoreForApplication())
{
if (store1.DirectoryExists("Contacts"))
{
strFileName = "Contacts\";
string[] fileList = store1.GetFileNames(strFileName);
if (fileList.Length <= 0)
{
txtBlkMsg.Text = "No Contact file created. ";
listBox1.ItemsSource = null;
}
else
{
listBox1.ItemsSource = fileList;
}
}
else
{
txtBlkMsg.Text = "You have not created any contact file ";
}