/// <summary>
        /// Clear the complete cache
        /// </summary>
        /// <returns></returns>
        public static Task ClearLocalAll()
        {
            return(Task.Run(async() =>
            {
                DataStorageHelper <object> storage = new DataStorageHelper <object>();
                var folder = await storage.GetFolderAsync().ConfigureAwait(false);

                foreach (var sub in await folder.GetFoldersAsync())
                {
                    try
                    {
                        await sub.DeleteAsync();
                    }
                    catch (UnauthorizedAccessException)
                    {
                    }
                }

                foreach (var file in await folder.GetFilesAsync())
                {
                    try
                    {
                        await file.DeleteAsync();
                    }
                    catch (UnauthorizedAccessException)
                    {
                    }
                }
            }));
        }
Пример #2
0
        /// <summary>
        /// Clear the complete cache
        /// </summary>
        /// <returns></returns>
        public static Task ClearAll(string cacheFolder)
        {
            return(Task.Run(async() =>
            {
                DataStorageHelper <object> storage = new DataStorageHelper <object>(cacheFolder);
                var folder = await storage.GetFolderAsync().ConfigureAwait(false);

                try
                {
                    await folder.DeleteAsync();
                }
                catch (UnauthorizedAccessException)
                {
                }

                //foreach (var file in await folder.GetFilesAsync())
                //{
                //    await file.DeleteAsync();
                //}
            }));
        }