Updated Settings page

Added new settings (history and clipboard)
Renamed and moved Settings Vms
This commit is contained in:
Geoffroy BONNEVILLE
2020-05-13 13:50:33 +02:00
parent 7ac1595aaa
commit d38d6461bd
42 changed files with 777 additions and 164 deletions

View File

@@ -0,0 +1,37 @@
using System.Threading.Tasks;
using GalaSoft.MvvmLight;
using MediatR;
using Messages;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Application.Database.Commands.UpdateCredentials;
using ModernKeePass.Application.Database.Queries.GetDatabase;
namespace ModernKeePass.ViewModels.ListItems
{
public class SettingsCredentialsVm: ViewModelBase
{
private readonly IMediator _mediator;
private readonly IResourceProxy _resource;
private readonly INotificationService _notification;
public SettingsCredentialsVm(IMediator mediator, IResourceProxy resource, INotificationService notification)
{
_mediator = mediator;
_resource = resource;
_notification = notification;
MessengerInstance.Register<CredentialsSetMessage>(this, async message => await UpdateDatabaseCredentials(message));
}
public async Task UpdateDatabaseCredentials(CredentialsSetMessage message)
{
await _mediator.Send(new UpdateCredentialsCommand
{
KeyFilePath = message.KeyFilePath,
Password = message.Password
});
var database = await _mediator.Send(new GetDatabaseQuery());
_notification.Show(database.Name, _resource.GetResourceValue("CompositeKeyUpdated"));
}
}
}