Exemplo n.º 1
0
        /// <summary>
        /// Clear the downloads cache
        /// </summary>
        /// <returns>TRUE if the cache was successfully deleted or FALSE otherwise.</returns>
        public static async Task <bool> ClearDownloadCacheAsync()
        {
            string downloadDir = GetDownloadDirectoryPath();

            if (string.IsNullOrWhiteSpace(downloadDir) || FolderService.HasIllegalChars(downloadDir) ||
                !Directory.Exists(downloadDir))
            {
                return(false);
            }

            return(await FolderService.ClearAsync(downloadDir));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Clear all the offline content of the app
        /// </summary>
        /// <returns>TRUE if the offline content was successfully deleted or FALSE otherwise.</returns>
        public static async Task <bool> ClearOfflineAsync()
        {
            bool result;

            string offlineDir = GetOfflineDirectoryPath();

            if (string.IsNullOrWhiteSpace(offlineDir) || FolderService.HasIllegalChars(offlineDir) ||
                !Directory.Exists(offlineDir))
            {
                return(false);
            }

            result = await FolderService.ClearAsync(offlineDir);

            // Clear the offline database
            result = result & SavedForOfflineDB.DeleteAllNodes();

            return(result);
        }