Delete command

This commit is contained in:
2023-01-28 14:34:23 +01:00
parent ebbc3f6fc0
commit b3755f4ceb
13 changed files with 200 additions and 56 deletions

View File

@@ -90,9 +90,10 @@ public class ItemManipulationUserCommandHandlerService : UserCommandHandlerServi
else if (_currentSelectedItem?.BaseItem != null)
{
var item = _currentSelectedItem.BaseItem;
_clipboardService.AddContent(item.FullName ??
throw new ArgumentException($"{nameof(item.FullName)} can not be null.",
nameof(item)));
_clipboardService.AddContent(
item.FullName
?? throw new ArgumentException($"{nameof(item.FullName)} can not be null.", nameof(item))
);
}
return Task.CompletedTask;
@@ -233,14 +234,12 @@ public class ItemManipulationUserCommandHandlerService : UserCommandHandlerServi
return;
}
var deleteCommand = new FileTime.Core.Command.Delete.DeleteCommand()
{
HardDelete = command.IsHardDelete
};
var deleteCommand = _serviceProvider.GetRequiredService<FileTime.Core.Command.Delete.DeleteCommand>();
deleteCommand.HardDelete = command.IsHardDelete;
deleteCommand.ItemsToDelete.AddRange(itemsToDelete!);
await AddCommand(deleteCommand);
_selectedTab?.ClearMarkedItems();
}

View File

@@ -6,6 +6,7 @@ using FileTime.Core.Command;
using FileTime.Core.Command.Copy;
using FileTime.Core.Command.CreateContainer;
using FileTime.Core.Command.CreateElement;
using FileTime.Core.Command.Delete;
using FileTime.Core.CommandHandlers;
using FileTime.Core.ContentAccess;
using FileTime.Core.Services;
@@ -49,6 +50,7 @@ public static class DependencyInjection
return serviceCollection
.AddTransient<CreateContainerCommand>()
.AddTransient<CreateElementCommand>()
.AddTransient<CopyCommand>();
.AddTransient<CopyCommand>()
.AddTransient<DeleteCommand>();
}
}