2017-10-11 18:43:27 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2020-04-06 20:20:45 +02:00
|
|
|
|
using Windows.Storage.AccessCache;
|
2017-10-11 18:43:27 +02:00
|
|
|
|
using Windows.Storage.Pickers;
|
|
|
|
|
using Windows.UI.Xaml;
|
|
|
|
|
using ModernKeePass.ViewModels;
|
|
|
|
|
|
|
|
|
|
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
|
|
|
|
|
2017-12-08 19:38:33 +01:00
|
|
|
|
namespace ModernKeePass.Views
|
2017-10-11 18:43:27 +02:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// An empty page that can be used on its own or navigated to within a Frame.
|
|
|
|
|
/// </summary>
|
2017-10-12 17:45:37 +02:00
|
|
|
|
public sealed partial class NewDatabasePage
|
2017-10-11 18:43:27 +02:00
|
|
|
|
{
|
2020-04-23 19:00:38 +02:00
|
|
|
|
private NewVm Model => (NewVm)DataContext;
|
2020-04-27 11:14:29 +02:00
|
|
|
|
|
|
|
|
|
public NewDatabasePage()
|
2017-10-11 18:43:27 +02:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-10 17:29:52 +02:00
|
|
|
|
private async void CreateDatabaseButton_OnClick(object sender, RoutedEventArgs e)
|
2017-10-11 18:43:27 +02:00
|
|
|
|
{
|
|
|
|
|
var savePicker = new FileSavePicker
|
|
|
|
|
{
|
|
|
|
|
SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
|
|
|
|
|
SuggestedFileName = "New Database"
|
|
|
|
|
};
|
2020-04-30 19:40:48 +02:00
|
|
|
|
savePicker.FileTypeChoices.Add("KeePass 2.x database", new List<string> {".kdbx"});
|
2017-10-11 18:43:27 +02:00
|
|
|
|
|
2020-04-09 19:43:06 +02:00
|
|
|
|
var file = await savePicker.PickSaveFileAsync().AsTask();
|
2017-10-11 18:43:27 +02:00
|
|
|
|
if (file == null) return;
|
2020-04-06 20:20:45 +02:00
|
|
|
|
|
2020-04-30 19:40:48 +02:00
|
|
|
|
Model.Token = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
|
|
|
|
|
Model.Name = file.Name;
|
|
|
|
|
Model.Path = file.Path;
|
2017-10-11 18:43:27 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|