Saved Counts in a variable
This commit is contained in:
@@ -21,6 +21,9 @@ public class DeleteSelectionAction : IFileManagerSelectionAction
|
||||
var showFolderCount = 3;
|
||||
var showFileCount = 6;
|
||||
|
||||
var folderCount = entries.Count(x => x.IsDirectory);
|
||||
var fileCount = entries.Count(x => x.IsFile);
|
||||
|
||||
// Construct file list
|
||||
var fileList = "";
|
||||
|
||||
@@ -29,19 +32,19 @@ public class DeleteSelectionAction : IFileManagerSelectionAction
|
||||
fileList += folderEmoji + " " + folder.Name + "\n";
|
||||
}
|
||||
|
||||
if (entries.Where(x => x.IsDirectory).ToArray().Length > showFolderCount)
|
||||
fileList += "And " + (entries.Where(x => x.IsDirectory).ToArray().Length - showFolderCount) + " more folders... \n\n";
|
||||
if (folderCount > showFolderCount)
|
||||
fileList += "And " + (folderCount - showFolderCount) + " more folders... \n\n";
|
||||
|
||||
foreach (var file in entries.Where(x => x.IsFile).Take(showFileCount))
|
||||
{
|
||||
fileList += fileEmoji + " " + file.Name + "\n";
|
||||
}
|
||||
|
||||
if (entries.Where(x => x.IsFile).ToArray().Length > showFileCount)
|
||||
fileList += "And " + (entries.Where(x => x.IsFile).ToArray().Length - showFileCount) + " more files...";
|
||||
if (fileCount > showFileCount)
|
||||
fileList += "And " + (fileCount - showFileCount) + " more files...";
|
||||
|
||||
|
||||
if(!await alertService.YesNo($"Do you really want to delete {entries.Length} item(s)? \n\n" + fileList))
|
||||
if(!await alertService.YesNo($"Do you really want to delete {folderCount + fileCount} item(s)? \n\n" + fileList))
|
||||
return;
|
||||
|
||||
await toastService.CreateProgress("fileManagerSelectionDelete", "Deleting items");
|
||||
|
||||
Reference in New Issue
Block a user