+ public bool CanClearAccountCache
+ {
+ get { return (CurrentAccount != null); }
+ }
+
+ public void ClearAccountCache()
+ {
+ if (MessageBoxResult.Yes == MessageBox.Show("You are about to delete all partially downloaded files from the account's cache.\n" +
+ " You will have to download all partially downloaded data again\n" +
+ "This change can not be undone\n\n" +
+ "Do you wish to delete all partially downloaded data?", "Warning! Clearing account cache",
+ MessageBoxButton.YesNo,MessageBoxImage.Question,MessageBoxResult.No))
+ {
+
+ var cachePath = Path.Combine(CurrentAccount.RootPath, FolderConstants.CacheFolder);
+ var dir = new DirectoryInfo(cachePath);
+ dir.EnumerateFiles().Apply(file=>file.Delete());
+ dir.EnumerateDirectories().Apply(folder => folder.Delete(true));
+ }
+ }