Added Save As function

This commit is contained in:
2017-10-12 11:45:00 +02:00
committed by BONNEVILLE Geoffroy
parent 676365460c
commit 10b6330ac6
6 changed files with 39 additions and 48 deletions

View File

@@ -1,4 +1,7 @@
using Windows.UI.Xaml;
using System;
using System.Collections.Generic;
using Windows.Storage.Pickers;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using ModernKeePass.ViewModels;
@@ -30,5 +33,22 @@ namespace ModernKeePass.Pages
viewModel.Save();
_mainFrame.Navigate(typeof(MainPage));
}
private async void SaveAsButton_OnClick(object sender, RoutedEventArgs e)
{
var savePicker = new FileSavePicker
{
SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
SuggestedFileName = "New Database"
};
savePicker.FileTypeChoices.Add("KeePass 2.x database", new List<string> { ".kdbx" });
var file = await savePicker.PickSaveFileAsync();
if (file == null) return;
var viewModel = DataContext as SaveVm;
viewModel.Save(file);
_mainFrame.Navigate(typeof(MainPage));
}
}
}