DeleteContainer() public method

public DeleteContainer ( [ name ) : void
name [
return void
コード例 #1
0
        private void DemoDataPersistenceCodeThroughSettings()
        {
            // Persisting simple Application Settings.
            localSettings.Values["CurrentReadingBook"]          = "Migrating to Windows Phone";
            roamingSettings.Values["LastPageReadOnCurrentBook"] = 20;

            // Organizing settings in containers.
            Windows.Storage.ApplicationDataContainer container = localSettings.CreateContainer("FavoriteBooks", Windows.Storage.ApplicationDataCreateDisposition.Always);
            if (localSettings.Containers.ContainsKey("FavoriteBooks"))
            {
                localSettings.Containers["FavoriteBooks"].Values["FavoriteWindowsPhoneBook"] = "Windows Phone Recipes";
            }


            // Reading settings back.
            string currentBook = string.Empty;
            int    lastPageReadOnCurrentBook;

            if (localSettings.Values["CurrentReadingBook"] != null)
            {
                currentBook = localSettings.Values["CurrentReadingBook"].ToString();
            }

            if (roamingSettings.Values["LastPageReadOnCurrentBook"] != null)
            {
                lastPageReadOnCurrentBook = Convert.ToInt16(roamingSettings.Values["LastPageReadOnCurrentBook"]);
            }

            bool   hasFavoritesContainer    = localSettings.Containers.ContainsKey("FavoriteBooks");
            string favoriteWindowsPhoneBook = string.Empty;

            if (hasFavoritesContainer)
            {
                if (localSettings.Containers["FavoriteBooks"].Values.ContainsKey("FavoriteWindowsPhoneBook"))
                {
                    favoriteWindowsPhoneBook = localSettings.Containers["FavoriteBooks"].Values["FavoriteWindowsPhoneBook"].ToString();
                }
            }


            // Deleting Settings from Storage.
            localSettings.Values.Remove("CurrentReadingBook");
            roamingSettings.Values.Remove("LastPageReadOnCurrentBook");
            localSettings.DeleteContainer("FavoriteBooks");
        }
コード例 #2
0
ファイル: LocalData.cs プロジェクト: sup1212errrrlol/VPNGATE
 /// <summary>
 /// 删除容器
 /// </summary>
 /// <param name="ContainerName">容器名字</param>
 public void RemoveContainer(Object ContainerName)
 {
     localSetting.DeleteContainer(ContainerName.ToString());
 }
コード例 #3
0
ファイル: SettingHelper.cs プロジェクト: Ruobin521/SoDu-UWP
 /// <summary>
 /// 删除设置容器
 /// </summary>
 /// <param name="key"></param>
 public static void RemoveContainer(string containerName)
 {
     localSettings.DeleteContainer(containerName);
 }