1st working version in clean arch

WIP Parent group mapping issues
This commit is contained in:
Geoffroy BONNEVILLE
2020-03-30 19:43:04 +02:00
parent d1ba73ee9d
commit e4bd788ed3
54 changed files with 319 additions and 283 deletions

View File

@@ -7,29 +7,32 @@ namespace ModernKeePass.ViewModels
{
public class OpenVm: NotifyPropertyChangedBase
{
private readonly IRecentService _recent;
public bool IsFileSelected => DatabaseFile != null;
public string Name => DatabaseFile?.DisplayName;
public StorageFile DatabaseFile { get; private set; }
internal void OpenFile(StorageFile file)
{
OpenFile(file, RecentService.Instance);
}
public void OpenFile(StorageFile file, IRecentService recent)
public OpenVm(): this(new RecentService()) { }
public OpenVm(IRecentService recent)
{
_recent = recent;
}
public void OpenFile(StorageFile file)
{
DatabaseFile = file;
OnPropertyChanged("Name");
OnPropertyChanged("IsFileSelected");
OnPropertyChanged("DatabaseFile");
AddToRecentList(file, recent);
AddToRecentList(file);
}
private void AddToRecentList(StorageFile file, IRecentService recent)
private void AddToRecentList(StorageFile file)
{
recent.Add(file, file.DisplayName);
_recent.Add(file, file.DisplayName);
}
}
}