using ModernKeePass.Pages; using System; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Input; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 namespace ModernKeePass { /// /// An empty page that can be used on its own or navigated to within a Frame. /// public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); } private async void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { var picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.List; picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary; picker.FileTypeFilter.Add(".kdbx"); var file = await picker.PickSingleFileAsync(); if (file != null) { // Application now has read/write access to the picked file textBlock.Text = "Opened database: " + file.Name; Frame.Navigate(typeof(DatabaseViewPage), file); } else { textBlock.Text = "Operation cancelled."; } } } }