Files
modernkeepass/ModernKeePass/MainPage.xaml.cs

47 lines
1.5 KiB
C#
Raw Normal View History

using System;
2017-09-10 13:49:11 -04:00
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using ModernKeePass.Pages;
using ModernKeePass.ViewModels;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
2017-09-10 13:49:11 -04:00
namespace ModernKeePass
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
2017-09-10 13:49:11 -04:00
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
2017-09-11 18:25:00 +02:00
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;
var database = new DatabaseVm();
database.Open(file, "test");
2017-09-15 11:24:14 +02:00
Frame.Navigate(typeof(GroupDetailPage), database);
//Frame.Navigate(typeof(GroupDetailPage), database.RootGroup);
2017-09-11 18:25:00 +02:00
}
else
{
textBlock.Text = "Operation cancelled.";
}
}
2017-09-10 13:49:11 -04:00
}
}