mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
FileInfo overhaul
Opening DB works again
This commit is contained in:
@@ -170,7 +170,7 @@ namespace ModernKeePass.ViewModels
|
||||
public async Task CreateKeyFile(FileInfo file)
|
||||
{
|
||||
// TODO: implement entropy generator
|
||||
await _mediator.Send(new GenerateKeyFileCommand {KeyFilePath = file.Path});
|
||||
await _mediator.Send(new GenerateKeyFileCommand {KeyFilePath = file.Id});
|
||||
KeyFilePath = file.Path;
|
||||
KeyFileText = file.Name;
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Domain.AOP;
|
||||
using ModernKeePass.Domain.Dtos;
|
||||
@@ -11,10 +10,27 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
private readonly IRecentProxy _recent;
|
||||
private bool _isSelected;
|
||||
|
||||
public string Token { get; }
|
||||
public string Name { get; }
|
||||
public string Path => string.Empty;
|
||||
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); }
|
||||
}
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
@@ -26,13 +42,15 @@ namespace ModernKeePass.ViewModels
|
||||
public RecentItemVm(IRecentProxy recent, FileInfo file)
|
||||
{
|
||||
_recent = recent;
|
||||
Token = file.Path;
|
||||
Token = file.Id;
|
||||
Name = file.Name;
|
||||
Path = file.Path;
|
||||
}
|
||||
|
||||
public async Task UpdateAccessTime()
|
||||
// Called from XAML
|
||||
public void UpdateAccessTime()
|
||||
{
|
||||
await _recent.Get(Token);
|
||||
_recent.Get(Token).Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -9,10 +9,28 @@ namespace ModernKeePass.ViewModels
|
||||
public class OpenVm: NotifyPropertyChangedBase
|
||||
{
|
||||
private readonly IRecentProxy _recent;
|
||||
private string _name;
|
||||
private string _path;
|
||||
private string _token;
|
||||
public bool IsFileSelected => !string.IsNullOrEmpty(Path);
|
||||
|
||||
public string Name { get; private set; }
|
||||
public string Path { get; private set; }
|
||||
public string Token
|
||||
{
|
||||
get { return _token; }
|
||||
set { SetProperty(ref _token, value); }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
private set { SetProperty(ref _name, value); }
|
||||
}
|
||||
|
||||
public string Path
|
||||
{
|
||||
get { return _path; }
|
||||
private set { SetProperty(ref _path, value); }
|
||||
}
|
||||
|
||||
public OpenVm(): this(App.Services.GetService<IRecentProxy>()) { }
|
||||
|
||||
@@ -23,9 +41,9 @@ namespace ModernKeePass.ViewModels
|
||||
|
||||
public async Task OpenFile(FileInfo file)
|
||||
{
|
||||
Token = file.Id;
|
||||
Name = file.Name;
|
||||
Path = file.Path;
|
||||
OnPropertyChanged(nameof(Name));
|
||||
OnPropertyChanged(nameof(IsFileSelected));
|
||||
await AddToRecentList(file);
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ namespace ModernKeePass.ViewModels
|
||||
RecentItems = new ObservableCollection<RecentItemVm>(_recent.GetAll().GetAwaiter().GetResult()
|
||||
.Select(r => new RecentItemVm(r)));
|
||||
if (RecentItems.Count > 0)
|
||||
SelectedItem = RecentItems[0] as RecentItemVm;
|
||||
SelectedItem = RecentItems[0];
|
||||
}
|
||||
|
||||
private void ClearAll()
|
||||
|
Reference in New Issue
Block a user