简体   繁体   English

使用 UWP 时,ApplicationData.RoamingSettings 存储在哪里?

[英]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.

相关问题 ApplicationData.Current.RoamingSettings - ApplicationData.Current.RoamingSettings 在控制台中使用带有UWP参数的ApplicationData - ApplicationData using in Console with UWP parameters 绑定到ApplicationData RoamingSettings Values使应用程序崩溃 - Binding to ApplicationData RoamingSettings Values crashes app UWP 应用程序数据本地设置 - UWP ApplicationData LocalSettings 使用Windows.Storage.ApplicationData对象及其RoamingSettings属性来保存SerializableDictionary - Use Windows.Storage.ApplicationData object and his RoamingSettings property for save SerializableDictionary 使用Windows应用商店应用数据当前设置时出现FileNotFoundException - FileNotFoundException when using Windows Store Apps ApplicationData Current Settings 有没有一种方法可以将Windows.Storage.ApplicationData与UWP应用程序中的foreach循环一起使用来保存列表? - Is there a way to save a list using Windows.Storage.ApplicationData with a foreach loop in a UWP app? UWP C# 将设备信息保存到 ApplicationData - UWP C# Saving DeviceInformation to ApplicationData UWP 在发布模式下运行给出“‘ApplicationData’在当前上下文中不存在” - UWP run in Release Mode gives "'ApplicationData' does not exist in the current context" 使用Entity.Framework时数据存储在哪里? - where is the data stored when using the Entity.Framework?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM