2018-06-20 17:20:15 +02:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Windows.Storage;
|
2017-10-11 14:30:07 +02:00
|
|
|
|
using ModernKeePass.Common;
|
2020-03-30 19:43:04 +02:00
|
|
|
|
using ModernKeePass.Domain.Interfaces;
|
2017-11-07 18:45:35 +01:00
|
|
|
|
using ModernKeePass.Interfaces;
|
2017-12-01 17:59:38 +01:00
|
|
|
|
using ModernKeePass.Services;
|
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
|
|
|
|
{
|
2017-12-01 17:59:38 +01:00
|
|
|
|
public class RecentItemVm: NotifyPropertyChangedBase, ISelectableModel, IRecentItem
|
2017-09-29 17:23:35 -04:00
|
|
|
|
{
|
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 StorageFile DatabaseFile { get; }
|
|
|
|
|
public string Token { get; }
|
|
|
|
|
public string Name { get; }
|
|
|
|
|
public string Path => DatabaseFile?.Path;
|
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
|
|
|
|
|
2017-12-01 17:59:38 +01:00
|
|
|
|
public RecentItemVm() {}
|
|
|
|
|
public RecentItemVm(string token, string metadata, IStorageItem file)
|
|
|
|
|
{
|
|
|
|
|
Token = token;
|
|
|
|
|
Name = metadata;
|
|
|
|
|
DatabaseFile = file as StorageFile;
|
|
|
|
|
}
|
2018-06-19 18:47:37 +02:00
|
|
|
|
|
2017-12-01 17:59:38 +01:00
|
|
|
|
public void UpdateAccessTime()
|
|
|
|
|
{
|
2018-06-20 17:20:15 +02:00
|
|
|
|
UpdateAccessTime(RecentService.Instance).Wait();
|
2017-12-01 17:59:38 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-20 17:20:15 +02:00
|
|
|
|
public async Task UpdateAccessTime(IRecentService recent)
|
2017-11-24 12:17:41 +01:00
|
|
|
|
{
|
2017-12-01 17:59:38 +01:00
|
|
|
|
await recent.GetFileAsync(Token);
|
2017-11-24 12:17:41 +01:00
|
|
|
|
}
|
2017-09-29 17:23:35 -04:00
|
|
|
|
}
|
|
|
|
|
}
|