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