Moved application code to the Application layer

Imported Win10 project
Code cleanup
WIP - Use common UWP services for Win8.1 and Win10
This commit is contained in:
Geoffroy BONNEVILLE
2020-04-06 20:20:45 +02:00
parent e795a8c3c4
commit 56d93a5187
292 changed files with 48614 additions and 837 deletions

View File

@@ -0,0 +1,44 @@
using System.Threading.Tasks;
using Autofac;
using ModernKeePass.Domain.AOP;
using ModernKeePass.Domain.Dtos;
using ModernKeePass.Domain.Interfaces;
namespace ModernKeePass.ViewModels
{
public class OpenViewModel: NotifyPropertyChangedBase
{
private readonly IRecentService _recentService;
private string _name;
private string _databaseFilePath;
public bool IsFileSelected => !string.IsNullOrEmpty(DatabaseFilePath);
public string Name
{
get => _name;
private set => SetProperty(ref _name, value);
}
public string DatabaseFilePath
{
get => _databaseFilePath;
private set => SetProperty(ref _databaseFilePath, value);
}
public OpenViewModel(): this(App.Container.Resolve<IRecentService>())
{ }
public OpenViewModel(IRecentService recentService)
{
_recentService = recentService;
}
public async Task OpenFile(FileInfo fileInfo)
{
Name = fileInfo.Name;
DatabaseFilePath = fileInfo.Path;
OnPropertyChanged(nameof(IsFileSelected));
await _recentService.Add(fileInfo);
}
}
}