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

本文关键字:管理器 应用程序 设置 Windows | 更新日期: 2023-09-27 17:49:41

为了测试我的漫游和/或本地设置,我希望能够清除所有设置。

我想我可以这样做:

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

…但我宁愿有一些更快,更干净(没有双关语)的方式。有吗?

同样,相对地,如果有一个"设置管理器"实用程序来快速验证它们是你认为的那样,那就太好了。有人知道吗?

更新

这是我尝试根据答案"滚动我自己的";到目前为止,没有进展:

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);
}

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

您可以使用以下代码删除所有漫游设置:

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

对于设置管理器,我可能只会使用一个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
}