mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using System.ComponentModel;
|
|
using Windows.Storage;
|
|
using Windows.Storage.AccessCache;
|
|
|
|
namespace ModernKeePass.ViewModels
|
|
{
|
|
public class OpenVm: INotifyPropertyChanged
|
|
{
|
|
public StorageFile File { get; set; }
|
|
public bool ShowPasswordBox
|
|
{
|
|
get { return File != null; }
|
|
}
|
|
|
|
public string Name
|
|
{
|
|
get { return File?.Name; }
|
|
}
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
|
private void NotifyPropertyChanged(string propertyName)
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
|
|
public void OpenFile(StorageFile file)
|
|
{
|
|
File = file;
|
|
NotifyPropertyChanged("Name");
|
|
NotifyPropertyChanged("ShowPasswordBox");
|
|
AddToRecentList(file);
|
|
}
|
|
|
|
private void AddToRecentList(StorageFile file)
|
|
{
|
|
var mru = StorageApplicationPermissions.MostRecentlyUsedList;
|
|
mru.Add(file, file.DisplayName);
|
|
}
|
|
}
|
|
}
|