mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Changed most services to singletons
Refactor the Database Service (no more enum, ...) Restored the Donate page with Paypal web page Added (but not working) MS App Center integration Corrected tests accordingly WIP AOP to detect database changes
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Windows.Storage;
|
||||
using Windows.UI.Xaml;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Interfaces;
|
||||
using ModernKeePass.Services;
|
||||
@@ -12,11 +11,11 @@ namespace ModernKeePass.ViewModels
|
||||
|
||||
public string Name => _database?.Name;
|
||||
|
||||
private readonly IDatabase _database;
|
||||
private readonly IDatabaseService _database;
|
||||
|
||||
public OpenVm() : this((Application.Current as App)?.Database) { }
|
||||
public OpenVm() : this(DatabaseService.Instance) { }
|
||||
|
||||
public OpenVm(IDatabase database)
|
||||
public OpenVm(IDatabaseService database)
|
||||
{
|
||||
_database = database;
|
||||
if (database == null || !database.IsFileOpen) return;
|
||||
@@ -25,10 +24,10 @@ namespace ModernKeePass.ViewModels
|
||||
|
||||
public void OpenFile(StorageFile file)
|
||||
{
|
||||
OpenFile(file, new RecentService());
|
||||
OpenFile(file, RecentService.Instance);
|
||||
}
|
||||
|
||||
public void OpenFile(StorageFile file, IRecent recent)
|
||||
public void OpenFile(StorageFile file, IRecentService recent)
|
||||
{
|
||||
_database.DatabaseFile = file;
|
||||
OnPropertyChanged("Name");
|
||||
@@ -36,7 +35,7 @@ namespace ModernKeePass.ViewModels
|
||||
AddToRecentList(file, recent);
|
||||
}
|
||||
|
||||
private void AddToRecentList(StorageFile file, IRecent recent)
|
||||
private void AddToRecentList(StorageFile file, IRecentService recent)
|
||||
{
|
||||
recent.Add(file, file.DisplayName);
|
||||
}
|
||||
|
Reference in New Issue
Block a user