What is the Windows RT / Windows Store App answer to App.config?

后端 未结 4 953
说谎
说谎 2020-12-31 00:20

What is the best way to go about reading and writing simple configuration data like we used to use App.config and Web.config available thr

相关标签:
4条回答
  • 2020-12-31 00:47

    In addition to the technical answers above its important to understand why there is no config file for these apps.

    WinRT/Windows store apps are client applications so unlike your ASP.NET applications that run on the server and require admin configuration changes, end users are not expected to tinker with these changes (SQL connection, timeouts, appSettings you name it) hence there is no need for such a config file for these apps,

    Hope it makes sense

    0 讨论(0)
  • 2020-12-31 00:51

    Metro apps don't have exact equivalent of app.config/web.config.

    Instead you should use package.appxmanifest to configure windows store specific values.

    For local settings you should use ApplicationData api.

    If you want to configure application after it is deployed you could simply load remote xml or json file at application start up.

    0 讨论(0)
  • 2020-12-31 00:57

    You can find a sample to mimic app.config in Windows Store apps based on XML files here

    Hth

    Stefan

    0 讨论(0)
  • 2020-12-31 00:59

    LocalSettings

    http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.applicationdata.localsettings

    OR

    RoamingSettings

    http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.applicationdata.roamingsettings.aspx

    The main difference is that RoamingSettings will be saved to the cloud and thus, can be transferred across different devices for the same user profile. LocalSettings is device-specific.

    0 讨论(0)
提交回复
热议问题