Better global exception handling

Save error now shows a Save as button
Recent list now not changed at every access (only on actual file open)
Some code refactoring
This commit is contained in:
BONNEVILLE Geoffroy
2017-11-24 12:17:41 +01:00
parent 1b2d25e171
commit 7cd05cb1d8
11 changed files with 99 additions and 30 deletions

View File

@@ -76,7 +76,7 @@ namespace ModernKeePass.Pages
? "Are you sure you want to send this entry to the recycle bin?"
: "Are you sure you want to delete this entry?";
var text = isRecycleBinEnabled ? "Item moved to the Recycle bin" : "Item permanently removed";
MessageDialogHelper.ShowDeleteConfirmationDialog("Delete", message, a =>
MessageDialogHelper.ShowActionDialog("Warning", message, "Delete", "Cancel", a =>
{
ToastNotificationHelper.ShowMovedToast(Model, "Deleting", text);
Model.MarkForDelete();

View File

@@ -116,7 +116,7 @@ namespace ModernKeePass.Pages
? "Are you sure you want to send the whole group and all its entries to the recycle bin?"
: "Are you sure you want to delete the whole group and all its entries?";
var text = isRecycleBinEnabled ? "Item moved to the Recycle bin" : "Item permanently removed";
MessageDialogHelper.ShowDeleteConfirmationDialog("Delete", message, a =>
MessageDialogHelper.ShowActionDialog("Warning", message, "Delete", "Cancel", a =>
{
ToastNotificationHelper.ShowMovedToast(Model, "Deleting", text);
Model.MarkForDelete();

View File

@@ -34,9 +34,13 @@
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Name}" Padding="5,0,0,0" />
<TextBlock Grid.Row="1" Text="{Binding Path}" Padding="5,0,0,0" FontSize="10" />
<local:CompositeKeyUserControl Grid.Row="2" x:Name="DatabaseUserControl" HorizontalAlignment="Stretch" MinWidth="400" Margin="0,10,0,0" Visibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}" ValidationChecking="OpenDatabaseUserControl_OnValidationChecking">
<local:CompositeKeyUserControl Grid.Row="2" x:Name="DatabaseUserControl" HorizontalAlignment="Stretch" MinWidth="400" Margin="0,10,0,0" Visibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ValidationChecking">
<core:CallMethodAction TargetObject="{Binding}" MethodName="OpenDatabaseFile" />
</core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="ValidationChecked">
<core:CallMethodAction TargetObject="{Binding}" MethodName="UpdateAccessTime" />
<core:NavigateToPageAction TargetPage="ModernKeePass.Pages.GroupDetailPage" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>

View File

@@ -1,9 +1,5 @@
// Pour en savoir plus sur le modèle d'élément Page vierge, consultez la page http://go.microsoft.com/fwlink/?LinkId=234238
using System;
using Windows.UI.Xaml;
using ModernKeePass.ViewModels;
namespace ModernKeePass.Pages
{
/// <summary>
@@ -11,17 +7,9 @@ namespace ModernKeePass.Pages
/// </summary>
public sealed partial class RecentDatabasesPage
{
public RecentVm Model => (RecentVm)DataContext;
public RecentDatabasesPage()
{
InitializeComponent();
}
private void OpenDatabaseUserControl_OnValidationChecking(object sender, EventArgs e)
{
var app = (App)Application.Current;
app.Database.DatabaseFile = ((RecentItemVm)Model.SelectedItem).DatabaseFile;
}
}
}