mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
More commands/queries
WIP on XAML EntryVm and GroupVm
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
using System.Windows.Input;
|
||||
using Windows.UI.Xaml;
|
||||
using Microsoft.Xaml.Interactivity;
|
||||
using ModernKeePass.Application.Resources.Queries;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Interfaces;
|
||||
using ModernKeePass.Services;
|
||||
using ModernKeePass.ViewModels;
|
||||
|
||||
namespace ModernKeePass.Actions
|
||||
@@ -32,19 +32,23 @@ namespace ModernKeePass.Actions
|
||||
|
||||
public object Execute(object sender, object parameter)
|
||||
{
|
||||
var resource = new ResourcesService();
|
||||
var mediator = App.Mediator;
|
||||
var type = Entity is GroupVm ? "Group" : "Entry";
|
||||
|
||||
var message = Entity.IsRecycleOnDelete
|
||||
? resource.GetResourceValue($"{type}RecyclingConfirmation")
|
||||
: resource.GetResourceValue($"{type}DeletingConfirmation");
|
||||
var text = Entity.IsRecycleOnDelete ? resource.GetResourceValue($"{type}Recycled") : resource.GetResourceValue($"{type}Deleted");
|
||||
MessageDialogHelper.ShowActionDialog(resource.GetResourceValue("EntityDeleteTitle"), message,
|
||||
resource.GetResourceValue("EntityDeleteActionButton"),
|
||||
resource.GetResourceValue("EntityDeleteCancelButton"), a =>
|
||||
? mediator.Send(new GetResourceQuery { Key = $"{type}RecyclingConfirmation" })
|
||||
: mediator.Send(new GetResourceQuery { Key = $"{type}DeletingConfirmation" });
|
||||
var text = Entity.IsRecycleOnDelete ?
|
||||
mediator.Send(new GetResourceQuery { Key = $"{type}Recycled" }) :
|
||||
mediator.Send(new GetResourceQuery { Key = $"{type}Deleted" });
|
||||
MessageDialogHelper.ShowActionDialog(
|
||||
mediator.Send(new GetResourceQuery { Key = "EntityDeleteTitle" }).GetAwaiter().GetResult(),
|
||||
message.GetAwaiter().GetResult(),
|
||||
mediator.Send(new GetResourceQuery { Key = "EntityDeleteActionButton" }).GetAwaiter().GetResult(),
|
||||
mediator.Send(new GetResourceQuery { Key = "EntityDeleteCancelButton" }).GetAwaiter().GetResult(), async a =>
|
||||
{
|
||||
ToastNotificationHelper.ShowMovedToast(Entity, resource.GetResourceValue("EntityDeleting"), text);
|
||||
Entity.MarkForDelete(resource.GetResourceValue("RecycleBinTitle"));
|
||||
ToastNotificationHelper.ShowMovedToast(Entity, await mediator.Send(new GetResourceQuery { Key = "EntityDeleting" }), await text);
|
||||
await Entity.MarkForDelete(await mediator.Send(new GetResourceQuery { Key = "RecycleBinTitle"}));
|
||||
Command.Execute(null);
|
||||
}, null).GetAwaiter();
|
||||
|
||||
|
Reference in New Issue
Block a user