mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
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:
@@ -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
|
||||
{
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user