mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Database files are added to the mru instead of the fal
Simplify opening database workflow Corrected opening from recent bug
This commit is contained in:
@@ -36,7 +36,7 @@ namespace ModernKeePass.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public NewVm(IMediator mediator, IRecentProxy recent, ISettingsProxy settings, INavigationService navigation) : base(recent)
|
||||
public NewVm(IMediator mediator, IRecentProxy recent, ISettingsProxy settings, INavigationService navigation)
|
||||
{
|
||||
_mediator = mediator;
|
||||
_settings = settings;
|
||||
|
@@ -1,13 +1,10 @@
|
||||
using System.Threading.Tasks;
|
||||
using GalaSoft.MvvmLight;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using GalaSoft.MvvmLight;
|
||||
using ModernKeePass.Domain.Dtos;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class OpenVm: ViewModelBase
|
||||
{
|
||||
private readonly IRecentProxy _recent;
|
||||
private string _name;
|
||||
private string _path;
|
||||
private string _token;
|
||||
@@ -31,23 +28,12 @@ namespace ModernKeePass.ViewModels
|
||||
private set { Set(() => Path, ref _path, value); }
|
||||
}
|
||||
|
||||
public OpenVm(IRecentProxy recent)
|
||||
{
|
||||
_recent = recent;
|
||||
}
|
||||
|
||||
public async Task OpenFile(FileInfo file)
|
||||
public void OpenFile(FileInfo file)
|
||||
{
|
||||
Token = file.Id;
|
||||
Name = file.Name;
|
||||
Path = file.Path;
|
||||
RaisePropertyChanged(nameof(IsFileSelected));
|
||||
await AddToRecentList(file);
|
||||
}
|
||||
|
||||
private async Task AddToRecentList(FileInfo file)
|
||||
{
|
||||
await _recent.Add(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +1,15 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using Messages;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Domain.Interfaces;
|
||||
using ModernKeePass.ViewModels.ListItems;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class RecentVm : ViewModelBase, IHasSelectableObject
|
||||
public class RecentVm : ObservableObject, IHasSelectableObject
|
||||
{
|
||||
private readonly IRecentProxy _recent;
|
||||
private ISelectableModel _selectedItem;
|
||||
@@ -52,15 +50,8 @@ namespace ModernKeePass.ViewModels
|
||||
RecentItems = new ObservableCollection<RecentItemVm>(recentItems);
|
||||
if (RecentItems.Count > 0)
|
||||
SelectedItem = RecentItems[0];
|
||||
|
||||
MessengerInstance.Register<DatabaseOpeningMessage>(this, async action => await UpdateAccessTime(action.Token));
|
||||
}
|
||||
|
||||
private async Task UpdateAccessTime(string token)
|
||||
{
|
||||
await _recent.Get(token, true);
|
||||
}
|
||||
|
||||
private void ClearAll()
|
||||
{
|
||||
_recent.ClearAll();
|
||||
|
Reference in New Issue
Block a user