mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Refactor in file open mechanisms: file is passed to user control
Confirmation dialogs on group and entry delete
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Windows.UI.Popups;
|
||||
using ModernKeePass.Common;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
@@ -25,9 +26,9 @@ namespace ModernKeePass.Pages
|
||||
|
||||
public EntryDetailPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.navigationHelper = new NavigationHelper(this);
|
||||
this.navigationHelper.LoadState += navigationHelper_LoadState;
|
||||
InitializeComponent();
|
||||
navigationHelper = new NavigationHelper(this);
|
||||
navigationHelper.LoadState += navigationHelper_LoadState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -70,11 +71,28 @@ namespace ModernKeePass.Pages
|
||||
|
||||
#endregion
|
||||
|
||||
private void AppBarButton_Click(object sender, RoutedEventArgs e)
|
||||
private async void AppBarButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var entry = DataContext as EntryVm;
|
||||
entry?.RemoveEntry();
|
||||
if (Frame.CanGoBack) Frame.GoBack();
|
||||
// Create the message dialog and set its content
|
||||
var messageDialog = new MessageDialog("Are you sure you want to delete this entry?");
|
||||
|
||||
// Add commands and set their callbacks; both buttons use the same callback function instead of inline event handlers
|
||||
messageDialog.Commands.Add(new UICommand("Delete", delete =>
|
||||
{
|
||||
var entry = DataContext as EntryVm;
|
||||
entry?.RemoveEntry();
|
||||
if (Frame.CanGoBack) Frame.GoBack();
|
||||
}));
|
||||
messageDialog.Commands.Add(new UICommand("Cancel"));
|
||||
|
||||
// Set the command that will be invoked by default
|
||||
messageDialog.DefaultCommandIndex = 1;
|
||||
|
||||
// Set the command to be invoked when escape is pressed
|
||||
messageDialog.CancelCommandIndex = 1;
|
||||
|
||||
// Show the message dialog
|
||||
await messageDialog.ShowAsync();
|
||||
}
|
||||
|
||||
private async void UrlButton_Click(object sender, RoutedEventArgs e)
|
||||
|
Reference in New Issue
Block a user