mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Added Save As function
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user