2018-06-20 17:20:15 +02:00
|
|
|
|
using System.Threading.Tasks;
|
2020-04-06 20:20:45 +02:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using ModernKeePass.Application.Common.Interfaces;
|
|
|
|
|
using ModernKeePass.Domain.AOP;
|
|
|
|
|
using ModernKeePass.Domain.Dtos;
|
2020-03-30 19:43:04 +02:00
|
|
|
|
using ModernKeePass.Domain.Interfaces;
|
2017-10-01 08:48:29 -04:00
|
|
|
|
|
2017-10-02 10:44:04 +02:00
|
|
|
|
namespace ModernKeePass.ViewModels
|
2017-09-29 17:23:35 -04:00
|
|
|
|
{
|
2020-04-06 20:20:45 +02:00
|
|
|
|
public class RecentItemVm: NotifyPropertyChangedBase, ISelectableModel
|
2017-09-29 17:23:35 -04:00
|
|
|
|
{
|
2020-04-06 20:20:45 +02:00
|
|
|
|
private readonly IRecentProxy _recent;
|
2017-10-03 16:06:49 +02:00
|
|
|
|
private bool _isSelected;
|
2017-12-01 17:59:38 +01:00
|
|
|
|
|
2017-11-07 18:45:35 +01:00
|
|
|
|
public string Token { get; }
|
|
|
|
|
public string Name { get; }
|
2020-04-06 20:20:45 +02:00
|
|
|
|
public string Path => string.Empty;
|
2017-10-01 08:48:29 -04:00
|
|
|
|
|
2017-10-03 16:06:49 +02:00
|
|
|
|
public bool IsSelected
|
2017-10-01 08:48:29 -04:00
|
|
|
|
{
|
2017-10-03 16:06:49 +02:00
|
|
|
|
get { return _isSelected; }
|
2017-11-07 18:45:35 +01:00
|
|
|
|
set { SetProperty(ref _isSelected, value); }
|
2017-10-01 08:48:29 -04:00
|
|
|
|
}
|
2017-11-24 12:17:41 +01:00
|
|
|
|
|
2020-04-06 20:20:45 +02:00
|
|
|
|
public RecentItemVm(FileInfo file): this(App.Services.GetService<IRecentProxy>(), file) {}
|
|
|
|
|
public RecentItemVm(IRecentProxy recent, FileInfo file)
|
2017-12-01 17:59:38 +01:00
|
|
|
|
{
|
2020-04-06 20:20:45 +02:00
|
|
|
|
_recent = recent;
|
|
|
|
|
Token = file.Path;
|
|
|
|
|
Name = file.Name;
|
2017-12-01 17:59:38 +01:00
|
|
|
|
}
|
2018-06-19 18:47:37 +02:00
|
|
|
|
|
2020-04-06 20:20:45 +02:00
|
|
|
|
public async Task UpdateAccessTime()
|
2017-12-01 17:59:38 +01:00
|
|
|
|
{
|
2020-04-06 20:20:45 +02:00
|
|
|
|
await _recent.Get(Token);
|
2017-11-24 12:17:41 +01:00
|
|
|
|
}
|
2017-09-29 17:23:35 -04:00
|
|
|
|
}
|
|
|
|
|
}
|