简体   繁体   English

Windows 8应用程序是否有设置查看器/管理器?

[英]Is There a Settings Viewer/Manager for Windows 8 apps?

For testing my roaming and/or local settings, I'd like to be able to clear all the settings. 为了测试漫游和/或本地设置,我希望能够清除所有设置。

I could do it like so, I guess: 我可以这样,我猜:

App.roamingSettings.Value["SomeVal"] = string.Empty;
App.roamingSettings.Value["SomeOtherVal"] = string.Empty;
App.roamingSettings.Value["YetAnotherVal"] = string.Empty;
...
etc.

...but I'd rather have some quicker, cleaner (no pun intended) way. ...但是我宁愿有一些更快,更清洁(无双关语)的方式。 Is there one? 有一个吗?

Also, relatedly, it would be nice to have a "Settings Manager" utility for quickly verifying they are what you think they are, too. 另外,与此相关的是,拥有一个“设置管理器”实用程序来快速验证它们是否也符合您的想法将是很好的。 Does anybody know of one? 有人知道吗?

UPDATE 更新

This is my attempt to "roll my own" based on the answer; 这是我根据答案尝试“自己动手”的尝试; so far, no go: 到目前为止,不可以:

string roamingSettingPairs = string.Empty;
for (int i = 0; i < App.roamingSettings.Values.Count; i++)
{
    // Print out whatever you want to verify that everything is as it should be
    //string roamingSettingName = App.roamingSettings.Name[i].ToString();
    //string roamingSettingValue = App.roamingSettings.Values[i].ToString();
    Dictionary<string, object> roamingSettingVals = App.roamingSettings.Values;
    string roamingSettingName = roamingSettingVals.Keys[i];
    object roamingSettingObj = roamingSettingVals.Values[i];
    //roamingSettingPairs = string.Format("{0}{1}={2}{3}", roamingSettingPairs, roamingSettingName,
      //                                  roamingSettingValue, Environment.NewLine);
}

You can delete all of your roaming settings using this code: 您可以使用以下代码删除所有漫游设置:

ApplicationData.Current.RoamingSettings.Values.Clear();

For a Settings Manager, I would probably just use a for loop like so: 对于设置管理器,我可能只需要像这样使用for循环:

for (int i = 0; i < ApplicationData.Current.RoamingSettings.Values.Count; i++)
{
    // Print out whatever you want to verify that everything is as it should be
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM