[英]Where are ApplicationData.RoamingSettings stored when using UWP?
I am making a UWP app and I need to store some settings for my app in roaming AppData.我正在制作一个 UWP 应用程序,我需要在漫游 AppData 中存储我的应用程序的一些设置。 I am using this code to save it:
我正在使用此代码来保存它:
public bool[] options =
{
true
};
public bool[] saveCBState =
{
true,
true,
true
};
ApplicationDataContainer roamingSettings = ApplicationData.Current.RoamingSettings;
// Some not important code...
roamingSettings.Values[nameof(options)] = options;
if (options[0])
roamingSettings.Values[nameof(saveCBState)] = saveCBState;
else
roamingSettings.Values[nameof(saveCBState)] = null;
Where can I find the settings that I just saved on my computer?在哪里可以找到我刚刚保存在计算机上的设置?
You could directly read the values form RoamingSettings whenever you want.您可以随时直接读取RoamingSettings中的值。
Like this:像这样:
ApplicationDataContainer myroamingSettings = ApplicationData.Current.RoamingSettings;
// load a setting that is local to the device
var optionValue = myroamingSettings.Values[nameof(options)];
var CBStateValue = myroamingSettings.Values[nameof(saveCBState)];
Also, please check the document that @Raymond Chen posted- https://learn.microsoft.com/en-us/windows/uwp/get-started/settings-learning-track#what-do-you-need-to-know , ApplicationData.Current.RoamingSettings gets the application settings container from the roaming app data store.另外,请查看@Raymond Chen 发布的文档 - https://learn.microsoft.com/en-us/windows/uwp/get-started/settings-learning-track#what-do-you-need-to-知道, ApplicationData.Current.RoamingSettings从漫游应用程序数据存储中获取应用程序设置容器。 Settings stored here no longer roam (as of Windows 11) , but the settings store is still available.
此处存储的设置不再漫游(自 Windows 11 起) ,但设置存储仍然可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.