Windows Phone 7上的App.config? [英] App.config on windows phone 7?

查看:133
本文介绍了Windows Phone 7上的App.config?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有,
我正在Windows Phone 7上构建应用程序。我的应用程序需要一些配置,如Web服务Url,数据库名称,...这些配置可以在部署期间随时更改(但是,我不想重新构建应用程序)。在WPF应用程序中,我经常在App.config文件中保存这些配置,但是在WP7应用程序中我不能。

Dear all, I am building an application on windows phone 7. My application needs some configurations such as Web-service Urls, database name, ... These configurations may be changed whenever needed during deployment time ( but I don't want to re-build the application). In WPF application, I often save these configurations at App.config file, but in WP7 application I can't.

如果你之前遇到过这个问题,任何解决方案,请告诉我。

If you met this problem before as well as you have any solution for it, please tell me.

非常感谢。

Binh Nguyen。

Binh Nguyen.

推荐答案

我不清楚您的问题,但是:

I'm not clear from your question but:

您可以在运行时更改(一旦部署),然后将此信息存储在 IsolatedStorage 中。您可以使用IsolatedStorageFile或IsolatedStorageSettings取决于什么是最适合您的数据。

我已经通过在首次运行应用程序时写入IsolatedStorageFile的代码中设置了默认设置。

If you want settings that you can change at run time (once deployed) then store this information in IsolatedStorage. You can use an IsolatedStorageFile or IsolatedStorageSettings depending on what is most appropriate to your data.
I've done this lots by having default settings in code which I write to an IsolatedStorageFile on first run of the app. These can then be read and updated as necessary.

如果您只想在构建时更改值,请将设置包含在/资源(.resx)文件中。

If you just want change the values at build time, include the settings in a/the resources (.resx) file.

这篇关于Windows Phone 7上的App.config?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆