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

@@ -1,8 +1,7 @@
using System;
using Windows.UI.Xaml.Controls;
using ModernKeePass.Common;
using ModernKeePass.Domain.AOP;
using ModernKeePass.Domain.Interfaces;
using ModernKeePass.Interfaces;
namespace ModernKeePass.ViewModels
{

View File

@@ -1,20 +1,20 @@
using System.Threading.Tasks;
using Windows.Storage;
using ModernKeePass.Common;
using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.AOP;
using ModernKeePass.Domain.Dtos;
using ModernKeePass.Domain.Interfaces;
using ModernKeePass.Interfaces;
using ModernKeePass.Services;
namespace ModernKeePass.ViewModels
{
public class RecentItemVm: NotifyPropertyChangedBase, ISelectableModel, IRecentItem
public class RecentItemVm: NotifyPropertyChangedBase, ISelectableModel
{
private readonly IRecentProxy _recent;
private bool _isSelected;
public StorageFile DatabaseFile { get; }
public string Token { get; }
public string Name { get; }
public string Path => DatabaseFile?.Path;
public string Path => string.Empty;
public bool IsSelected
{
@@ -22,22 +22,17 @@ namespace ModernKeePass.ViewModels
set { SetProperty(ref _isSelected, value); }
}
public RecentItemVm() {}
public RecentItemVm(string token, string metadata, IStorageItem file)
public RecentItemVm(FileInfo file): this(App.Services.GetService<IRecentProxy>(), file) {}
public RecentItemVm(IRecentProxy recent, FileInfo file)
{
Token = token;
Name = metadata;
DatabaseFile = file as StorageFile;
_recent = recent;
Token = file.Path;
Name = file.Name;
}
public void UpdateAccessTime()
public async Task UpdateAccessTime()
{
UpdateAccessTime(RecentService.Instance).Wait();
}
public async Task UpdateAccessTime(IRecentService recent)
{
await recent.GetFileAsync(Token);
await _recent.Get(Token);
}
}
}

View File

@@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Linq;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Application.Database.Models;
using ModernKeePass.Application.Database.Queries.GetDatabase;
@@ -15,7 +16,7 @@ using ModernKeePass.Application.Parameters.Models;
using ModernKeePass.Application.Parameters.Queries.GetCiphers;
using ModernKeePass.Application.Parameters.Queries.GetCompressions;
using ModernKeePass.Application.Parameters.Queries.GetKeyDerivations;
using ModernKeePass.Common;
using ModernKeePass.Domain.AOP;
namespace ModernKeePass.ViewModels
{
@@ -73,7 +74,7 @@ namespace ModernKeePass.ViewModels
set { _mediator.Send(new SetRecycleBinCommand { RecycleBinId = value.Id}).Wait(); }
}
public SettingsDatabaseVm() : this(App.Mediator) { }
public SettingsDatabaseVm() : this(App.Services.GetService<IMediator>()) { }
public SettingsDatabaseVm(IMediator mediator)
{

View File

@@ -1,17 +1,17 @@
using System.Collections.Generic;
using ModernKeePass.Interfaces;
using ModernKeePass.Services;
using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Application.Common.Interfaces;
namespace ModernKeePass.ViewModels
{
public class SettingsNewVm
{
private readonly ISettingsService _settings;
private readonly ISettingsProxy _settings;
public SettingsNewVm() : this(SettingsService.Instance)
public SettingsNewVm() : this(App.Services.GetService<ISettingsProxy>())
{ }
public SettingsNewVm(ISettingsService settings)
public SettingsNewVm(ISettingsProxy settings)
{
_settings = settings;
}

View File

@@ -1,16 +1,16 @@
using ModernKeePass.Interfaces;
using ModernKeePass.Services;
using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Application.Common.Interfaces;
namespace ModernKeePass.ViewModels
{
public class SettingsSaveVm
{
private readonly ISettingsService _settings;
private readonly ISettingsProxy _settings;
public SettingsSaveVm() : this(SettingsService.Instance)
public SettingsSaveVm() : this(App.Services.GetService<ISettingsProxy>())
{ }
public SettingsSaveVm(ISettingsService settings)
public SettingsSaveVm(ISettingsProxy settings)
{
_settings = settings;
}