mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Save error is now handled via Messenger instead of unhandled exception handler (which didn't work)
Save as actually works now WIP Styles Code cleanup
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
using GalaSoft.MvvmLight;
|
||||
using System.Threading.Tasks;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Domain.Common;
|
||||
using ModernKeePass.Domain.Dtos;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class OpenVm: ViewModelBase
|
||||
{
|
||||
private readonly IFileProxy _file;
|
||||
private string _name;
|
||||
private string _path;
|
||||
private string _token;
|
||||
@@ -30,5 +36,27 @@ namespace ModernKeePass.ViewModels
|
||||
get { return _path; }
|
||||
set { Set(() => Path, ref _path, value); }
|
||||
}
|
||||
|
||||
public RelayCommand OpenDatabaseFileCommand { get; }
|
||||
|
||||
public OpenVm(IFileProxy file)
|
||||
{
|
||||
_file = file;
|
||||
OpenDatabaseFileCommand = new RelayCommand(async () => await OpenDatabaseFile());
|
||||
}
|
||||
|
||||
public void SetFileInformation(FileInfo file)
|
||||
{
|
||||
if (file == null) return;
|
||||
Token = file.Id;
|
||||
Path = file.Path;
|
||||
Name = file.Name;
|
||||
}
|
||||
|
||||
private async Task OpenDatabaseFile()
|
||||
{
|
||||
var file = await _file.OpenFile(string.Empty, Constants.Extensions.Kdbx, true);
|
||||
SetFileInformation(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user