Beispiel #1
0
        /// <summary>
        /// Removes all application data from the local, roaming, and temporary app data stores.
        /// </summary>
        /// <returns></returns>
        public Task ClearAsync()
        {
#if WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE
            return(_applicationData.ClearAsync().AsTask());
#else
            return(Task.Run(async() =>
            {
                await LocalFolder?.DeleteAllItems();
                LocalSettings?.Values.Clear();
                await RoamingFolder?.DeleteAllItems();
                RoamingSettings?.Values.Clear();
                await TemporaryFolder?.DeleteAllItems();
            }));
#endif
        }
Beispiel #2
0
        /// <summary>
        /// Removes all application data from the specified app data store.
        /// </summary>
        /// <param name="locality">One of the enumeration values.</param>
        /// <returns></returns>
        public Task ClearAsync(ApplicationDataLocality locality)
        {
            return(Task.Run(async() =>
            {
                switch (locality)
                {
                case ApplicationDataLocality.Local:
                    await LocalFolder?.DeleteAllItems();
                    LocalSettings?.Values.Clear();
                    break;

                case ApplicationDataLocality.Roaming:
                    await RoamingFolder?.DeleteAllItems();
                    RoamingSettings?.Values.Clear();
                    break;

                case ApplicationDataLocality.Temporary:
                    await TemporaryFolder?.DeleteAllItems();
                    break;
                }
            }));
        }