Open file from Explorer with association works

Major code refactor in Open, Save and Recent pages and VM
Main page automatically opens a sub page depending on context
This commit is contained in:
2017-10-10 15:00:31 +02:00
committed by BONNEVILLE Geoffroy
parent 98ecb0b8a1
commit ec4f2e7d88
17 changed files with 205 additions and 125 deletions

View File

@@ -6,6 +6,7 @@ using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using ModernKeePass.Common;
using ModernKeePass.Events;
using ModernKeePass.ViewModels;
// Pour en savoir plus sur le modèle d'élément Page vierge, consultez la page http://go.microsoft.com/fwlink/?LinkId=234238
@@ -29,23 +30,10 @@ namespace ModernKeePass.Pages
base.OnNavigatedTo(e);
_mainFrame = e.Parameter as Frame;
}
private async void RecentListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void PasswordUserControl_PasswordChecked(object sender, PasswordEventArgs e)
{
var recentVm = DataContext as RecentVm;
if (recentVm.SelectedItem == null) return;
var mru = StorageApplicationPermissions.MostRecentlyUsedList;
var file = await mru.GetFileAsync(recentVm.SelectedItem.Token);
// TODO: this closes the current opened database
var app = (App)Application.Current;
app.Database = new DatabaseHelper(file);
}
private void PasswordUserControl_PasswordChecked(object sender, EventArgs e)
{
var app = (App)Application.Current;
if (app.Database.IsOpen) _mainFrame.Navigate(typeof(GroupDetailPage), app.Database.RootGroup);
_mainFrame.Navigate(typeof(GroupDetailPage), e.RootGroup);
}
}
}