Refactor in file open mechanisms: file is passed to user control

Confirmation dialogs on group and entry delete
This commit is contained in:
2017-10-11 14:30:07 +02:00
committed by BONNEVILLE Geoffroy
parent 454e074c44
commit 97b1475100
12 changed files with 124 additions and 62 deletions

View File

@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using Windows.Storage;
using Windows.System;
using Windows.UI.Core;
using Windows.UI.Xaml;
@@ -13,6 +14,18 @@ namespace ModernKeePass.Controls
{
public sealed partial class OpenDatabaseUserControl : UserControl
{
public StorageFile DatabaseFile
{
get { return (StorageFile)GetValue(DatabaseFileProperty); }
set { SetValue(DatabaseFileProperty, value); }
}
public static readonly DependencyProperty DatabaseFileProperty =
DependencyProperty.Register(
"DatabaseFile",
typeof(StorageFile),
typeof(OpenDatabaseUserControl),
new PropertyMetadata(null, (o, args) => { }));
public OpenDatabaseUserControl()
{
InitializeComponent();
@@ -24,7 +37,7 @@ namespace ModernKeePass.Controls
private void OpenButton_OnClick(object sender, RoutedEventArgs e)
{
var app = (App)Application.Current;
StatusTextBlock.Text = app.Database.Open(PasswordBox.Password);
StatusTextBlock.Text = app.Database.Open(DatabaseFile, PasswordBox.Password);
if (app.Database.Status == DatabaseHelper.DatabaseStatus.Opened)
ValidationChecked?.Invoke(this, new PasswordEventArgs(app.Database.RootGroup));
}