mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Save error is now handled via Messenger instead of unhandled exception handler (which didn't work)
Save as actually works now WIP Styles Code cleanup
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Windows.Storage.AccessCache;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.UI.Xaml;
|
||||
using ModernKeePass.ViewModels;
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
@@ -11,8 +6,6 @@ namespace ModernKeePass.Views.UserControls
|
||||
{
|
||||
public sealed partial class SetCredentialsUserControl
|
||||
{
|
||||
private SetCredentialsVm Model => (SetCredentialsVm)Grid.DataContext;
|
||||
|
||||
public string ButtonLabel
|
||||
{
|
||||
get { return (string)GetValue(ButtonLabelProperty); }
|
||||
@@ -29,40 +22,5 @@ namespace ModernKeePass.Views.UserControls
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async void KeyFileButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var picker =
|
||||
new FileOpenPicker
|
||||
{
|
||||
ViewMode = PickerViewMode.List,
|
||||
SuggestedStartLocation = PickerLocationId.DocumentsLibrary
|
||||
};
|
||||
picker.FileTypeFilter.Add("*");
|
||||
|
||||
// Application now has read/write access to the picked file
|
||||
var file = await picker.PickSingleFileAsync();
|
||||
if (file == null) return;
|
||||
|
||||
Model.KeyFilePath = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
|
||||
Model.KeyFileText = file.Name;
|
||||
}
|
||||
|
||||
private async void CreateKeyFileButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var savePicker = new FileSavePicker
|
||||
{
|
||||
SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
|
||||
SuggestedFileName = "Key"
|
||||
};
|
||||
savePicker.FileTypeChoices.Add("Key file", new List<string> { ".key" });
|
||||
|
||||
var file = await savePicker.PickSaveFileAsync();
|
||||
if (file == null) return;
|
||||
|
||||
Model.KeyFilePath = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
|
||||
Model.KeyFileText = file.Name;
|
||||
await Model.GenerateKeyFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user