Creation of a notification service

This commit is contained in:
Geoffroy BONNEVILLE
2020-04-22 18:12:28 +02:00
parent 61f5e9df0b
commit a9ed588c9a
18 changed files with 201 additions and 194 deletions

View File

@@ -41,6 +41,7 @@ namespace ModernKeePass
private readonly INavigationService _navigation;
private readonly IHockeyClient _hockey;
private readonly IDialogService _dialog;
private readonly INotificationService _notification;
public static IServiceProvider Services { get; private set; }
@@ -64,6 +65,7 @@ namespace ModernKeePass
_settings = Services.GetService<ISettingsProxy>();
_navigation = Services.GetService<INavigationService>();
_dialog = Services.GetService<IDialogService>();
_notification = Services.GetService<INotificationService>();
_hockey = Services.GetService<IHockeyClient>();
InitializeComponent();
@@ -181,14 +183,14 @@ namespace ModernKeePass
{
await _mediator.Send(new ReOpenDatabaseQuery());
#if DEBUG
ToastNotificationHelper.ShowGenericToast("App resumed", "Database reopened (changes were saved)");
_notification.Show("App resumed", "Database reopened (changes were saved)");
#endif
}
catch (Exception)
{
currentFrame?.Navigate(typeof(MainPage));
#if DEBUG
ToastNotificationHelper.ShowGenericToast("App resumed", "Nothing to do, no previous database opened");
_notification.Show("App resumed", "Nothing to do, no previous database opened");
#endif
}
}
@@ -229,7 +231,7 @@ namespace ModernKeePass
}
catch (Exception exception)
{
ToastNotificationHelper.ShowErrorToast(exception);
_notification.Show(exception.Source, exception.Message);
}
finally
{

View File

@@ -133,7 +133,7 @@
<value>Opening...</value>
</data>
<data name="CompositeKeyUpdated" xml:space="preserve">
<value>Database composite key updated.</value>
<value>Database credentials updated.</value>
</data>
<data name="EntityDeleteActionButton" xml:space="preserve">
<value>Delete</value>

View File

@@ -133,7 +133,7 @@
<value>Ouverture...</value>
</data>
<data name="CompositeKeyUpdated" xml:space="preserve">
<value>Clé composite de la base de données mise à jour.</value>
<value>Identifiants de la base de données mis à jour.</value>
</data>
<data name="EntityDeleteActionButton" xml:space="preserve">
<value>Supprimer</value>

View File

@@ -14,7 +14,7 @@
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToSolidColorBrushConverter"/>
<converters:DiscreteIntToSolidColorBrushConverter x:Key="DiscreteIntToSolidColorBrushConverter"/>
<converters:EmptyStringToVisibilityConverter x:Key="EmptyStringToVisibilityConverter"/>
<viewModels:SetCredentialsViewModel x:Key="ViewModel"/>
<viewModels:SetCredentialsVm x:Key="ViewModel"/>
</UserControl.Resources>
<Grid DataContext="{StaticResource ViewModel}">
<Grid.ColumnDefinitions>

View File

@@ -11,7 +11,7 @@ namespace ModernKeePass.Views.UserControls
{
public sealed partial class SetCredentialsUserControl
{
private SetCredentialsViewModel Model => (SetCredentialsViewModel)Resources["ViewModel"];
private SetCredentialsVm Model => (SetCredentialsVm)Resources["ViewModel"];
public string ButtonLabel
{