Added the option to close DB without saving

Changed the way recent files are retrieved
Stopped showing the DB Closed exception on suspend
Reordering entries works
Moved code from infra to application
Cleanup
This commit is contained in:
Geoffroy BONNEVILLE
2020-04-09 19:43:06 +02:00
parent 14fd4634db
commit d972b6cb5a
35 changed files with 141 additions and 100 deletions

View File

@@ -11,7 +11,7 @@ namespace ModernKeePass.ViewModels
public class SaveVm
{
private readonly IMediator _mediator;
public SaveVm() : this(App.Services.GetService<IMediator>()) { }
public SaveVm() : this(App.Services.GetRequiredService<IMediator>()) { }
public SaveVm(IMediator mediator)
{
@@ -21,7 +21,7 @@ namespace ModernKeePass.ViewModels
public async Task Save(bool close = true)
{
await _mediator.Send(new SaveDatabaseCommand());
if (close) await _mediator.Send(new CloseDatabaseCommand());
if (close) await Close();
}
public async Task Save(StorageFile file)
@@ -29,5 +29,10 @@ namespace ModernKeePass.ViewModels
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
await _mediator.Send(new SaveDatabaseCommand { FilePath = token });
}
public async Task Close()
{
await _mediator.Send(new CloseDatabaseCommand());
}
}
}