2020-04-07 12:48:18 +02:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2020-04-06 20:20:45 +02:00
|
|
|
|
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;
|
2020-04-07 12:48:18 +02:00
|
|
|
|
private string _name;
|
|
|
|
|
private string _token;
|
|
|
|
|
private string _path;
|
|
|
|
|
|
|
|
|
|
public string Token
|
|
|
|
|
{
|
|
|
|
|
get { return _token; }
|
|
|
|
|
set { SetProperty(ref _token, value); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get { return _name; }
|
|
|
|
|
set { SetProperty(ref _name, value); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Path
|
|
|
|
|
{
|
|
|
|
|
get { return _path; }
|
|
|
|
|
set { SetProperty(ref _path, value); }
|
|
|
|
|
}
|
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-09 19:43:06 +02:00
|
|
|
|
public RecentItemVm(FileInfo file): this(App.Services.GetRequiredService<IRecentProxy>(), file) {}
|
2020-04-06 20:20:45 +02:00
|
|
|
|
public RecentItemVm(IRecentProxy recent, FileInfo file)
|
2017-12-01 17:59:38 +01:00
|
|
|
|
{
|
2020-04-06 20:20:45 +02:00
|
|
|
|
_recent = recent;
|
2020-04-07 12:48:18 +02:00
|
|
|
|
Token = file.Id;
|
2020-04-06 20:20:45 +02:00
|
|
|
|
Name = file.Name;
|
2020-04-07 12:48:18 +02:00
|
|
|
|
Path = file.Path;
|
2017-12-01 17:59:38 +01:00
|
|
|
|
}
|
2018-06-19 18:47:37 +02:00
|
|
|
|
|
2020-04-07 12:48:18 +02:00
|
|
|
|
// Called from XAML
|
|
|
|
|
public void UpdateAccessTime()
|
2017-12-01 17:59:38 +01:00
|
|
|
|
{
|
2020-04-07 17:29:03 +02:00
|
|
|
|
_recent.Get(Token, true).Wait();
|
2017-11-24 12:17:41 +01:00
|
|
|
|
}
|
2017-09-29 17:23:35 -04:00
|
|
|
|
}
|
|
|
|
|
}
|