English 中文(简体)
视窗电话7的剩余资源
原标题:Refresh resources in Windows Phone 7 app isolated storage

我有一台视窗电话,依靠一台XML数据文档,该数据文档是随附而包的。 第一次用电话接手时,我把档案装上孤立的储存。 一旦档案被装入孤立的储存,该仪器就使用孤立的数据储存版本。 在我的下一个版本(市场更新版)中,XML文件将有更多的内容,我如何每份更新一次更新一次更新数据(市场新版)?

I thought I could change the file name in the isolated storage, but that would leave trash behind. I could also check for exceptions when I load the XML file, but are there any other, more elegant ways? I do not want to check for the old file in the isolated storage every time my app runs.

The ideal scenario would be to put a piece of code that would be executed once when the new version of the app is loaded onto the phone, is there a way to do that?

最佳回答

据我所知,没有“盒子外”活动,在安装/更新之后,第一次运行一次。

你必须像你已经说过的那样,自封不动(除了目前的版本,对每一页的版本进行比较,看看是否更新了数据!)

问题回答

页: 1 我现在理解你想要的东西。

  1. Add the XML file as a resource.
  2. Use GetResourceStream to get the content of the XML.

请注意,该资源的名称是:

我在这里做的是:

在我<代码>的构造方法中 我增加了以下法典:

private bool AppIsOld
{
    get
    {
        string storedVersion = GetStoredAppVersion(); //stored previously "seen" version
        string currentVersion = GetCurrentlyRunningAppVersion();
        return !(storedVersion == currentVersion);
    }
}


private string GetCurrentlyRunningAppVersion()
{
    var asm = Assembly.GetExecutingAssembly();
    var parts = asm.FullName.Split( , );
    return parts[1].Split( = )[1].ToString();
}

接着,我进行了以下检查:

if (AppIsOld)
    RefreshResources(); //do whatever to refresh resources

here

这一解决办法不是我所铭记的,因为每当有人要求上班建筑商时,它都会运作起来,而我想要的是一劳永逸的版本。





相关问题
Silverlight 4.0 IsolatedStorageFile

How to view all the content in my IsolatedStorageFile by setting a new page in your browser? Thank you

Silverlight: Log4Net to Isolated Storage

First, I know about Clog, and I do not want to implement this piece. The reason? We can t maintain severeal logging frameworks . So to my question: Is it possible to implement log4net in a ...

Silverlight IsolatedStorage techniques for larger files?

I am using IsolatedStorage in Silverlight 3 to store some settings when a user navigates away from a page hosting the application. Currently i m using a DataContractSerializer to write the settings ...

Silverlight Save image to IsolatedStorage

Is the following the correct way to save an image to isolated storage? public void imageToStore(Image imageIn) { IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication(); ...

Copying a file from an IsolatedStorage

I was just wondering if there is a way to prevent people from copying a file which is stored by using System.IO.IsolatedStorage? To me, I can t think of anyway. Any person can go and grab those files ...

热门标签